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>`.
This commit is contained in:
dknopik 2024-07-27 10:18:05 +02:00 committed by GitHub
parent f94baab238
commit b0f66e34ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -138,7 +138,9 @@ 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) {
return uint16(extport), nil
}
func (ExtIP) DeleteMapping(string, int, int) error { return 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