TUN-3757: Fix legacy Uint flags that are incorrectly handled by ufarve library
The following UInt flags: * Uint64 - heartbeat-count, compression-quality * Uint - retries, port, proxy-port were not being correctly picked from the configuration YAML since the multi origin refactor This is due to a limitation of the ufarve library, which we overcome for now with handling those as Int flags.
This commit is contained in:
parent
391facbedf
commit
7c3ceeeaef
|
@ -622,13 +622,15 @@ func tunnelFlags(shouldHide bool) []cli.Flag {
|
||||||
Value: time.Second * 5,
|
Value: time.Second * 5,
|
||||||
Hidden: true,
|
Hidden: true,
|
||||||
}),
|
}),
|
||||||
altsrc.NewUint64Flag(&cli.Uint64Flag{
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
|
altsrc.NewIntFlag(&cli.IntFlag{
|
||||||
Name: "heartbeat-count",
|
Name: "heartbeat-count",
|
||||||
Usage: "Minimum number of unacked heartbeats to send before closing the connection.",
|
Usage: "Minimum number of unacked heartbeats to send before closing the connection.",
|
||||||
Value: 5,
|
Value: 5,
|
||||||
Hidden: true,
|
Hidden: true,
|
||||||
}),
|
}),
|
||||||
altsrc.NewUintFlag(&cli.UintFlag{
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
|
altsrc.NewIntFlag(&cli.IntFlag{
|
||||||
Name: "retries",
|
Name: "retries",
|
||||||
Value: 5,
|
Value: 5,
|
||||||
Usage: "Maximum number of retries for connection/protocol errors.",
|
Usage: "Maximum number of retries for connection/protocol errors.",
|
||||||
|
@ -647,7 +649,8 @@ func tunnelFlags(shouldHide bool) []cli.Flag {
|
||||||
EnvVars: []string{"TUNNEL_GRACE_PERIOD"},
|
EnvVars: []string{"TUNNEL_GRACE_PERIOD"},
|
||||||
Hidden: true,
|
Hidden: true,
|
||||||
}),
|
}),
|
||||||
altsrc.NewUintFlag(&cli.UintFlag{
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
|
altsrc.NewIntFlag(&cli.IntFlag{
|
||||||
Name: "compression-quality",
|
Name: "compression-quality",
|
||||||
Value: 0,
|
Value: 0,
|
||||||
Usage: "(beta) Use cross-stream compression instead HTTP compression. 0-off, 1-low, 2-medium, >=3-high.",
|
Usage: "(beta) Use cross-stream compression instead HTTP compression. 0-off, 1-low, 2-medium, >=3-high.",
|
||||||
|
@ -932,6 +935,7 @@ func sshFlags(shouldHide bool) []cli.Flag {
|
||||||
EnvVars: []string{"TUNNEL_PROXY_ADDRESS"},
|
EnvVars: []string{"TUNNEL_PROXY_ADDRESS"},
|
||||||
Hidden: shouldHide,
|
Hidden: shouldHide,
|
||||||
}),
|
}),
|
||||||
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
altsrc.NewIntFlag(&cli.IntFlag{
|
altsrc.NewIntFlag(&cli.IntFlag{
|
||||||
Name: ingress.ProxyPortFlag,
|
Name: ingress.ProxyPortFlag,
|
||||||
Usage: "Listen port for the proxy.",
|
Usage: "Listen port for the proxy.",
|
||||||
|
|
|
@ -262,8 +262,10 @@ func prepareTunnelConfig(
|
||||||
}
|
}
|
||||||
muxerConfig := &connection.MuxerConfig{
|
muxerConfig := &connection.MuxerConfig{
|
||||||
HeartbeatInterval: c.Duration("heartbeat-interval"),
|
HeartbeatInterval: c.Duration("heartbeat-interval"),
|
||||||
MaxHeartbeats: c.Uint64("heartbeat-count"),
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
CompressionSetting: h2mux.CompressionSetting(c.Uint64("compression-quality")),
|
MaxHeartbeats: uint64(c.Int("heartbeat-count")),
|
||||||
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
|
CompressionSetting: h2mux.CompressionSetting(uint64(c.Int("compression-quality"))),
|
||||||
MetricsUpdateFreq: c.Duration("metrics-update-freq"),
|
MetricsUpdateFreq: c.Duration("metrics-update-freq"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +283,8 @@ func prepareTunnelConfig(
|
||||||
Log: log,
|
Log: log,
|
||||||
Observer: connection.NewObserver(transportLogger, eventChans, isUIEnabled),
|
Observer: connection.NewObserver(transportLogger, eventChans, isUIEnabled),
|
||||||
ReportedVersion: version,
|
ReportedVersion: version,
|
||||||
Retries: c.Uint("retries"),
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
|
Retries: uint(c.Int("retries")),
|
||||||
RunFromTerminal: isRunningFromTerminal(),
|
RunFromTerminal: isRunningFromTerminal(),
|
||||||
NamedTunnel: namedTunnel,
|
NamedTunnel: namedTunnel,
|
||||||
ClassicTunnel: classicTunnel,
|
ClassicTunnel: classicTunnel,
|
||||||
|
|
|
@ -92,7 +92,8 @@ func originRequestFromSingeRule(c *cli.Context) OriginRequestConfig {
|
||||||
proxyAddress = c.String(flag)
|
proxyAddress = c.String(flag)
|
||||||
}
|
}
|
||||||
if flag := ProxyPortFlag; c.IsSet(flag) {
|
if flag := ProxyPortFlag; c.IsSet(flag) {
|
||||||
proxyPort = c.Uint(flag)
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
|
proxyPort = uint(c.Int(flag))
|
||||||
}
|
}
|
||||||
if c.IsSet(Socks5Flag) {
|
if c.IsSet(Socks5Flag) {
|
||||||
proxyType = socksProxy
|
proxyType = socksProxy
|
||||||
|
|
|
@ -50,6 +50,7 @@ func Command(hidden bool) *cli.Command {
|
||||||
Value: "localhost",
|
Value: "localhost",
|
||||||
EnvVars: []string{"TUNNEL_DNS_ADDRESS"},
|
EnvVars: []string{"TUNNEL_DNS_ADDRESS"},
|
||||||
},
|
},
|
||||||
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
&cli.IntFlag{
|
&cli.IntFlag{
|
||||||
Name: "port",
|
Name: "port",
|
||||||
Usage: "Listen on given port for the DNS over HTTPS proxy server.",
|
Usage: "Listen on given port for the DNS over HTTPS proxy server.",
|
||||||
|
@ -87,7 +88,8 @@ func Run(c *cli.Context) error {
|
||||||
|
|
||||||
listener, err := CreateListener(
|
listener, err := CreateListener(
|
||||||
c.String("address"),
|
c.String("address"),
|
||||||
uint16(c.Uint("port")),
|
// Note TUN-3758 , we use Int because UInt is not supported with altsrc
|
||||||
|
uint16(c.Int("port")),
|
||||||
c.StringSlice("upstream"),
|
c.StringSlice("upstream"),
|
||||||
c.StringSlice("bootstrap"),
|
c.StringSlice("bootstrap"),
|
||||||
log,
|
log,
|
||||||
|
|
Loading…
Reference in New Issue