Skip to content

Commit

Permalink
fix up NAT check and clear up naming
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Nov 3, 2014
1 parent 0581737 commit 3e62042
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/conn/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ func Handshake3(ctx context.Context, c Conn) error {
}

// checkNAT returns whether or not we might be behind a NAT
func checkNAT(obsaddr string) (bool, error) {
oma, err := ma.NewMultiaddr(obsaddr)
func checkNAT(observedaddr string) (bool, error) {
observedma, err := ma.NewMultiaddr(observedaddr)
if err != nil {
return false, err
}
Expand All @@ -137,9 +137,9 @@ func checkNAT(obsaddr string) (bool, error) {
return false, err
}

omastr := oma.String()
omastr := observedma.String()
for _, addr := range addrs {
if strings.HasPrefix(addr.String(), omastr) {
if strings.HasPrefix(omastr, addr.String()) {
return false, nil
}
}
Expand Down

0 comments on commit 3e62042

Please sign in to comment.