Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
53d1ae09
Unverified
Commit
53d1ae09
authored
Nov 25, 2022
by
Seungbae Yu
Committed by
GitHub
Nov 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p/nat: use IP.IsPrivate (#26252)
parent
8c6e74ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
8 deletions
+1
-8
natpmp.go
p2p/nat/natpmp.go
+1
-8
No files found.
p2p/nat/natpmp.go
View file @
53d1ae09
...
...
@@ -95,13 +95,6 @@ func discoverPMP() Interface {
return
nil
}
var
(
// LAN IP ranges
_
,
lan10
,
_
=
net
.
ParseCIDR
(
"10.0.0.0/8"
)
_
,
lan176
,
_
=
net
.
ParseCIDR
(
"172.16.0.0/12"
)
_
,
lan192
,
_
=
net
.
ParseCIDR
(
"192.168.0.0/16"
)
)
// TODO: improve this. We currently assume that (on most networks)
// the router is X.X.X.1 in a local LAN range.
func
potentialGateways
()
(
gws
[]
net
.
IP
)
{
...
...
@@ -116,7 +109,7 @@ func potentialGateways() (gws []net.IP) {
}
for
_
,
addr
:=
range
ifaddrs
{
if
x
,
ok
:=
addr
.
(
*
net
.
IPNet
);
ok
{
if
lan10
.
Contains
(
x
.
IP
)
||
lan176
.
Contains
(
x
.
IP
)
||
lan192
.
Contains
(
x
.
IP
)
{
if
x
.
IP
.
IsPrivate
(
)
{
ip
:=
x
.
IP
.
Mask
(
x
.
Mask
)
.
To4
()
if
ip
!=
nil
{
ip
[
3
]
=
ip
[
3
]
|
0x01
...
...
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