Browse Source

pass connection_id option

Vladislav Yarmak 8 months ago
parent
commit
73bbbeba6a
3 changed files with 6 additions and 0 deletions
  1. 1 0
      client/config.go
  2. 4 0
      cmd/dtlspipe/main.go
  3. 1 0
      server/config.go

+ 1 - 0
client/config.go

@@ -23,6 +23,7 @@ type Config struct {
 	StaleMode      util.StaleMode
 	TimeLimitFunc  func() time.Duration
 	AllowFunc      func(net.Addr) bool
+	EnableCID      bool
 }
 
 func (cfg *Config) populateDefaults() *Config {

+ 4 - 0
cmd/dtlspipe/main.go

@@ -135,6 +135,7 @@ var (
 	mtu             = flag.Int("mtu", 1400, "MTU used for DTLS fragments")
 	cpuprofile      = flag.String("cpuprofile", "", "write cpu profile to file")
 	skipHelloVerify = flag.Bool("skip-hello-verify", true, "(server only) skip hello verify request. Useful to workaround DPI")
+	connectionIDExt = flag.Bool("cid", true, "enable connection_id extension")
 	ciphersuites    = cipherlistArg{}
 	curves          = curvelistArg{}
 	staleMode       = util.EitherStale
@@ -253,6 +254,7 @@ func cmdClient(bindAddress, remoteAddress string) int {
 		StaleMode:      staleMode,
 		TimeLimitFunc:  util.TimeLimitFunc(timeLimit.low, timeLimit.high),
 		AllowFunc:      util.AllowByRatelimit(rateLimit.value),
+		EnableCID:      *connectionIDExt,
 	}
 
 	clt, err := client.New(&cfg)
@@ -306,6 +308,7 @@ func cmdHoppingClient(args []string) int {
 		StaleMode:      staleMode,
 		TimeLimitFunc:  util.TimeLimitFunc(timeLimit.low, timeLimit.high),
 		AllowFunc:      util.AllowByRatelimit(rateLimit.value),
+		EnableCID:      *connectionIDExt,
 	}
 
 	clt, err := client.New(&cfg)
@@ -345,6 +348,7 @@ func cmdServer(bindAddress, remoteAddress string) int {
 		StaleMode:       staleMode,
 		TimeLimitFunc:   util.TimeLimitFunc(timeLimit.low, timeLimit.high),
 		AllowFunc:       util.AllowByRatelimit(rateLimit.value),
+		EnableCID:       *connectionIDExt,
 	}
 
 	srv, err := server.New(&cfg)

+ 1 - 0
server/config.go

@@ -23,6 +23,7 @@ type Config struct {
 	StaleMode       util.StaleMode
 	TimeLimitFunc   func() time.Duration
 	AllowFunc       func(net.Addr) bool
+	EnableCID       bool
 }
 
 func (cfg *Config) populateDefaults() *Config {