|
|
@@ -135,6 +135,7 @@ func TestSSH(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -157,6 +158,7 @@ func TestOSSH(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -179,6 +181,7 @@ func TestFragmentedOSSH(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -201,6 +204,7 @@ func TestUnfrontedMeek(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -224,6 +228,7 @@ func TestUnfrontedMeekHTTPS(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -247,6 +252,7 @@ func TestUnfrontedMeekHTTPSTLS13(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -270,6 +276,7 @@ func TestUnfrontedMeekSessionTicket(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -293,6 +300,7 @@ func TestUnfrontedMeekSessionTicketTLS13(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -318,6 +326,33 @@ func TestQUICOSSH(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+func TestLimitedQUICOSSH(t *testing.T) {
|
|
|
+ if !quic.Enabled() {
|
|
|
+ t.Skip("QUIC is not enabled")
|
|
|
+ }
|
|
|
+ runServer(t,
|
|
|
+ &runServerConfig{
|
|
|
+ tunnelProtocol: "QUIC-OSSH",
|
|
|
+ enableSSHAPIRequests: true,
|
|
|
+ doHotReload: false,
|
|
|
+ doDefaultSponsorID: false,
|
|
|
+ denyTrafficRules: false,
|
|
|
+ requireAuthorization: true,
|
|
|
+ omitAuthorization: false,
|
|
|
+ doTunneledWebRequest: true,
|
|
|
+ doTunneledNTPRequest: true,
|
|
|
+ forceFragmenting: false,
|
|
|
+ forceLivenessTest: false,
|
|
|
+ doPruneServerEntries: false,
|
|
|
+ doDanglingTCPConn: false,
|
|
|
+ doPacketManipulation: false,
|
|
|
+ doBurstMonitor: false,
|
|
|
+ doSplitTunnel: false,
|
|
|
+ limitQUICVersions: true,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -340,6 +375,7 @@ func TestWebTransportAPIRequests(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -362,6 +398,7 @@ func TestHotReload(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -384,6 +421,7 @@ func TestDefaultSponsorID(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -406,6 +444,7 @@ func TestDenyTrafficRules(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -428,6 +467,7 @@ func TestOmitAuthorization(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -450,6 +490,7 @@ func TestNoAuthorization(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -472,6 +513,7 @@ func TestUnusedAuthorization(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -494,6 +536,7 @@ func TestTCPOnlySLOK(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -516,6 +559,7 @@ func TestUDPOnlySLOK(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -538,6 +582,7 @@ func TestLivenessTest(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -560,6 +605,7 @@ func TestPruneServerEntries(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -582,6 +628,7 @@ func TestBurstMonitor(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: true,
|
|
|
doSplitTunnel: false,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -604,6 +651,7 @@ func TestSplitTunnel(t *testing.T) {
|
|
|
doPacketManipulation: false,
|
|
|
doBurstMonitor: false,
|
|
|
doSplitTunnel: true,
|
|
|
+ limitQUICVersions: false,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
@@ -625,6 +673,7 @@ type runServerConfig struct {
|
|
|
doPacketManipulation bool
|
|
|
doBurstMonitor bool
|
|
|
doSplitTunnel bool
|
|
|
+ limitQUICVersions bool
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
@@ -697,11 +746,19 @@ func runServer(t *testing.T, runConfig *runServerConfig) {
|
|
|
}
|
|
|
psiphonServerPort := 4000
|
|
|
|
|
|
+ var limitQUICVersions protocol.QUICVersions
|
|
|
+ if runConfig.limitQUICVersions {
|
|
|
+ selectedQUICVersion := protocol.SupportedQUICVersions[prng.Intn(
|
|
|
+ len(protocol.SupportedQUICVersions))]
|
|
|
+ limitQUICVersions = protocol.QUICVersions{selectedQUICVersion}
|
|
|
+ }
|
|
|
+
|
|
|
generateConfigParams := &GenerateConfigParams{
|
|
|
ServerIPAddress: psiphonServerIPAddress,
|
|
|
EnableSSHAPIRequests: runConfig.enableSSHAPIRequests,
|
|
|
WebServerPort: 8000,
|
|
|
TunnelProtocolPorts: map[string]int{runConfig.tunnelProtocol: psiphonServerPort},
|
|
|
+ LimitQUICVersions: limitQUICVersions,
|
|
|
}
|
|
|
|
|
|
if doServerTactics {
|
|
|
@@ -1310,6 +1367,10 @@ func runServer(t *testing.T, runConfig *runServerConfig) {
|
|
|
expectTCPDataTransfer := runConfig.doTunneledWebRequest && !expectTrafficFailure && !runConfig.doSplitTunnel
|
|
|
// Even with expectTrafficFailure, DNS port forwards will succeed
|
|
|
expectUDPDataTransfer := runConfig.doTunneledNTPRequest
|
|
|
+ expectQUICVersion := ""
|
|
|
+ if runConfig.limitQUICVersions {
|
|
|
+ expectQUICVersion = limitQUICVersions[0]
|
|
|
+ }
|
|
|
|
|
|
select {
|
|
|
case logFields := <-serverTunnelLog:
|
|
|
@@ -1322,6 +1383,7 @@ func runServer(t *testing.T, runConfig *runServerConfig) {
|
|
|
expectTCPPortForwardDial,
|
|
|
expectTCPDataTransfer,
|
|
|
expectUDPDataTransfer,
|
|
|
+ expectQUICVersion,
|
|
|
logFields)
|
|
|
if err != nil {
|
|
|
t.Fatalf("invalid server tunnel log fields: %s", err)
|
|
|
@@ -1382,6 +1444,7 @@ func checkExpectedServerTunnelLogFields(
|
|
|
expectTCPPortForwardDial bool,
|
|
|
expectTCPDataTransfer bool,
|
|
|
expectUDPDataTransfer bool,
|
|
|
+ expectQUICVersion string,
|
|
|
fields map[string]interface{}) error {
|
|
|
|
|
|
// Limitations:
|
|
|
@@ -1557,7 +1620,10 @@ func checkExpectedServerTunnelLogFields(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if !common.Contains(protocol.SupportedQUICVersions, fields["quic_version"].(string)) {
|
|
|
+ quicVersion := fields["quic_version"].(string)
|
|
|
+ if !common.Contains(protocol.SupportedQUICVersions, quicVersion) ||
|
|
|
+ (runConfig.limitQUICVersions && quicVersion != expectQUICVersion) {
|
|
|
+
|
|
|
return fmt.Errorf("unexpected quic_version '%s'", fields["quic_version"])
|
|
|
}
|
|
|
}
|