mirror of
https://github.com/libp2p/go-libp2p.git
synced 2025-11-03 00:44:20 +08:00
nat: use a single Go routine to renew NAT mappings
This commit is contained in:
@@ -24,9 +24,6 @@ type Mapping interface {
|
||||
// ExternalAddr returns the external facing address. If the mapping is not
|
||||
// established, addr will be nil, and and ErrNoMapping will be returned.
|
||||
ExternalAddr() (addr net.Addr, err error)
|
||||
|
||||
// Close closes the port mapping
|
||||
Close() error
|
||||
}
|
||||
|
||||
// keeps republishing
|
||||
@@ -103,8 +100,3 @@ func (m *mapping) ExternalAddr() (net.Addr, error) {
|
||||
panic(fmt.Sprintf("invalid protocol %q", m.Protocol()))
|
||||
}
|
||||
}
|
||||
|
||||
func (m *mapping) Close() error {
|
||||
m.nat.removeMapping(m)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user