Documentation
¶
Index ¶
Constants ¶
View Source
const ( // BroadcastRetryCount retry count BroadcastRetryCount = 3 // BroadcastWaitTimeSeconds wait time BroadcastWaitTimeSeconds = 3 // ServiceType service type ServiceType = "urn:schemas-upnp-org:service:WANIPConnection:1" )
Variables ¶
This section is empty.
Functions ¶
func GetLocalAddress ¶
GetLocalAddress get the address of the local machine
Types ¶
type Body ¶
type Body struct {
XMLName xml.Name `xml:"Body"`
GetGenericPortMappingEntryResponse GetGenericPortMappingEntryResponse `xml:"GetGenericPortMappingEntryResponse"`
}
Body is the soap body
type Gateway ¶
type Gateway struct {
GatewayName string
Host string
DeviceDescURL string
Cache string
ST string
ControlURL string
OutsideIP net.IP
}
Gateway the router
type GetGenericPortMappingEntryResponse ¶
type GetGenericPortMappingEntryResponse struct {
XMLName xml.Name `xml:"GetGenericPortMappingEntryResponse"`
NewRemoteHost string `xml:"NewRemoteHost"`
NewExternalPort int `xml:"NewExternalPort"`
NewProtocol string `xml:"NewProtocol"`
NewInternalPort int `xml:"NewInternalPort"`
NewInternalClient string `xml:"NewInternalClient"`
NewEnabled int `xml:"NewEnabled"`
NewPortMappingDescription string `xml:"NewPortMappingDescription"`
NewLeaseDuration int `xml:"NewLeaseDuration"`
}
GetGenericPortMappingEntryResponse is a port mapping
type Service ¶
type Service struct {
ServiceType string `xml:"serviceType"`
//ServiceId string `xml:"serviceId"`
//SCPDURL string `xml:"SCPDURL"`
ControlURL string `xml:"controlURL"`
}
Service device Description xml elements
type UPNP ¶
type UPNP struct {
Gateway *Gateway
}
UPNP the upnp service
func (*UPNP) AddPortMapping ¶
AddPortMapping to the WAN/Internet
func (*UPNP) DelPortMapping ¶
DelPortMapping delete a port mapping
func (*UPNP) ExternalIPAddress ¶
ExternalIPAddress get the ip address of the router
func (*UPNP) GetPortMappings ¶
GetPortMappings gets the port mappings
Click to show internal directories.
Click to hide internal directories.