Skip to content

Commit

Permalink
p2p/nat: return correct port for ExtIP NAT (ethereum#30234)
Browse files Browse the repository at this point in the history
Return the actually requested external port instead of 0 in the
AddMapping implementation for `--nat extip:<IP>`.
  • Loading branch information
dknopik authored Jul 27, 2024
1 parent f94baab commit b0f66e3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions p2p/nat/nat.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ func (n ExtIP) String() string { return fmt.Sprintf("ExtIP(%v)", ne

// These do nothing.

func (ExtIP) AddMapping(string, int, int, string, time.Duration) (uint16, error) { return 0, nil }
func (ExtIP) DeleteMapping(string, int, int) error { return nil }
func (ExtIP) AddMapping(protocol string, extport, intport int, name string, lifetime time.Duration) (uint16, error) {
return uint16(extport), nil
}
func (ExtIP) DeleteMapping(string, int, int) error { return nil }

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

0 comments on commit b0f66e3

Please sign in to comment.