Browse Source

feat: set default config

AkinoKaede 2 years ago
parent
commit
a3728b6abc
1 changed files with 7 additions and 4 deletions
  1. 7 4
      app/tun/handler_tcp.go

+ 7 - 4
app/tun/handler_tcp.go

@@ -17,19 +17,22 @@ import (
 	"gvisor.dev/gvisor/pkg/waiter"
 )
 
+const (
+	rcvWnd      = 0 // default settings
+	maxInFlight = 2 << 10
+)
+
 type TCPHandler struct {
 	ctx           context.Context
 	dispatcher    routing.Dispatcher
 	policyManager policy.Manager
 	config        *Config
 
-	stack       *stack.Stack
-	rcvWnd      int
-	maxInFlight int
+	stack *stack.Stack
 }
 
 func (h *TCPHandler) SetHandler() {
-	tcpForwarder := tcp.NewForwarder(h.stack, h.rcvWnd, h.maxInFlight, func(r *tcp.ForwarderRequest) {
+	tcpForwarder := tcp.NewForwarder(h.stack, rcvWnd, maxInFlight, func(r *tcp.ForwarderRequest) {
 		wg := new(waiter.Queue)
 		linkedEndpoint, err := r.CreateEndpoint(wg)
 		if err != nil {