Documentation ¶
Index ¶
- Constants
- func Register(provider DiscoverFunc)
- type Address
- type Device
- type DiscoverFunc
- type IPVersion
- type Mapping
- type MappingChangeSubscriber
- type Protocol
- type Service
- func (s *Service) CommitConfiguration(_, to config.Configuration) bool
- func (s *Service) NewMapping(protocol Protocol, ipVersion IPVersion, ip net.IP, port int) *Mapping
- func (s *Service) RemoveMapping(mapping *Mapping)
- func (s *Service) Serve(ctx context.Context) error
- func (s *Service) String() string
Constants ¶
View Source
const ( IPvAny = iota IPv4Only IPv6Only )
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(provider DiscoverFunc)
Types ¶
type Address ¶
Address is essentially net.TCPAddr yet is more general, and has a few helper methods which reduce boilerplate code.
type Device ¶
type Device interface { ID() string GetLocalIPv4Address() net.IP AddPortMapping(ctx context.Context, protocol Protocol, internalPort, externalPort int, description string, duration time.Duration) (int, error) AddPinhole(ctx context.Context, protocol Protocol, addr Address, duration time.Duration) ([]net.IP, error) GetExternalIPv4Address(ctx context.Context) (net.IP, error) SupportsIPVersion(version IPVersion) bool }
type DiscoverFunc ¶
type Mapping ¶
type Mapping struct {
// contains filtered or unexported fields
}
func (*Mapping) ExternalAddresses ¶
func (*Mapping) OnChanged ¶
func (m *Mapping) OnChanged(subscribed MappingChangeSubscriber)
type MappingChangeSubscriber ¶
type MappingChangeSubscriber func()
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service runs a loop for discovery of IGDs (Internet Gateway Devices) and setup/renewal of a port mapping.
func (*Service) CommitConfiguration ¶ added in v1.7.0
func (s *Service) CommitConfiguration(_, to config.Configuration) bool
func (*Service) NewMapping ¶
func (*Service) RemoveMapping ¶
RemoveMapping does not actually remove the mapping from the IGD, it just internally removes it which stops renewing the mapping. Also, it clears any existing mapped addresses from the mapping, which as a result should cause discovery to reannounce the new addresses.
Click to show internal directories.
Click to hide internal directories.