Skip to content

Latest commit

 

History

History
63 lines (50 loc) · 1.07 KB

README.md

File metadata and controls

63 lines (50 loc) · 1.07 KB

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

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