diff --git a/cmd/strelaysrv/main.go b/cmd/strelaysrv/main.go index f1daf169..8afc73c1 100644 --- a/cmd/strelaysrv/main.go +++ b/cmd/strelaysrv/main.go @@ -64,12 +64,13 @@ var ( limitCheckTimer *time.Timer - sessionLimitBps int - globalLimitBps int - overLimit int32 - descriptorLimit int64 - sessionLimiter *rate.Limiter - globalLimiter *rate.Limiter + sessionLimitBps int + globalLimitBps int + overLimit int32 + descriptorLimit int64 + sessionLimiter *rate.Limiter + globalLimiter *rate.Limiter + networkBufferSize int statusAddr string poolAddrs string @@ -108,6 +109,7 @@ func main() { flag.IntVar(&natRenewal, "nat-renewal", 30, "NAT renewal frequency in minutes") flag.IntVar(&natTimeout, "nat-timeout", 10, "NAT discovery timeout in seconds") flag.BoolVar(&pprofEnabled, "pprof", false, "Enable the built in profiling on the status server") + flag.IntVar(&networkBufferSize, "network-buffer", 2048, "Network buffer size (two of these per proxied connection)") flag.Parse() if extAddress == "" { diff --git a/cmd/strelaysrv/session.go b/cmd/strelaysrv/session.go index 0ed0d2a9..6f0e2478 100644 --- a/cmd/strelaysrv/session.go +++ b/cmd/strelaysrv/session.go @@ -254,7 +254,7 @@ func (s *session) proxy(c1, c2 net.Conn) error { atomic.AddInt64(&numProxies, 1) defer atomic.AddInt64(&numProxies, -1) - buf := make([]byte, 65536) + buf := make([]byte, networkBufferSize) for { c1.SetReadDeadline(time.Now().Add(networkTimeout)) n, err := c1.Read(buf)