2222const (
2323 defaultProxyAddress = "127.0.0.1"
2424 defaultKeepAliveConnections = 100
25+ defaultMaxActiveFlows = 0 // unlimited
2526 SSHServerFlag = "ssh-server"
2627 Socks5Flag = "socks5"
2728 ProxyConnectTimeoutFlag = "proxy-connect-timeout"
@@ -46,17 +47,22 @@ const (
4647
4748type WarpRoutingConfig struct {
4849 ConnectTimeout config.CustomDuration `yaml:"connectTimeout" json:"connectTimeout,omitempty"`
50+ MaxActiveFlows uint64 `yaml:"maxActiveFlows" json:"MaxActiveFlows,omitempty"`
4951 TCPKeepAlive config.CustomDuration `yaml:"tcpKeepAlive" json:"tcpKeepAlive,omitempty"`
5052}
5153
5254func NewWarpRoutingConfig (raw * config.WarpRoutingConfig ) WarpRoutingConfig {
5355 cfg := WarpRoutingConfig {
5456 ConnectTimeout : defaultWarpRoutingConnectTimeout ,
57+ MaxActiveFlows : defaultMaxActiveFlows ,
5558 TCPKeepAlive : defaultTCPKeepAlive ,
5659 }
5760 if raw .ConnectTimeout != nil {
5861 cfg .ConnectTimeout = * raw .ConnectTimeout
5962 }
63+ if raw .MaxActiveFlows != nil {
64+ cfg .MaxActiveFlows = * raw .MaxActiveFlows
65+ }
6066 if raw .TCPKeepAlive != nil {
6167 cfg .TCPKeepAlive = * raw .TCPKeepAlive
6268 }
@@ -68,6 +74,9 @@ func (c *WarpRoutingConfig) RawConfig() config.WarpRoutingConfig {
6874 if c .ConnectTimeout .Duration != defaultWarpRoutingConnectTimeout .Duration {
6975 raw .ConnectTimeout = & c .ConnectTimeout
7076 }
77+ if c .MaxActiveFlows != defaultMaxActiveFlows {
78+ raw .MaxActiveFlows = & c .MaxActiveFlows
79+ }
7180 if c .TCPKeepAlive .Duration != defaultTCPKeepAlive .Duration {
7281 raw .TCPKeepAlive = & c .TCPKeepAlive
7382 }
@@ -172,6 +181,7 @@ func originRequestFromSingleRule(c *cli.Context) OriginRequestConfig {
172181 }
173182 if flag := ProxyPortFlag ; c .IsSet (flag ) {
174183 // Note TUN-3758 , we use Int because UInt is not supported with altsrc
184+ // nolint: gosec
175185 proxyPort = uint (c .Int (flag ))
176186 }
177187 if flag := Http2OriginFlag ; c .IsSet (flag ) {
@@ -551,7 +561,7 @@ func convertToRawIPRules(ipRules []ipaccess.Rule) []config.IngressIPRule {
551561}
552562
553563func defaultBoolToNil (b bool ) * bool {
554- if b == false {
564+ if ! b {
555565 return nil
556566 }
557567
0 commit comments