package ssdp

Import Path
	github.com/huin/goupnp/ssdp (on go.dev)

Dependency Relation
	imports 11 packages, and imported by one package

Involved Source Files registry.go ssdp.go
Package-Level Type Names (total 6)
/* sort by: | */
BootID int32 When the last update's cached values are advised to expire. ConfigID int32 Host string When the last update was received for this entry identified by this USN. Location of the UPnP root device description. Notfication Type. The type of device or service being announced. The address that the entry data was actually received from. SearchPort uint16 Server's self-identifying string. Unique Service Name. Identifies a unique instance of a device or service. func (*Registry).GetService(serviceURN string) []*Entry
( EventType) String() string EventType : expvar.Var EventType : fmt.Stringer const EventAlive const EventByeBye const EventUpdate
HTTPUClient is the interface required to perform HTTP-over-UDP requests. Do performs a request. The timeout is how long to wait for before returning the responses that were received. An error is only returned for failing to send the request. Failures in receipt simply do not add to the resulting responses. github.com/huin/goupnp/httpu.ClientInterface (interface) *github.com/huin/goupnp/httpu.HTTPUClient *github.com/huin/goupnp/httpu.MultiClient HTTPUClient : github.com/huin/goupnp/httpu.ClientInterface func SSDPRawSearch(httpu HTTPUClient, searchTarget string, maxWaitSeconds int, numSends int) ([]*http.Response, error) func SSDPRawSearchCtx(ctx context.Context, httpu HTTPUClient, searchTarget string, maxWaitSeconds int, numSends int) ([]*http.Response, error)
HTTPUClientCtx is an optional interface that will be used to perform HTTP-over-UDP requests if the client implements it. DoWithContext performs a request. If the input request has a deadline, then that value will be used as the timeout for how long to wait before returning the responses that were received. If the request's context is canceled, this method will return immediately. If the request's context is never canceled, and does not have a deadline, then this function WILL NEVER RETURN. You MUST set an appropriate deadline on the context, or otherwise cancel it when you want to finish an operation. An error is only returned for failing to send the request. Failures in receipt simply do not add to the resulting responses. github.com/huin/goupnp/httpu.ClientInterfaceCtx (interface) *github.com/huin/goupnp/httpu.HTTPUClient *github.com/huin/goupnp/httpu.MultiClientCtx HTTPUClientCtx : github.com/huin/goupnp/httpu.ClientInterfaceCtx func RawSearch(ctx context.Context, httpu HTTPUClientCtx, searchTarget string, numSends int) ([]*http.Response, error)
Registry maintains knowledge of discovered devices and services. NOTE: the interface for this is experimental and may change, or go away entirely. (*Registry) AddListener(c chan<- Update) GetService returns known service (or device) entries for the given service URN. (*Registry) RemoveListener(c chan<- Update) ServeMessage implements httpu.Handler, and uses SSDP NOTIFY requests to maintain the registry of devices and services. *Registry : github.com/huin/goupnp/httpu.Handler func NewRegistry() *Registry func NewServerAndRegistry() (*httpu.Server, *Registry)
The entry, which is nil if the service was not known and EventType==EventByeBye. The contents of this must not be modified as it is shared with the registry and other listeners. Once created, the Registry does not modify the Entry value - any updates are replaced with a new Entry value. What happened. The USN of the service. func (*Registry).AddListener(c chan<- Update) func (*Registry).RemoveListener(c chan<- Update)
Package-Level Functions (total 5)
NewServerAndRegistry is a convenience function to create a registry, and an httpu server to pass it messages. Call ListenAndServe on the server for messages to be processed.
RawSearch performs a fairly raw SSDP search request, and returns the unique response(s) that it receives. Each response has the requested searchTarget, a USN, and a valid location. If the provided context times out or is canceled, the search will be aborted. numSends is the number of requests to send - 3 is a reasonable value for this. The provided context should have a deadline, since the SSDP protocol requires the max wait time be included in search requests. If the context has no deadline, then a default deadline of 3 seconds will be applied.
SSDPRawSearch is the legacy version of SSDPRawSearchCtx, but uses context.Background() as the context.
SSDPRawSearchCtx performs a fairly raw SSDP search request, and returns the unique response(s) that it receives. Each response has the requested searchTarget, a USN, and a valid location. maxWaitSeconds states how long to wait for responses in seconds, and must be a minimum of 1 (the implementation waits an additional 100ms for responses to arrive), 2 is a reasonable value for this. numSends is the number of requests to send - 3 is a reasonable value for this.
Package-Level Constants (total 5)
SSDPAll is a value for searchTarget that searches for all devices and services.
UPNPRootDevice is a value for searchTarget that searches for all root devices.