Skip to content

Commit fa8aa02

Browse files
committed
TUN-4819: Tolerate protocol TXT record lookup failing
1 parent aa24338 commit fa8aa02

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

connection/protocol.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ func NewProtocolSelector(
172172

173173
http2Percentage, err := fetchFunc()
174174
if err != nil {
175-
return nil, err
175+
log.Err(err).Msg("Unable to lookup protocol. Defaulting to `http2`. If this fails, you can set `--protocol h2mux` in your cloudflared command.")
176+
return &staticProtocolSelector{
177+
current: HTTP2,
178+
}, nil
176179
}
177180
if protocolFlag == HTTP2.String() {
178181
if http2Percentage < 0 {

connection/protocol_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ func TestNewProtocolSelector(t *testing.T) {
158158
protocol: "unknown",
159159
fetchFunc: mockFetcherWithError(),
160160
namedTunnelConfig: testNamedTunnelConfig,
161-
wantErr: true,
161+
expectedProtocol: HTTP2,
162+
wantErr: false,
162163
},
163164
}
164165

0 commit comments

Comments
 (0)