Seems that searching for a service also works.
This commit is contained in:
parent
33980ebacf
commit
61577bd15b
@ -36,7 +36,7 @@ func displayDevice(indent indentLevel, device *goupnp.Device) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if results, err := goupnp.DiscoverDevices(goupnp.DeviceTypeInternetGatewayDevice); err != nil {
|
if results, err := goupnp.DiscoverDevices(goupnp.ServiceTypeWANPPPConnection); err != nil {
|
||||||
fmt.Println("Error discovering InternetGatewayDevice with UPnP: ", err)
|
fmt.Println("Error discovering InternetGatewayDevice with UPnP: ", err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Discovered %d InternetGatewayDevices:\n", len(results))
|
fmt.Printf("Discovered %d InternetGatewayDevices:\n", len(results))
|
||||||
|
@ -40,9 +40,9 @@ type MaybeRootDevice struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DiscoverDevices attempts to find targets of the given type. searchTarget is
|
// DiscoverDevices attempts to find targets of the given type. searchTarget is
|
||||||
// typically a value from a DeviceType* constant. An error is returned for
|
// typically a value from a DeviceType* or ServiceType* constant. An error is
|
||||||
// errors while attempting to send the query. An error or RootDevice is
|
// returned for errors while attempting to send the query. An error or
|
||||||
// returned for each discovered service.
|
// RootDevice is returned for each discovered service.
|
||||||
func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) {
|
func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) {
|
||||||
httpu, err := NewHTTPUClient()
|
httpu, err := NewHTTPUClient()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user