Documentation ¶
Index ¶
- Variables
- func AddUpnpTcpPortMapping(igdServer string, externalPort int, internalIp string, internalPort int) (string, error)
- func DeleteUpnpTcpPortMapping(igdServer string, externalPort int) error
- func SSDPSearch(intf *net.Interface, deviceType string, destIP net.IP, timeout time.Duration) (<-chan *SSDPNotify, error)
- type Daemon
- type IGD
- type IGDService
- type PortMappingInfo
- type SSDPNotify
- type Store
- type UPnPRoot
- type UPnpDevice
- type UPnpService
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrLocalPortUsed = errors.New("local port used") ErrPortMappingNotFound = errors.New("port mapping not found") )
View Source
var (
SSDPMulticastAddr = []byte{239, 255, 255, 250}
)
Functions ¶
func AddUpnpTcpPortMapping ¶
Types ¶
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
func (*Daemon) AddPortMapping ¶
func (*Daemon) DeletePortMapping ¶
func (*Daemon) ListPortMapping ¶
func (p *Daemon) ListPortMapping() []*PortMappingInfo
type IGD ¶
type IGD struct { UUID string FriendlyName string DescriptionURL string Services []IGDService // contains filtered or unexported fields }
type IGDService ¶
func GetIGDServices ¶
func GetIGDServices(device *UPnpDevice, rootURL string) ([]IGDService, error)
func (*IGDService) AddPortMapping ¶
func (s *IGDService) AddPortMapping( protocol string, externalPort int, internalIP string, internalPort int, duration time.Duration, description string) error
AddPortMapping adds a port mapping to the specified IGD service.
func (*IGDService) DeletePortMapping ¶
func (s *IGDService) DeletePortMapping(protocol string, 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
type PortMappingInfo ¶
type SSDPNotify ¶
type SSDPNotify struct { DeviceUUID string `json:"uuid"` RespondingDeviceType string `json:"deviceType"` DeviceUSN string `json:"usn"` DeviceDescriptionLocation string `json:"location"` }
func ParseSSDPNotify ¶
func ParseSSDPNotify(deviceType string, data []byte) (*SSDPNotify, error)
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) AddPortMapping ¶
func (s *Store) AddPortMapping(pm *PortMappingInfo) error
func (*Store) CleanAndUpdate ¶
func (s *Store) CleanAndUpdate(pms []*PortMappingInfo) error
func (*Store) DeletePortMapping ¶
func (*Store) GetAllPortMapping ¶
func (s *Store) GetAllPortMapping() ([]*PortMappingInfo, error)
type UPnpDevice ¶
type UPnpDevice struct { DeviceType string `xml:"deviceType"` FriendlyName string `xml:"friendlyName"` UDN string `xml:"UDN"` Devices []UPnpDevice `xml:"deviceList>device"` Services []UPnpService `xml:"serviceList>service"` }
func (*UPnpDevice) GetChildDevices ¶
func (d *UPnpDevice) GetChildDevices(deviceType string) []UPnpDevice
func (*UPnpDevice) GetChildServices ¶
func (d *UPnpDevice) GetChildServices(serviceType string) []UPnpService
type UPnpService ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.