mirror of
https://github.com/calmh/go-ssdp.git
synced 2026-07-17 01:25:04 +00:00
A library that implements the client side of SSDP (Simple Service Discovery Protocol).
- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| test_responses | ||
| device.go | ||
| device_test.go | ||
| LICENSE | ||
| README.md | ||
| ssdp.go | ||
| ssdp_test.go | ||
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