Skip to content

Commit d72bde2

Browse files
dknopikjakub-freebit
authored andcommitted
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 597612f commit d72bde2

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
@@ -189,8 +189,10 @@ func (n ExtIP) String() string { return fmt.Sprintf("ExtIP(%v)", ne
189189

190190
// These do nothing.
191191

192-
func (ExtIP) AddMapping(string, int, int, string, time.Duration) (uint16, error) { return 0, nil }
193-
func (ExtIP) DeleteMapping(string, int, int) error { return nil }
192+
func (ExtIP) AddMapping(protocol string, extport, intport int, name string, lifetime time.Duration) (uint16, error) {
193+
return uint16(extport), nil
194+
}
195+
func (ExtIP) DeleteMapping(string, int, int) error { return nil }
194196

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

0 commit comments

Comments
 (0)