p2p/nat: return correct port for ExtIP NAT (#30234)

Return the actually requested external port instead of 0 in the
AddMapping implementation for `--nat extip:<IP>`.
pull/30241/head
dknopik 4 months ago committed by GitHub
parent f94baab238
commit b0f66e34ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      p2p/nat/nat.go

@ -138,8 +138,10 @@ func (n ExtIP) String() string { return fmt.Sprintf("ExtIP(%v)", ne
// These do nothing. // These do nothing.
func (ExtIP) AddMapping(string, int, int, string, time.Duration) (uint16, error) { return 0, nil } func (ExtIP) AddMapping(protocol string, extport, intport int, name string, lifetime time.Duration) (uint16, error) {
func (ExtIP) DeleteMapping(string, int, int) error { return nil } return uint16(extport), nil
}
func (ExtIP) DeleteMapping(string, int, int) error { return nil }
// Any returns a port mapper that tries to discover any supported // Any returns a port mapper that tries to discover any supported
// mechanism on the local network. // mechanism on the local network.

Loading…
Cancel
Save