Skip to content

Commit ea6fe12

Browse files
committed
TUN-7167: Respect protocol overrides with --token
Previously, if run with both `--protocol` and `--token` the protocol would be incorrectly overridden to QUIC.
1 parent 079631c commit ea6fe12

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

connection/protocol.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,6 @@ func NewProtocolSelector(
218218
}, nil
219219
}
220220

221-
// When a --token is provided, we want to start with QUIC but have fallback to HTTP2
222-
if tunnelTokenProvided {
223-
return newDefaultProtocolSelector(QUIC), nil
224-
}
225-
226221
threshold := switchThreshold(accountTag)
227222
fetchedProtocol, err := getProtocol(ProtocolList, protocolFetcher, threshold)
228223
log.Debug().Msgf("Fetched protocol: %s", fetchedProtocol)
@@ -244,6 +239,10 @@ func NewProtocolSelector(
244239
case HTTP2.String():
245240
return &staticProtocolSelector{current: HTTP2}, nil
246241
case AutoSelectFlag:
242+
// When a --token is provided, we want to start with QUIC but have fallback to HTTP2
243+
if tunnelTokenProvided {
244+
return newDefaultProtocolSelector(QUIC), nil
245+
}
247246
return newRemoteProtocolSelector(fetchedProtocol, ProtocolList, threshold, protocolFetcher, resolveTTL, log), nil
248247
}
249248

0 commit comments

Comments
 (0)