[tor-commits] [snowflake/master] Redefine only symmetric NATs as restricted

cohosh at torproject.org cohosh at torproject.org
Fri Nov 20 16:09:52 UTC 2020


commit 0bed9c48b7a3f59c7141e9934a44e73e03096faf
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Wed Nov 18 15:40:32 2020 -0500

    Redefine only symmetric NATs as restricted
---
 common/nat/nat.go | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/common/nat/nat.go b/common/nat/nat.go
index c9f16ad..4f2780c 100644
--- a/common/nat/nat.go
+++ b/common/nat/nat.go
@@ -16,10 +16,11 @@ package nat
 import (
 	"errors"
 	"fmt"
-	"github.com/pion/stun"
 	"log"
 	"net"
 	"time"
+
+	"github.com/pion/stun"
 )
 
 var ErrTimedOut = errors.New("timed out waiting for response")
@@ -36,16 +37,7 @@ const (
 // and false if the NAT is unrestrictive (meaning it
 // will work with most other NATs),
 func CheckIfRestrictedNAT(server string) (bool, error) {
-	result, err := isRestrictedMapping(server)
-	if err != nil {
-		return false, err
-	}
-	if !result {
-		// if the mapping is unrestrictive, we still need to check whether
-		// the filtering is restrictive
-		result, err = isRestrictedFiltering(server)
-	}
-	return result, err
+	return isRestrictedMapping(server)
 }
 
 // Performs two tests from RFC 5780 to determine whether the mapping type





More information about the tor-commits mailing list