commit 59af9927a5383587eb20893a48b51e312bdbe896 Author: Shelikhoo xiaokangwang@outlook.com Date: Fri Nov 12 10:28:01 2021 +0000
Refactor state transfer logic to simplify it
Adopted the change in according to the recommendation from
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowf... --- proxy/lib/snowflake.go | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-)
diff --git a/proxy/lib/snowflake.go b/proxy/lib/snowflake.go index 4cf25ee..df6a256 100644 --- a/proxy/lib/snowflake.go +++ b/proxy/lib/snowflake.go @@ -646,32 +646,14 @@ func (sf *SnowflakeProxy) checkNATType(config webrtc.Configuration, probeURL str
currentNATTypeToStore := NATUnknown switch currentNATTypeLoaded + "->" + currentNATTypeTestResult { - case NATUnknown + "->" + NATUnknown: - currentNATTypeToStore = NATUnknown - - case NATUnknown + "->" + NATUnrestricted: - currentNATTypeToStore = NATUnrestricted - - case NATUnknown + "->" + NATRestricted: - currentNATTypeToStore = NATRestricted - case NATUnrestricted + "->" + NATUnknown: currentNATTypeToStore = NATUnrestricted
- case NATUnrestricted + "->" + NATUnrestricted: - currentNATTypeToStore = NATUnrestricted - - case NATUnrestricted + "->" + NATRestricted: - currentNATTypeToStore = NATRestricted - case NATRestricted + "->" + NATUnknown: currentNATTypeToStore = NATRestricted
- case NATRestricted + "->" + NATUnrestricted: - currentNATTypeToStore = NATUnrestricted - - case NATRestricted + "->" + NATRestricted: - currentNATTypeToStore = NATRestricted + default: + currentNATTypeToStore = currentNATTypeTestResult }
log.Printf("NAT Type measurement: %v -> %v = %v\n", currentNATTypeLoaded, currentNATTypeTestResult, currentNATTypeToStore)
tor-commits@lists.torproject.org