README
¶
go-ssdp
A library that implements the client side of SSDP (Simple Service Discovery Protocol).
Please see godoc.org for a detailed API description.
Usage
- Setup your go environment
go get github.com/bcurren/go-ssdp
- Write code using the library.
Get Device for devices on the network
package main
import (
"github.com/bcurren/go-ssdp"
"time"
"fmt"
)
func main() {
devices, err := ssdp.SearchForDevices("upnp:rootdevice", 3*time.Second)
if err != nil {
return
}
for _, device := range devices {
fmt.Println(device.ModelName)
}
}
Get Responses for Search on the network
package main
import (
"github.com/bcurren/go-ssdp"
"time"
"fmt"
)
func main() {
responses, err := ssdp.Search("upnp:rootdevice", 3*time.Second)
if err != nil {
return
}
for _, response := range responses {
// Do something with the response you discover
fmt.Println(response)
}
}
How to contribute
- Fork
- Write tests and code
- Run go fmt
- Submit a pull request
Documentation
¶
Overview ¶
SSDP (Simple Service Discovery Protocol) package provides an implementation of the SSDP specification.
Index ¶
Constants ¶
View Source
const ( // The port for SSDP discovery Port = 1900 // The IP for SSDP broadcast BroadcastIP = "239.255.255.250" )
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 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 ¶
Click to show internal directories.
Click to hide internal directories.