nat: use a single Go routine to renew NAT mappings

This commit is contained in:
Marten Seemann
2023-04-03 22:27:04 +09:00
parent f5cbaf1721
commit c62be4081c
3 changed files with 107 additions and 95 deletions

View File

@@ -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
}