From ea6fe121f81de5663940f5287786895b612e8dfb Mon Sep 17 00:00:00 2001 From: Devin Carr Date: Wed, 8 Feb 2023 11:03:04 -0800 Subject: [PATCH] TUN-7167: Respect protocol overrides with --token Previously, if run with both `--protocol` and `--token` the protocol would be incorrectly overridden to QUIC. --- connection/protocol.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/connection/protocol.go b/connection/protocol.go index 365b4125..ecc367b4 100644 --- a/connection/protocol.go +++ b/connection/protocol.go @@ -218,11 +218,6 @@ func NewProtocolSelector( }, nil } - // When a --token is provided, we want to start with QUIC but have fallback to HTTP2 - if tunnelTokenProvided { - return newDefaultProtocolSelector(QUIC), nil - } - threshold := switchThreshold(accountTag) fetchedProtocol, err := getProtocol(ProtocolList, protocolFetcher, threshold) log.Debug().Msgf("Fetched protocol: %s", fetchedProtocol) @@ -244,6 +239,10 @@ func NewProtocolSelector( case HTTP2.String(): return &staticProtocolSelector{current: HTTP2}, nil case AutoSelectFlag: + // When a --token is provided, we want to start with QUIC but have fallback to HTTP2 + if tunnelTokenProvided { + return newDefaultProtocolSelector(QUIC), nil + } return newRemoteProtocolSelector(fetchedProtocol, ProtocolList, threshold, protocolFetcher, resolveTTL, log), nil }