Commit 3e620427 authored by Jeromy's avatar Jeromy

fix up NAT check and clear up naming

parent 05817373
...@@ -127,8 +127,8 @@ func Handshake3(ctx context.Context, c Conn) error { ...@@ -127,8 +127,8 @@ func Handshake3(ctx context.Context, c Conn) error {
} }
// checkNAT returns whether or not we might be behind a NAT // checkNAT returns whether or not we might be behind a NAT
func checkNAT(obsaddr string) (bool, error) { func checkNAT(observedaddr string) (bool, error) {
oma, err := ma.NewMultiaddr(obsaddr) observedma, err := ma.NewMultiaddr(observedaddr)
if err != nil { if err != nil {
return false, err return false, err
} }
...@@ -137,9 +137,9 @@ func checkNAT(obsaddr string) (bool, error) { ...@@ -137,9 +137,9 @@ func checkNAT(obsaddr string) (bool, error) {
return false, err return false, err
} }
omastr := oma.String() omastr := observedma.String()
for _, addr := range addrs { for _, addr := range addrs {
if strings.HasPrefix(addr.String(), omastr) { if strings.HasPrefix(omastr, addr.String()) {
return false, nil return false, nil
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment