mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Redefine only symmetric NATs as restricted
This commit is contained in:
parent
61beb9d996
commit
0bed9c48b7
1 changed files with 3 additions and 11 deletions
|
@ -16,10 +16,11 @@ package nat
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/pion/stun"
|
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/pion/stun"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ErrTimedOut = errors.New("timed out waiting for response")
|
var ErrTimedOut = errors.New("timed out waiting for response")
|
||||||
|
@ -36,16 +37,7 @@ const (
|
||||||
// and false if the NAT is unrestrictive (meaning it
|
// and false if the NAT is unrestrictive (meaning it
|
||||||
// will work with most other NATs),
|
// will work with most other NATs),
|
||||||
func CheckIfRestrictedNAT(server string) (bool, error) {
|
func CheckIfRestrictedNAT(server string) (bool, error) {
|
||||||
result, err := isRestrictedMapping(server)
|
return 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Performs two tests from RFC 5780 to determine whether the mapping type
|
// Performs two tests from RFC 5780 to determine whether the mapping type
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue