Documentation ¶
Overview ¶
Package upnp implements UPnP InternetGatewayDevice discovery, querying, and port mapping.
Index ¶
- Variables
- func Register(provider DiscoverFunc)
- type Address
- type Device
- type DiscoverFunc
- type IGDService
- func (s *IGDService) AddPortMapping(protocol Protocol, internalPort, externalPort int, description string, ...) (int, error)
- func (s *IGDService) DeletePortMapping(protocol Protocol, externalPort int) error
- func (s *IGDService) GetExternalIPAddress() (net.IP, error)
- func (s *IGDService) GetLocalIPAddress() net.IP
- func (s *IGDService) ID() string
- type Mapping
- type MappingChangeSubscriber
- type Protocol
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Debug Set this to true to print debug information Debug = true )
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 IGDService ¶
type IGDService struct { UUID string Device upnpDevice ServiceID string URL string URN string LocalIP net.IP // contains filtered or unexported fields }
An IGDService is a specific service provided by an IGD.
func (*IGDService) AddPortMapping ¶
func (s *IGDService) AddPortMapping(protocol Protocol, internalPort, externalPort int, description string, duration time.Duration) (int, error)
AddPortMapping adds a port mapping to the specified IGD service.
func (*IGDService) DeletePortMapping ¶
func (s *IGDService) DeletePortMapping(protocol Protocol, externalPort int) error
DeletePortMapping deletes a port mapping from the specified IGD service.
func (*IGDService) GetExternalIPAddress ¶
func (s *IGDService) GetExternalIPAddress() (net.IP, error)
GetExternalIPAddress queries the IGD service for its external IP address. Returns nil if the external IP address is invalid or undefined, along with any relevant errors
func (*IGDService) GetLocalIPAddress ¶
func (s *IGDService) GetLocalIPAddress() net.IP
GetLocalIPAddress returns local IP address used to contact this service
type Mapping ¶
type Mapping struct {
// contains filtered or unexported fields
}
func (*Mapping) ExternalAddresses ¶
func (*Mapping) OnChanged ¶
func (m *Mapping) OnChanged(subscribed MappingChangeSubscriber)
type MappingChangeSubscriber ¶
Click to show internal directories.
Click to hide internal directories.