Skip to content

Commit b0f66e3

Browse files
authored
p2p/nat: return correct port for ExtIP NAT (ethereum#30234)
Return the actually requested external port instead of 0 in the AddMapping implementation for `--nat extip:<IP>`.
1 parent f94baab commit b0f66e3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

p2p/nat/nat.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ func (n ExtIP) String() string { return fmt.Sprintf("ExtIP(%v)", ne
138138

139139
// These do nothing.
140140

141-
func (ExtIP) AddMapping(string, int, int, string, time.Duration) (uint16, error) { return 0, nil }
142-
func (ExtIP) DeleteMapping(string, int, int) error { return nil }
141+
func (ExtIP) AddMapping(protocol string, extport, intport int, name string, lifetime time.Duration) (uint16, error) {
142+
return uint16(extport), nil
143+
}
144+
func (ExtIP) DeleteMapping(string, int, int) error { return nil }
143145

144146
// Any returns a port mapper that tries to discover any supported
145147
// mechanism on the local network.

0 commit comments

Comments
 (0)