ssdp

package
v0.0.0-...-381bc15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

SSDP (Simple Service Discovery Protocol) package provides an implementation of the SSDP specification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	SpecVersion      SpecVersion `xml:"specVersion"`
	URLBase          string      `xml:"URLBase"`
	DeviceType       string      `xml:"device>deviceType"`
	FriendlyName     string      `xml:"device>friendlyName"`
	Manufacturer     string      `xml:"device>manufacturer"`
	ManufacturerURL  string      `xml:"device>manufacturerURL"`
	ModelDescription string      `xml:"device>modelDescription"`
	ModelName        string      `xml:"device>modelName"`
	ModelNumber      string      `xml:"device>modelNumber"`
	ModelURL         string      `xml:"device>modelURL"`
	SerialNumber     string      `xml:"device>serialNumber"`
	UDN              string      `xml:"device>UDN"`
	UPC              string      `xml:"device>UPC"`
	PresentationURL  string      `xml:"device>presentationURL"`
	Icons            []Icon      `xml:"device>iconList>icon"`
}

type Icon

type Icon struct {
	MIMEType string `xml:"mimetype"`
	Width    int    `xml:"width"`
	Height   int    `xml:"height"`
	Depth    int    `xml:"depth"`
	URL      string `xml:"url"`
}

type OptionSSDP

type OptionSSDP interface {
	// contains filtered or unexported methods
}

func WithBroadcast

func WithBroadcast(broadcast string) OptionSSDP

func WithPort

func WithPort(port int) OptionSSDP

func WithTimeout

func WithTimeout(timeout int) OptionSSDP

type SSDP

type SSDP struct {
	// contains filtered or unexported fields
}

func NewSSDP

func NewSSDP(opts ...OptionSSDP) *SSDP

func (*SSDP) Search

func (ssdp *SSDP) Search(search string) ([]SearchResponse, error)

Search the network for SSDP devices using the given search string and duration to discover new devices. This function will return an array of SearchReponses discovered.

func (*SSDP) SearchDevices

func (ssdp *SSDP) SearchDevices(search string) ([]Device, error)

type SearchResponse

type SearchResponse struct {
	Control      string
	Server       string
	ST           string
	Ext          string
	USN          string
	Location     *url.URL
	Date         time.Time
	ResponseAddr *net.UDPAddr
}

The search response from a device implementing SSDP.

type SpecVersion

type SpecVersion struct {
	Major int `xml:"major"`
	Minor int `xml:"minor"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL