Documentation
¶
Index ¶
- Constants
- Variables
- func AnnounceAlive(nt, usn, location, server string, maxAge int, localAddr string) error
- func AnnounceBye(nt, usn, localAddr string) error
- func SetMulticastRecvAddrIPv4(s string) error
- func SetMulticastSendAddrIPv4(s string) error
- type Advertiser
- type AliveHandler
- type AliveMessage
- type ByeHandler
- type ByeMessage
- type Monitor
- type SearchHandler
- type SearchMessage
- type Service
Constants ¶
const ( // All is a search type to search all services and devices. All = "ssdp:all" // RootDevice is a search type to search UPnP root devices. RootDevice = "upnp:rootdevice" )
Variables ¶
var Interfaces []net.Interface
Interfaces specify target interfaces to multicast. If no interfaces are specified, all interfaces will be used.
var Logger *log.Logger
Logger is default logger for SSDP module.
Functions ¶
func AnnounceAlive ¶
AnnounceAlive sends ssdp:alive message.
func AnnounceBye ¶
AnnounceBye sends ssdp:byebye message.
func SetMulticastRecvAddrIPv4 ¶
SetMulticastRecvAddrIPv4 updates multicast address where to receive packets.
func SetMulticastSendAddrIPv4 ¶
SetMulticastSendAddrIPv4 updates a UDP address to send multicast packets.
Types ¶
type Advertiser ¶
type Advertiser struct {
// contains filtered or unexported fields
}
Advertiser is a server to advertise a service.
type AliveMessage ¶
type AliveMessage struct {
// From is a sender of this message
From net.Addr
// Type is a property of "NT"
Type string
// USN is a property of "USN"
USN string
// Location is a property of "LOCATION"
Location string
// Server is a property of "SERVER"
Server string
// contains filtered or unexported fields
}
AliveMessage represents SSDP's ssdp:alive message.
func (*AliveMessage) Header ¶
func (m *AliveMessage) Header() http.Header
Header returns all properties in alive message.
func (*AliveMessage) MaxAge ¶
func (m *AliveMessage) MaxAge() int
MaxAge extracts "max-age" value from "CACHE-CONTROL" property.
type ByeMessage ¶
type ByeMessage struct {
// From is a sender of this message
From net.Addr
// Type is a property of "NT"
Type string
// USN is a property of "USN"
USN string
// contains filtered or unexported fields
}
ByeMessage represents SSDP's ssdp:byebye message.
func (*ByeMessage) Header ¶
func (m *ByeMessage) Header() http.Header
Header returns all properties in bye message.
type Monitor ¶
type Monitor struct {
Alive AliveHandler
Bye ByeHandler
Search SearchHandler
// contains filtered or unexported fields
}
Monitor monitors SSDP's alive and byebye messages.
type SearchHandler ¶
type SearchHandler func(*SearchMessage)
SearchHandler is handler of Search message.
type SearchMessage ¶
SearchMessage represents SSDP's ssdp:discover message.
func (*SearchMessage) Header ¶
func (s *SearchMessage) Header() http.Header
Header returns all properties in search message.
type Service ¶
type Service struct {
// Type is a property of "ST"
Type string
// USN is a property of "USN"
USN string
// Location is a property of "LOCATION"
Location string
// Server is a property of "SERVER"
Server string
// contains filtered or unexported fields
}
Service is discovered service.