Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
3e620427
Commit
3e620427
authored
Nov 03, 2014
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix up NAT check and clear up naming
parent
05817373
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
net/conn/handshake.go
net/conn/handshake.go
+4
-4
No files found.
net/conn/handshake.go
View file @
3e620427
...
@@ -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
(
obs
erved
addr
string
)
(
bool
,
error
)
{
oma
,
err
:=
ma
.
NewMultiaddr
(
obsaddr
)
o
bserved
ma
,
err
:=
ma
.
NewMultiaddr
(
obs
erved
addr
)
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
:=
o
bserved
ma
.
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
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment