More functions support Context

This commit is contained in:
hzy 2022-10-01 11:49:02 +00:00 committed by Huin
parent 9723a59812
commit d8bd5d2d52
9 changed files with 860 additions and 289 deletions

View File

@ -47,35 +47,47 @@ type AVTransport1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewAVTransport1Clients discovers instances of the service on the network, // NewAVTransport1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewAVTransport1Clients() (clients []*AVTransport1, errors []error, err error) { func NewAVTransport1ClientsCtx(ctx context.Context) (clients []*AVTransport1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_AVTransport_1); err != nil {
return return
} }
clients = newAVTransport1ClientsFromGenericClients(genericClients) clients = newAVTransport1ClientsFromGenericClients(genericClients)
return return
} }
// NewAVTransport1ClientsByURL discovers instances of the service at the given // NewAVTransport1Clients is the legacy version of NewAVTransport1ClientsCtx, but uses
// context.Background() as the context.
func NewAVTransport1Clients() (clients []*AVTransport1, errors []error, err error) {
return NewAVTransport1ClientsCtx(context.Background())
}
// NewAVTransport1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewAVTransport1ClientsByURL(loc *url.URL) ([]*AVTransport1, error) { func NewAVTransport1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*AVTransport1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_AVTransport_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newAVTransport1ClientsFromGenericClients(genericClients), nil return newAVTransport1ClientsFromGenericClients(genericClients), nil
} }
// NewAVTransport1ClientsByURL is the legacy version of NewAVTransport1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewAVTransport1ClientsByURL(loc *url.URL) ([]*AVTransport1, error) {
return NewAVTransport1ClientsByURLCtx(context.Background(), loc)
}
// NewAVTransport1ClientsFromRootDevice discovers instances of the service in // NewAVTransport1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -935,35 +947,47 @@ type AVTransport2 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewAVTransport2Clients discovers instances of the service on the network, // NewAVTransport2ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewAVTransport2Clients() (clients []*AVTransport2, errors []error, err error) { func NewAVTransport2ClientsCtx(ctx context.Context) (clients []*AVTransport2, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_AVTransport_2); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_AVTransport_2); err != nil {
return return
} }
clients = newAVTransport2ClientsFromGenericClients(genericClients) clients = newAVTransport2ClientsFromGenericClients(genericClients)
return return
} }
// NewAVTransport2ClientsByURL discovers instances of the service at the given // NewAVTransport2Clients is the legacy version of NewAVTransport2ClientsCtx, but uses
// context.Background() as the context.
func NewAVTransport2Clients() (clients []*AVTransport2, errors []error, err error) {
return NewAVTransport2ClientsCtx(context.Background())
}
// NewAVTransport2ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewAVTransport2ClientsByURL(loc *url.URL) ([]*AVTransport2, error) { func NewAVTransport2ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*AVTransport2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_AVTransport_2) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_AVTransport_2)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newAVTransport2ClientsFromGenericClients(genericClients), nil return newAVTransport2ClientsFromGenericClients(genericClients), nil
} }
// NewAVTransport2ClientsByURL is the legacy version of NewAVTransport2ClientsByURLCtx, but uses
// context.Background() as the context.
func NewAVTransport2ClientsByURL(loc *url.URL) ([]*AVTransport2, error) {
return NewAVTransport2ClientsByURLCtx(context.Background(), loc)
}
// NewAVTransport2ClientsFromRootDevice discovers instances of the service in // NewAVTransport2ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2067,35 +2091,47 @@ type ConnectionManager1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewConnectionManager1Clients discovers instances of the service on the network, // NewConnectionManager1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewConnectionManager1Clients() (clients []*ConnectionManager1, errors []error, err error) { func NewConnectionManager1ClientsCtx(ctx context.Context) (clients []*ConnectionManager1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_ConnectionManager_1); err != nil {
return return
} }
clients = newConnectionManager1ClientsFromGenericClients(genericClients) clients = newConnectionManager1ClientsFromGenericClients(genericClients)
return return
} }
// NewConnectionManager1ClientsByURL discovers instances of the service at the given // NewConnectionManager1Clients is the legacy version of NewConnectionManager1ClientsCtx, but uses
// context.Background() as the context.
func NewConnectionManager1Clients() (clients []*ConnectionManager1, errors []error, err error) {
return NewConnectionManager1ClientsCtx(context.Background())
}
// NewConnectionManager1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewConnectionManager1ClientsByURL(loc *url.URL) ([]*ConnectionManager1, error) { func NewConnectionManager1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*ConnectionManager1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_ConnectionManager_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newConnectionManager1ClientsFromGenericClients(genericClients), nil return newConnectionManager1ClientsFromGenericClients(genericClients), nil
} }
// NewConnectionManager1ClientsByURL is the legacy version of NewConnectionManager1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewConnectionManager1ClientsByURL(loc *url.URL) ([]*ConnectionManager1, error) {
return NewConnectionManager1ClientsByURLCtx(context.Background(), loc)
}
// NewConnectionManager1ClientsFromRootDevice discovers instances of the service in // NewConnectionManager1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2381,35 +2417,47 @@ type ConnectionManager2 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewConnectionManager2Clients discovers instances of the service on the network, // NewConnectionManager2ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewConnectionManager2Clients() (clients []*ConnectionManager2, errors []error, err error) { func NewConnectionManager2ClientsCtx(ctx context.Context) (clients []*ConnectionManager2, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ConnectionManager_2); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_ConnectionManager_2); err != nil {
return return
} }
clients = newConnectionManager2ClientsFromGenericClients(genericClients) clients = newConnectionManager2ClientsFromGenericClients(genericClients)
return return
} }
// NewConnectionManager2ClientsByURL discovers instances of the service at the given // NewConnectionManager2Clients is the legacy version of NewConnectionManager2ClientsCtx, but uses
// context.Background() as the context.
func NewConnectionManager2Clients() (clients []*ConnectionManager2, errors []error, err error) {
return NewConnectionManager2ClientsCtx(context.Background())
}
// NewConnectionManager2ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewConnectionManager2ClientsByURL(loc *url.URL) ([]*ConnectionManager2, error) { func NewConnectionManager2ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*ConnectionManager2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ConnectionManager_2) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_ConnectionManager_2)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newConnectionManager2ClientsFromGenericClients(genericClients), nil return newConnectionManager2ClientsFromGenericClients(genericClients), nil
} }
// NewConnectionManager2ClientsByURL is the legacy version of NewConnectionManager2ClientsByURLCtx, but uses
// context.Background() as the context.
func NewConnectionManager2ClientsByURL(loc *url.URL) ([]*ConnectionManager2, error) {
return NewConnectionManager2ClientsByURLCtx(context.Background(), loc)
}
// NewConnectionManager2ClientsFromRootDevice discovers instances of the service in // NewConnectionManager2ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2695,35 +2743,47 @@ type ContentDirectory1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewContentDirectory1Clients discovers instances of the service on the network, // NewContentDirectory1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewContentDirectory1Clients() (clients []*ContentDirectory1, errors []error, err error) { func NewContentDirectory1ClientsCtx(ctx context.Context) (clients []*ContentDirectory1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_ContentDirectory_1); err != nil {
return return
} }
clients = newContentDirectory1ClientsFromGenericClients(genericClients) clients = newContentDirectory1ClientsFromGenericClients(genericClients)
return return
} }
// NewContentDirectory1ClientsByURL discovers instances of the service at the given // NewContentDirectory1Clients is the legacy version of NewContentDirectory1ClientsCtx, but uses
// context.Background() as the context.
func NewContentDirectory1Clients() (clients []*ContentDirectory1, errors []error, err error) {
return NewContentDirectory1ClientsCtx(context.Background())
}
// NewContentDirectory1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewContentDirectory1ClientsByURL(loc *url.URL) ([]*ContentDirectory1, error) { func NewContentDirectory1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*ContentDirectory1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_ContentDirectory_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newContentDirectory1ClientsFromGenericClients(genericClients), nil return newContentDirectory1ClientsFromGenericClients(genericClients), nil
} }
// NewContentDirectory1ClientsByURL is the legacy version of NewContentDirectory1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewContentDirectory1ClientsByURL(loc *url.URL) ([]*ContentDirectory1, error) {
return NewContentDirectory1ClientsByURLCtx(context.Background(), loc)
}
// NewContentDirectory1ClientsFromRootDevice discovers instances of the service in // NewContentDirectory1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -3440,35 +3500,47 @@ type ContentDirectory2 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewContentDirectory2Clients discovers instances of the service on the network, // NewContentDirectory2ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewContentDirectory2Clients() (clients []*ContentDirectory2, errors []error, err error) { func NewContentDirectory2ClientsCtx(ctx context.Context) (clients []*ContentDirectory2, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_2); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_ContentDirectory_2); err != nil {
return return
} }
clients = newContentDirectory2ClientsFromGenericClients(genericClients) clients = newContentDirectory2ClientsFromGenericClients(genericClients)
return return
} }
// NewContentDirectory2ClientsByURL discovers instances of the service at the given // NewContentDirectory2Clients is the legacy version of NewContentDirectory2ClientsCtx, but uses
// context.Background() as the context.
func NewContentDirectory2Clients() (clients []*ContentDirectory2, errors []error, err error) {
return NewContentDirectory2ClientsCtx(context.Background())
}
// NewContentDirectory2ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewContentDirectory2ClientsByURL(loc *url.URL) ([]*ContentDirectory2, error) { func NewContentDirectory2ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*ContentDirectory2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_2) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_ContentDirectory_2)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newContentDirectory2ClientsFromGenericClients(genericClients), nil return newContentDirectory2ClientsFromGenericClients(genericClients), nil
} }
// NewContentDirectory2ClientsByURL is the legacy version of NewContentDirectory2ClientsByURLCtx, but uses
// context.Background() as the context.
func NewContentDirectory2ClientsByURL(loc *url.URL) ([]*ContentDirectory2, error) {
return NewContentDirectory2ClientsByURLCtx(context.Background(), loc)
}
// NewContentDirectory2ClientsFromRootDevice discovers instances of the service in // NewContentDirectory2ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -4301,35 +4373,47 @@ type ContentDirectory3 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewContentDirectory3Clients discovers instances of the service on the network, // NewContentDirectory3ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewContentDirectory3Clients() (clients []*ContentDirectory3, errors []error, err error) { func NewContentDirectory3ClientsCtx(ctx context.Context) (clients []*ContentDirectory3, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ContentDirectory_3); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_ContentDirectory_3); err != nil {
return return
} }
clients = newContentDirectory3ClientsFromGenericClients(genericClients) clients = newContentDirectory3ClientsFromGenericClients(genericClients)
return return
} }
// NewContentDirectory3ClientsByURL discovers instances of the service at the given // NewContentDirectory3Clients is the legacy version of NewContentDirectory3ClientsCtx, but uses
// context.Background() as the context.
func NewContentDirectory3Clients() (clients []*ContentDirectory3, errors []error, err error) {
return NewContentDirectory3ClientsCtx(context.Background())
}
// NewContentDirectory3ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewContentDirectory3ClientsByURL(loc *url.URL) ([]*ContentDirectory3, error) { func NewContentDirectory3ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*ContentDirectory3, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ContentDirectory_3) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_ContentDirectory_3)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newContentDirectory3ClientsFromGenericClients(genericClients), nil return newContentDirectory3ClientsFromGenericClients(genericClients), nil
} }
// NewContentDirectory3ClientsByURL is the legacy version of NewContentDirectory3ClientsByURLCtx, but uses
// context.Background() as the context.
func NewContentDirectory3ClientsByURL(loc *url.URL) ([]*ContentDirectory3, error) {
return NewContentDirectory3ClientsByURLCtx(context.Background(), loc)
}
// NewContentDirectory3ClientsFromRootDevice discovers instances of the service in // NewContentDirectory3ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -5288,35 +5372,47 @@ type RenderingControl1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewRenderingControl1Clients discovers instances of the service on the network, // NewRenderingControl1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewRenderingControl1Clients() (clients []*RenderingControl1, errors []error, err error) { func NewRenderingControl1ClientsCtx(ctx context.Context) (clients []*RenderingControl1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_RenderingControl_1); err != nil {
return return
} }
clients = newRenderingControl1ClientsFromGenericClients(genericClients) clients = newRenderingControl1ClientsFromGenericClients(genericClients)
return return
} }
// NewRenderingControl1ClientsByURL discovers instances of the service at the given // NewRenderingControl1Clients is the legacy version of NewRenderingControl1ClientsCtx, but uses
// context.Background() as the context.
func NewRenderingControl1Clients() (clients []*RenderingControl1, errors []error, err error) {
return NewRenderingControl1ClientsCtx(context.Background())
}
// NewRenderingControl1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewRenderingControl1ClientsByURL(loc *url.URL) ([]*RenderingControl1, error) { func NewRenderingControl1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*RenderingControl1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_RenderingControl_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newRenderingControl1ClientsFromGenericClients(genericClients), nil return newRenderingControl1ClientsFromGenericClients(genericClients), nil
} }
// NewRenderingControl1ClientsByURL is the legacy version of NewRenderingControl1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewRenderingControl1ClientsByURL(loc *url.URL) ([]*RenderingControl1, error) {
return NewRenderingControl1ClientsByURLCtx(context.Background(), loc)
}
// NewRenderingControl1ClientsFromRootDevice discovers instances of the service in // NewRenderingControl1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -7048,35 +7144,47 @@ type RenderingControl2 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewRenderingControl2Clients discovers instances of the service on the network, // NewRenderingControl2ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewRenderingControl2Clients() (clients []*RenderingControl2, errors []error, err error) { func NewRenderingControl2ClientsCtx(ctx context.Context) (clients []*RenderingControl2, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_RenderingControl_2); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_RenderingControl_2); err != nil {
return return
} }
clients = newRenderingControl2ClientsFromGenericClients(genericClients) clients = newRenderingControl2ClientsFromGenericClients(genericClients)
return return
} }
// NewRenderingControl2ClientsByURL discovers instances of the service at the given // NewRenderingControl2Clients is the legacy version of NewRenderingControl2ClientsCtx, but uses
// context.Background() as the context.
func NewRenderingControl2Clients() (clients []*RenderingControl2, errors []error, err error) {
return NewRenderingControl2ClientsCtx(context.Background())
}
// NewRenderingControl2ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewRenderingControl2ClientsByURL(loc *url.URL) ([]*RenderingControl2, error) { func NewRenderingControl2ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*RenderingControl2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_RenderingControl_2) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_RenderingControl_2)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newRenderingControl2ClientsFromGenericClients(genericClients), nil return newRenderingControl2ClientsFromGenericClients(genericClients), nil
} }
// NewRenderingControl2ClientsByURL is the legacy version of NewRenderingControl2ClientsByURLCtx, but uses
// context.Background() as the context.
func NewRenderingControl2ClientsByURL(loc *url.URL) ([]*RenderingControl2, error) {
return NewRenderingControl2ClientsByURLCtx(context.Background(), loc)
}
// NewRenderingControl2ClientsFromRootDevice discovers instances of the service in // NewRenderingControl2ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -8931,35 +9039,47 @@ type ScheduledRecording1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewScheduledRecording1Clients discovers instances of the service on the network, // NewScheduledRecording1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewScheduledRecording1Clients() (clients []*ScheduledRecording1, errors []error, err error) { func NewScheduledRecording1ClientsCtx(ctx context.Context) (clients []*ScheduledRecording1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_ScheduledRecording_1); err != nil {
return return
} }
clients = newScheduledRecording1ClientsFromGenericClients(genericClients) clients = newScheduledRecording1ClientsFromGenericClients(genericClients)
return return
} }
// NewScheduledRecording1ClientsByURL discovers instances of the service at the given // NewScheduledRecording1Clients is the legacy version of NewScheduledRecording1ClientsCtx, but uses
// context.Background() as the context.
func NewScheduledRecording1Clients() (clients []*ScheduledRecording1, errors []error, err error) {
return NewScheduledRecording1ClientsCtx(context.Background())
}
// NewScheduledRecording1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewScheduledRecording1ClientsByURL(loc *url.URL) ([]*ScheduledRecording1, error) { func NewScheduledRecording1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*ScheduledRecording1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_ScheduledRecording_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newScheduledRecording1ClientsFromGenericClients(genericClients), nil return newScheduledRecording1ClientsFromGenericClients(genericClients), nil
} }
// NewScheduledRecording1ClientsByURL is the legacy version of NewScheduledRecording1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewScheduledRecording1ClientsByURL(loc *url.URL) ([]*ScheduledRecording1, error) {
return NewScheduledRecording1ClientsByURLCtx(context.Background(), loc)
}
// NewScheduledRecording1ClientsFromRootDevice discovers instances of the service in // NewScheduledRecording1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -9818,35 +9938,47 @@ type ScheduledRecording2 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewScheduledRecording2Clients discovers instances of the service on the network, // NewScheduledRecording2ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewScheduledRecording2Clients() (clients []*ScheduledRecording2, errors []error, err error) { func NewScheduledRecording2ClientsCtx(ctx context.Context) (clients []*ScheduledRecording2, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_ScheduledRecording_2); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_ScheduledRecording_2); err != nil {
return return
} }
clients = newScheduledRecording2ClientsFromGenericClients(genericClients) clients = newScheduledRecording2ClientsFromGenericClients(genericClients)
return return
} }
// NewScheduledRecording2ClientsByURL discovers instances of the service at the given // NewScheduledRecording2Clients is the legacy version of NewScheduledRecording2ClientsCtx, but uses
// context.Background() as the context.
func NewScheduledRecording2Clients() (clients []*ScheduledRecording2, errors []error, err error) {
return NewScheduledRecording2ClientsCtx(context.Background())
}
// NewScheduledRecording2ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewScheduledRecording2ClientsByURL(loc *url.URL) ([]*ScheduledRecording2, error) { func NewScheduledRecording2ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*ScheduledRecording2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_ScheduledRecording_2) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_ScheduledRecording_2)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newScheduledRecording2ClientsFromGenericClients(genericClients), nil return newScheduledRecording2ClientsFromGenericClients(genericClients), nil
} }
// NewScheduledRecording2ClientsByURL is the legacy version of NewScheduledRecording2ClientsByURLCtx, but uses
// context.Background() as the context.
func NewScheduledRecording2ClientsByURL(loc *url.URL) ([]*ScheduledRecording2, error) {
return NewScheduledRecording2ClientsByURLCtx(context.Background(), loc)
}
// NewScheduledRecording2ClientsFromRootDevice discovers instances of the service in // NewScheduledRecording2ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the

View File

@ -44,35 +44,47 @@ type {{$srvIdent}} struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// New{{$srvIdent}}Clients discovers instances of the service on the network, // New{{$srvIdent}}ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func New{{$srvIdent}}Clients() (clients []*{{$srvIdent}}, errors []error, err error) { func New{{$srvIdent}}ClientsCtx(ctx context.Context) (clients []*{{$srvIdent}}, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients({{$srv.Const}}); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, {{$srv.Const}}); err != nil {
return return
} }
clients = new{{$srvIdent}}ClientsFromGenericClients(genericClients) clients = new{{$srvIdent}}ClientsFromGenericClients(genericClients)
return return
} }
// New{{$srvIdent}}ClientsByURL discovers instances of the service at the given // New{{$srvIdent}}Clients is the legacy version of New{{$srvIdent}}ClientsCtx, but uses
// context.Background() as the context.
func New{{$srvIdent}}Clients() (clients []*{{$srvIdent}}, errors []error, err error) {
return New{{$srvIdent}}ClientsCtx(context.Background())
}
// New{{$srvIdent}}ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func New{{$srvIdent}}ClientsByURL(loc *url.URL) ([]*{{$srvIdent}}, error) { func New{{$srvIdent}}ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*{{$srvIdent}}, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, {{$srv.Const}}) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, {{$srv.Const}})
if err != nil { if err != nil {
return nil, err return nil, err
} }
return new{{$srvIdent}}ClientsFromGenericClients(genericClients), nil return new{{$srvIdent}}ClientsFromGenericClients(genericClients), nil
} }
// New{{$srvIdent}}ClientsByURL is the legacy version of New{{$srvIdent}}ClientsByURLCtx, but uses
// context.Background() as the context.
func New{{$srvIdent}}ClientsByURL(loc *url.URL) ([]*{{$srvIdent}}, error) {
return New{{$srvIdent}}ClientsByURLCtx(context.Background(), loc)
}
// New{{$srvIdent}}ClientsFromRootDevice discovers instances of the service in // New{{$srvIdent}}ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the

View File

@ -49,35 +49,47 @@ type LANHostConfigManagement1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewLANHostConfigManagement1Clients discovers instances of the service on the network, // NewLANHostConfigManagement1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewLANHostConfigManagement1Clients() (clients []*LANHostConfigManagement1, errors []error, err error) { func NewLANHostConfigManagement1ClientsCtx(ctx context.Context) (clients []*LANHostConfigManagement1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_LANHostConfigManagement_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_LANHostConfigManagement_1); err != nil {
return return
} }
clients = newLANHostConfigManagement1ClientsFromGenericClients(genericClients) clients = newLANHostConfigManagement1ClientsFromGenericClients(genericClients)
return return
} }
// NewLANHostConfigManagement1ClientsByURL discovers instances of the service at the given // NewLANHostConfigManagement1Clients is the legacy version of NewLANHostConfigManagement1ClientsCtx, but uses
// context.Background() as the context.
func NewLANHostConfigManagement1Clients() (clients []*LANHostConfigManagement1, errors []error, err error) {
return NewLANHostConfigManagement1ClientsCtx(context.Background())
}
// NewLANHostConfigManagement1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewLANHostConfigManagement1ClientsByURL(loc *url.URL) ([]*LANHostConfigManagement1, error) { func NewLANHostConfigManagement1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*LANHostConfigManagement1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_LANHostConfigManagement_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_LANHostConfigManagement_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil
} }
// NewLANHostConfigManagement1ClientsByURL is the legacy version of NewLANHostConfigManagement1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewLANHostConfigManagement1ClientsByURL(loc *url.URL) ([]*LANHostConfigManagement1, error) {
return NewLANHostConfigManagement1ClientsByURLCtx(context.Background(), loc)
}
// NewLANHostConfigManagement1ClientsFromRootDevice discovers instances of the service in // NewLANHostConfigManagement1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -798,35 +810,47 @@ type Layer3Forwarding1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewLayer3Forwarding1Clients discovers instances of the service on the network, // NewLayer3Forwarding1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewLayer3Forwarding1Clients() (clients []*Layer3Forwarding1, errors []error, err error) { func NewLayer3Forwarding1ClientsCtx(ctx context.Context) (clients []*Layer3Forwarding1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_Layer3Forwarding_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_Layer3Forwarding_1); err != nil {
return return
} }
clients = newLayer3Forwarding1ClientsFromGenericClients(genericClients) clients = newLayer3Forwarding1ClientsFromGenericClients(genericClients)
return return
} }
// NewLayer3Forwarding1ClientsByURL discovers instances of the service at the given // NewLayer3Forwarding1Clients is the legacy version of NewLayer3Forwarding1ClientsCtx, but uses
// context.Background() as the context.
func NewLayer3Forwarding1Clients() (clients []*Layer3Forwarding1, errors []error, err error) {
return NewLayer3Forwarding1ClientsCtx(context.Background())
}
// NewLayer3Forwarding1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewLayer3Forwarding1ClientsByURL(loc *url.URL) ([]*Layer3Forwarding1, error) { func NewLayer3Forwarding1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*Layer3Forwarding1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_Layer3Forwarding_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_Layer3Forwarding_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil
} }
// NewLayer3Forwarding1ClientsByURL is the legacy version of NewLayer3Forwarding1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewLayer3Forwarding1ClientsByURL(loc *url.URL) ([]*Layer3Forwarding1, error) {
return NewLayer3Forwarding1ClientsByURLCtx(context.Background(), loc)
}
// NewLayer3Forwarding1ClientsFromRootDevice discovers instances of the service in // NewLayer3Forwarding1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -929,35 +953,47 @@ type WANCableLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANCableLinkConfig1Clients discovers instances of the service on the network, // NewWANCableLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANCableLinkConfig1Clients() (clients []*WANCableLinkConfig1, errors []error, err error) { func NewWANCableLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANCableLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCableLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANCableLinkConfig_1); err != nil {
return return
} }
clients = newWANCableLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANCableLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANCableLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANCableLinkConfig1Clients is the legacy version of NewWANCableLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANCableLinkConfig1Clients() (clients []*WANCableLinkConfig1, errors []error, err error) {
return NewWANCableLinkConfig1ClientsCtx(context.Background())
}
// NewWANCableLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANCableLinkConfig1ClientsByURL(loc *url.URL) ([]*WANCableLinkConfig1, error) { func NewWANCableLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANCableLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCableLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANCableLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANCableLinkConfig1ClientsByURL is the legacy version of NewWANCableLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANCableLinkConfig1ClientsByURL(loc *url.URL) ([]*WANCableLinkConfig1, error) {
return NewWANCableLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANCableLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANCableLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -1347,35 +1383,47 @@ type WANCommonInterfaceConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANCommonInterfaceConfig1Clients discovers instances of the service on the network, // NewWANCommonInterfaceConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANCommonInterfaceConfig1Clients() (clients []*WANCommonInterfaceConfig1, errors []error, err error) { func NewWANCommonInterfaceConfig1ClientsCtx(ctx context.Context) (clients []*WANCommonInterfaceConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCommonInterfaceConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANCommonInterfaceConfig_1); err != nil {
return return
} }
clients = newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients) clients = newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANCommonInterfaceConfig1ClientsByURL discovers instances of the service at the given // NewWANCommonInterfaceConfig1Clients is the legacy version of NewWANCommonInterfaceConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANCommonInterfaceConfig1Clients() (clients []*WANCommonInterfaceConfig1, errors []error, err error) {
return NewWANCommonInterfaceConfig1ClientsCtx(context.Background())
}
// NewWANCommonInterfaceConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANCommonInterfaceConfig1ClientsByURL(loc *url.URL) ([]*WANCommonInterfaceConfig1, error) { func NewWANCommonInterfaceConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANCommonInterfaceConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCommonInterfaceConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANCommonInterfaceConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANCommonInterfaceConfig1ClientsByURL is the legacy version of NewWANCommonInterfaceConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANCommonInterfaceConfig1ClientsByURL(loc *url.URL) ([]*WANCommonInterfaceConfig1, error) {
return NewWANCommonInterfaceConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANCommonInterfaceConfig1ClientsFromRootDevice discovers instances of the service in // NewWANCommonInterfaceConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -1784,35 +1832,47 @@ type WANDSLLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANDSLLinkConfig1Clients discovers instances of the service on the network, // NewWANDSLLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANDSLLinkConfig1Clients() (clients []*WANDSLLinkConfig1, errors []error, err error) { func NewWANDSLLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANDSLLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANDSLLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANDSLLinkConfig_1); err != nil {
return return
} }
clients = newWANDSLLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANDSLLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANDSLLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANDSLLinkConfig1Clients is the legacy version of NewWANDSLLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANDSLLinkConfig1Clients() (clients []*WANDSLLinkConfig1, errors []error, err error) {
return NewWANDSLLinkConfig1ClientsCtx(context.Background())
}
// NewWANDSLLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANDSLLinkConfig1ClientsByURL(loc *url.URL) ([]*WANDSLLinkConfig1, error) { func NewWANDSLLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANDSLLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANDSLLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANDSLLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANDSLLinkConfig1ClientsByURL is the legacy version of NewWANDSLLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANDSLLinkConfig1ClientsByURL(loc *url.URL) ([]*WANDSLLinkConfig1, error) {
return NewWANDSLLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANDSLLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANDSLLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2204,35 +2264,47 @@ type WANEthernetLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANEthernetLinkConfig1Clients discovers instances of the service on the network, // NewWANEthernetLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANEthernetLinkConfig1Clients() (clients []*WANEthernetLinkConfig1, errors []error, err error) { func NewWANEthernetLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANEthernetLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANEthernetLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANEthernetLinkConfig_1); err != nil {
return return
} }
clients = newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANEthernetLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANEthernetLinkConfig1Clients is the legacy version of NewWANEthernetLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANEthernetLinkConfig1Clients() (clients []*WANEthernetLinkConfig1, errors []error, err error) {
return NewWANEthernetLinkConfig1ClientsCtx(context.Background())
}
// NewWANEthernetLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANEthernetLinkConfig1ClientsByURL(loc *url.URL) ([]*WANEthernetLinkConfig1, error) { func NewWANEthernetLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANEthernetLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANEthernetLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANEthernetLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANEthernetLinkConfig1ClientsByURL is the legacy version of NewWANEthernetLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANEthernetLinkConfig1ClientsByURL(loc *url.URL) ([]*WANEthernetLinkConfig1, error) {
return NewWANEthernetLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANEthernetLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANEthernetLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2302,35 +2374,47 @@ type WANIPConnection1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANIPConnection1Clients discovers instances of the service on the network, // NewWANIPConnection1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANIPConnection1Clients() (clients []*WANIPConnection1, errors []error, err error) { func NewWANIPConnection1ClientsCtx(ctx context.Context) (clients []*WANIPConnection1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPConnection_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANIPConnection_1); err != nil {
return return
} }
clients = newWANIPConnection1ClientsFromGenericClients(genericClients) clients = newWANIPConnection1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANIPConnection1ClientsByURL discovers instances of the service at the given // NewWANIPConnection1Clients is the legacy version of NewWANIPConnection1ClientsCtx, but uses
// context.Background() as the context.
func NewWANIPConnection1Clients() (clients []*WANIPConnection1, errors []error, err error) {
return NewWANIPConnection1ClientsCtx(context.Background())
}
// NewWANIPConnection1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANIPConnection1ClientsByURL(loc *url.URL) ([]*WANIPConnection1, error) { func NewWANIPConnection1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANIPConnection1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPConnection_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANIPConnection_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANIPConnection1ClientsFromGenericClients(genericClients), nil return newWANIPConnection1ClientsFromGenericClients(genericClients), nil
} }
// NewWANIPConnection1ClientsByURL is the legacy version of NewWANIPConnection1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANIPConnection1ClientsByURL(loc *url.URL) ([]*WANIPConnection1, error) {
return NewWANIPConnection1ClientsByURLCtx(context.Background(), loc)
}
// NewWANIPConnection1ClientsFromRootDevice discovers instances of the service in // NewWANIPConnection1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -3148,35 +3232,47 @@ type WANPOTSLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANPOTSLinkConfig1Clients discovers instances of the service on the network, // NewWANPOTSLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANPOTSLinkConfig1Clients() (clients []*WANPOTSLinkConfig1, errors []error, err error) { func NewWANPOTSLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANPOTSLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPOTSLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANPOTSLinkConfig_1); err != nil {
return return
} }
clients = newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANPOTSLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANPOTSLinkConfig1Clients is the legacy version of NewWANPOTSLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANPOTSLinkConfig1Clients() (clients []*WANPOTSLinkConfig1, errors []error, err error) {
return NewWANPOTSLinkConfig1ClientsCtx(context.Background())
}
// NewWANPOTSLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANPOTSLinkConfig1ClientsByURL(loc *url.URL) ([]*WANPOTSLinkConfig1, error) { func NewWANPOTSLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANPOTSLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPOTSLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANPOTSLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANPOTSLinkConfig1ClientsByURL is the legacy version of NewWANPOTSLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANPOTSLinkConfig1ClientsByURL(loc *url.URL) ([]*WANPOTSLinkConfig1, error) {
return NewWANPOTSLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANPOTSLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANPOTSLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -3559,35 +3655,47 @@ type WANPPPConnection1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANPPPConnection1Clients discovers instances of the service on the network, // NewWANPPPConnection1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANPPPConnection1Clients() (clients []*WANPPPConnection1, errors []error, err error) { func NewWANPPPConnection1ClientsCtx(ctx context.Context) (clients []*WANPPPConnection1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPPPConnection_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANPPPConnection_1); err != nil {
return return
} }
clients = newWANPPPConnection1ClientsFromGenericClients(genericClients) clients = newWANPPPConnection1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANPPPConnection1ClientsByURL discovers instances of the service at the given // NewWANPPPConnection1Clients is the legacy version of NewWANPPPConnection1ClientsCtx, but uses
// context.Background() as the context.
func NewWANPPPConnection1Clients() (clients []*WANPPPConnection1, errors []error, err error) {
return NewWANPPPConnection1ClientsCtx(context.Background())
}
// NewWANPPPConnection1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) { func NewWANPPPConnection1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANPPPConnection1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPPPConnection_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANPPPConnection_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil
} }
// NewWANPPPConnection1ClientsByURL is the legacy version of NewWANPPPConnection1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) {
return NewWANPPPConnection1ClientsByURLCtx(context.Background(), loc)
}
// NewWANPPPConnection1ClientsFromRootDevice discovers instances of the service in // NewWANPPPConnection1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the

View File

@ -54,35 +54,47 @@ type DeviceProtection1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewDeviceProtection1Clients discovers instances of the service on the network, // NewDeviceProtection1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewDeviceProtection1Clients() (clients []*DeviceProtection1, errors []error, err error) { func NewDeviceProtection1ClientsCtx(ctx context.Context) (clients []*DeviceProtection1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_DeviceProtection_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_DeviceProtection_1); err != nil {
return return
} }
clients = newDeviceProtection1ClientsFromGenericClients(genericClients) clients = newDeviceProtection1ClientsFromGenericClients(genericClients)
return return
} }
// NewDeviceProtection1ClientsByURL discovers instances of the service at the given // NewDeviceProtection1Clients is the legacy version of NewDeviceProtection1ClientsCtx, but uses
// context.Background() as the context.
func NewDeviceProtection1Clients() (clients []*DeviceProtection1, errors []error, err error) {
return NewDeviceProtection1ClientsCtx(context.Background())
}
// NewDeviceProtection1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewDeviceProtection1ClientsByURL(loc *url.URL) ([]*DeviceProtection1, error) { func NewDeviceProtection1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*DeviceProtection1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_DeviceProtection_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_DeviceProtection_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newDeviceProtection1ClientsFromGenericClients(genericClients), nil return newDeviceProtection1ClientsFromGenericClients(genericClients), nil
} }
// NewDeviceProtection1ClientsByURL is the legacy version of NewDeviceProtection1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewDeviceProtection1ClientsByURL(loc *url.URL) ([]*DeviceProtection1, error) {
return NewDeviceProtection1ClientsByURLCtx(context.Background(), loc)
}
// NewDeviceProtection1ClientsFromRootDevice discovers instances of the service in // NewDeviceProtection1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -672,35 +684,47 @@ type LANHostConfigManagement1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewLANHostConfigManagement1Clients discovers instances of the service on the network, // NewLANHostConfigManagement1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewLANHostConfigManagement1Clients() (clients []*LANHostConfigManagement1, errors []error, err error) { func NewLANHostConfigManagement1ClientsCtx(ctx context.Context) (clients []*LANHostConfigManagement1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_LANHostConfigManagement_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_LANHostConfigManagement_1); err != nil {
return return
} }
clients = newLANHostConfigManagement1ClientsFromGenericClients(genericClients) clients = newLANHostConfigManagement1ClientsFromGenericClients(genericClients)
return return
} }
// NewLANHostConfigManagement1ClientsByURL discovers instances of the service at the given // NewLANHostConfigManagement1Clients is the legacy version of NewLANHostConfigManagement1ClientsCtx, but uses
// context.Background() as the context.
func NewLANHostConfigManagement1Clients() (clients []*LANHostConfigManagement1, errors []error, err error) {
return NewLANHostConfigManagement1ClientsCtx(context.Background())
}
// NewLANHostConfigManagement1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewLANHostConfigManagement1ClientsByURL(loc *url.URL) ([]*LANHostConfigManagement1, error) { func NewLANHostConfigManagement1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*LANHostConfigManagement1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_LANHostConfigManagement_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_LANHostConfigManagement_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil
} }
// NewLANHostConfigManagement1ClientsByURL is the legacy version of NewLANHostConfigManagement1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewLANHostConfigManagement1ClientsByURL(loc *url.URL) ([]*LANHostConfigManagement1, error) {
return NewLANHostConfigManagement1ClientsByURLCtx(context.Background(), loc)
}
// NewLANHostConfigManagement1ClientsFromRootDevice discovers instances of the service in // NewLANHostConfigManagement1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -1421,35 +1445,47 @@ type Layer3Forwarding1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewLayer3Forwarding1Clients discovers instances of the service on the network, // NewLayer3Forwarding1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewLayer3Forwarding1Clients() (clients []*Layer3Forwarding1, errors []error, err error) { func NewLayer3Forwarding1ClientsCtx(ctx context.Context) (clients []*Layer3Forwarding1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_Layer3Forwarding_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_Layer3Forwarding_1); err != nil {
return return
} }
clients = newLayer3Forwarding1ClientsFromGenericClients(genericClients) clients = newLayer3Forwarding1ClientsFromGenericClients(genericClients)
return return
} }
// NewLayer3Forwarding1ClientsByURL discovers instances of the service at the given // NewLayer3Forwarding1Clients is the legacy version of NewLayer3Forwarding1ClientsCtx, but uses
// context.Background() as the context.
func NewLayer3Forwarding1Clients() (clients []*Layer3Forwarding1, errors []error, err error) {
return NewLayer3Forwarding1ClientsCtx(context.Background())
}
// NewLayer3Forwarding1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewLayer3Forwarding1ClientsByURL(loc *url.URL) ([]*Layer3Forwarding1, error) { func NewLayer3Forwarding1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*Layer3Forwarding1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_Layer3Forwarding_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_Layer3Forwarding_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil
} }
// NewLayer3Forwarding1ClientsByURL is the legacy version of NewLayer3Forwarding1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewLayer3Forwarding1ClientsByURL(loc *url.URL) ([]*Layer3Forwarding1, error) {
return NewLayer3Forwarding1ClientsByURLCtx(context.Background(), loc)
}
// NewLayer3Forwarding1ClientsFromRootDevice discovers instances of the service in // NewLayer3Forwarding1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -1552,35 +1588,47 @@ type WANCableLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANCableLinkConfig1Clients discovers instances of the service on the network, // NewWANCableLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANCableLinkConfig1Clients() (clients []*WANCableLinkConfig1, errors []error, err error) { func NewWANCableLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANCableLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCableLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANCableLinkConfig_1); err != nil {
return return
} }
clients = newWANCableLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANCableLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANCableLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANCableLinkConfig1Clients is the legacy version of NewWANCableLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANCableLinkConfig1Clients() (clients []*WANCableLinkConfig1, errors []error, err error) {
return NewWANCableLinkConfig1ClientsCtx(context.Background())
}
// NewWANCableLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANCableLinkConfig1ClientsByURL(loc *url.URL) ([]*WANCableLinkConfig1, error) { func NewWANCableLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANCableLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCableLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANCableLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANCableLinkConfig1ClientsByURL is the legacy version of NewWANCableLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANCableLinkConfig1ClientsByURL(loc *url.URL) ([]*WANCableLinkConfig1, error) {
return NewWANCableLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANCableLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANCableLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -1970,35 +2018,47 @@ type WANCommonInterfaceConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANCommonInterfaceConfig1Clients discovers instances of the service on the network, // NewWANCommonInterfaceConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANCommonInterfaceConfig1Clients() (clients []*WANCommonInterfaceConfig1, errors []error, err error) { func NewWANCommonInterfaceConfig1ClientsCtx(ctx context.Context) (clients []*WANCommonInterfaceConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCommonInterfaceConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANCommonInterfaceConfig_1); err != nil {
return return
} }
clients = newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients) clients = newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANCommonInterfaceConfig1ClientsByURL discovers instances of the service at the given // NewWANCommonInterfaceConfig1Clients is the legacy version of NewWANCommonInterfaceConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANCommonInterfaceConfig1Clients() (clients []*WANCommonInterfaceConfig1, errors []error, err error) {
return NewWANCommonInterfaceConfig1ClientsCtx(context.Background())
}
// NewWANCommonInterfaceConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANCommonInterfaceConfig1ClientsByURL(loc *url.URL) ([]*WANCommonInterfaceConfig1, error) { func NewWANCommonInterfaceConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANCommonInterfaceConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCommonInterfaceConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANCommonInterfaceConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANCommonInterfaceConfig1ClientsByURL is the legacy version of NewWANCommonInterfaceConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANCommonInterfaceConfig1ClientsByURL(loc *url.URL) ([]*WANCommonInterfaceConfig1, error) {
return NewWANCommonInterfaceConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANCommonInterfaceConfig1ClientsFromRootDevice discovers instances of the service in // NewWANCommonInterfaceConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2407,35 +2467,47 @@ type WANDSLLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANDSLLinkConfig1Clients discovers instances of the service on the network, // NewWANDSLLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANDSLLinkConfig1Clients() (clients []*WANDSLLinkConfig1, errors []error, err error) { func NewWANDSLLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANDSLLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANDSLLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANDSLLinkConfig_1); err != nil {
return return
} }
clients = newWANDSLLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANDSLLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANDSLLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANDSLLinkConfig1Clients is the legacy version of NewWANDSLLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANDSLLinkConfig1Clients() (clients []*WANDSLLinkConfig1, errors []error, err error) {
return NewWANDSLLinkConfig1ClientsCtx(context.Background())
}
// NewWANDSLLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANDSLLinkConfig1ClientsByURL(loc *url.URL) ([]*WANDSLLinkConfig1, error) { func NewWANDSLLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANDSLLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANDSLLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANDSLLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANDSLLinkConfig1ClientsByURL is the legacy version of NewWANDSLLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANDSLLinkConfig1ClientsByURL(loc *url.URL) ([]*WANDSLLinkConfig1, error) {
return NewWANDSLLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANDSLLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANDSLLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2827,35 +2899,47 @@ type WANEthernetLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANEthernetLinkConfig1Clients discovers instances of the service on the network, // NewWANEthernetLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANEthernetLinkConfig1Clients() (clients []*WANEthernetLinkConfig1, errors []error, err error) { func NewWANEthernetLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANEthernetLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANEthernetLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANEthernetLinkConfig_1); err != nil {
return return
} }
clients = newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANEthernetLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANEthernetLinkConfig1Clients is the legacy version of NewWANEthernetLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANEthernetLinkConfig1Clients() (clients []*WANEthernetLinkConfig1, errors []error, err error) {
return NewWANEthernetLinkConfig1ClientsCtx(context.Background())
}
// NewWANEthernetLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANEthernetLinkConfig1ClientsByURL(loc *url.URL) ([]*WANEthernetLinkConfig1, error) { func NewWANEthernetLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANEthernetLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANEthernetLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANEthernetLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANEthernetLinkConfig1ClientsByURL is the legacy version of NewWANEthernetLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANEthernetLinkConfig1ClientsByURL(loc *url.URL) ([]*WANEthernetLinkConfig1, error) {
return NewWANEthernetLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANEthernetLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANEthernetLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2925,35 +3009,47 @@ type WANIPConnection1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANIPConnection1Clients discovers instances of the service on the network, // NewWANIPConnection1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANIPConnection1Clients() (clients []*WANIPConnection1, errors []error, err error) { func NewWANIPConnection1ClientsCtx(ctx context.Context) (clients []*WANIPConnection1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPConnection_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANIPConnection_1); err != nil {
return return
} }
clients = newWANIPConnection1ClientsFromGenericClients(genericClients) clients = newWANIPConnection1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANIPConnection1ClientsByURL discovers instances of the service at the given // NewWANIPConnection1Clients is the legacy version of NewWANIPConnection1ClientsCtx, but uses
// context.Background() as the context.
func NewWANIPConnection1Clients() (clients []*WANIPConnection1, errors []error, err error) {
return NewWANIPConnection1ClientsCtx(context.Background())
}
// NewWANIPConnection1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANIPConnection1ClientsByURL(loc *url.URL) ([]*WANIPConnection1, error) { func NewWANIPConnection1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANIPConnection1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPConnection_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANIPConnection_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANIPConnection1ClientsFromGenericClients(genericClients), nil return newWANIPConnection1ClientsFromGenericClients(genericClients), nil
} }
// NewWANIPConnection1ClientsByURL is the legacy version of NewWANIPConnection1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANIPConnection1ClientsByURL(loc *url.URL) ([]*WANIPConnection1, error) {
return NewWANIPConnection1ClientsByURLCtx(context.Background(), loc)
}
// NewWANIPConnection1ClientsFromRootDevice discovers instances of the service in // NewWANIPConnection1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -3771,35 +3867,47 @@ type WANIPConnection2 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANIPConnection2Clients discovers instances of the service on the network, // NewWANIPConnection2ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANIPConnection2Clients() (clients []*WANIPConnection2, errors []error, err error) { func NewWANIPConnection2ClientsCtx(ctx context.Context) (clients []*WANIPConnection2, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPConnection_2); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANIPConnection_2); err != nil {
return return
} }
clients = newWANIPConnection2ClientsFromGenericClients(genericClients) clients = newWANIPConnection2ClientsFromGenericClients(genericClients)
return return
} }
// NewWANIPConnection2ClientsByURL discovers instances of the service at the given // NewWANIPConnection2Clients is the legacy version of NewWANIPConnection2ClientsCtx, but uses
// context.Background() as the context.
func NewWANIPConnection2Clients() (clients []*WANIPConnection2, errors []error, err error) {
return NewWANIPConnection2ClientsCtx(context.Background())
}
// NewWANIPConnection2ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANIPConnection2ClientsByURL(loc *url.URL) ([]*WANIPConnection2, error) { func NewWANIPConnection2ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANIPConnection2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPConnection_2) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANIPConnection_2)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANIPConnection2ClientsFromGenericClients(genericClients), nil return newWANIPConnection2ClientsFromGenericClients(genericClients), nil
} }
// NewWANIPConnection2ClientsByURL is the legacy version of NewWANIPConnection2ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANIPConnection2ClientsByURL(loc *url.URL) ([]*WANIPConnection2, error) {
return NewWANIPConnection2ClientsByURLCtx(context.Background(), loc)
}
// NewWANIPConnection2ClientsFromRootDevice discovers instances of the service in // NewWANIPConnection2ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -4833,35 +4941,47 @@ type WANIPv6FirewallControl1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANIPv6FirewallControl1Clients discovers instances of the service on the network, // NewWANIPv6FirewallControl1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANIPv6FirewallControl1Clients() (clients []*WANIPv6FirewallControl1, errors []error, err error) { func NewWANIPv6FirewallControl1ClientsCtx(ctx context.Context) (clients []*WANIPv6FirewallControl1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPv6FirewallControl_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANIPv6FirewallControl_1); err != nil {
return return
} }
clients = newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients) clients = newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANIPv6FirewallControl1ClientsByURL discovers instances of the service at the given // NewWANIPv6FirewallControl1Clients is the legacy version of NewWANIPv6FirewallControl1ClientsCtx, but uses
// context.Background() as the context.
func NewWANIPv6FirewallControl1Clients() (clients []*WANIPv6FirewallControl1, errors []error, err error) {
return NewWANIPv6FirewallControl1ClientsCtx(context.Background())
}
// NewWANIPv6FirewallControl1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANIPv6FirewallControl1ClientsByURL(loc *url.URL) ([]*WANIPv6FirewallControl1, error) { func NewWANIPv6FirewallControl1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANIPv6FirewallControl1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPv6FirewallControl_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANIPv6FirewallControl_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients), nil return newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients), nil
} }
// NewWANIPv6FirewallControl1ClientsByURL is the legacy version of NewWANIPv6FirewallControl1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANIPv6FirewallControl1ClientsByURL(loc *url.URL) ([]*WANIPv6FirewallControl1, error) {
return NewWANIPv6FirewallControl1ClientsByURLCtx(context.Background(), loc)
}
// NewWANIPv6FirewallControl1ClientsFromRootDevice discovers instances of the service in // NewWANIPv6FirewallControl1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -5243,35 +5363,47 @@ type WANPOTSLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANPOTSLinkConfig1Clients discovers instances of the service on the network, // NewWANPOTSLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANPOTSLinkConfig1Clients() (clients []*WANPOTSLinkConfig1, errors []error, err error) { func NewWANPOTSLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANPOTSLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPOTSLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANPOTSLinkConfig_1); err != nil {
return return
} }
clients = newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANPOTSLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANPOTSLinkConfig1Clients is the legacy version of NewWANPOTSLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANPOTSLinkConfig1Clients() (clients []*WANPOTSLinkConfig1, errors []error, err error) {
return NewWANPOTSLinkConfig1ClientsCtx(context.Background())
}
// NewWANPOTSLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANPOTSLinkConfig1ClientsByURL(loc *url.URL) ([]*WANPOTSLinkConfig1, error) { func NewWANPOTSLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANPOTSLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPOTSLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANPOTSLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANPOTSLinkConfig1ClientsByURL is the legacy version of NewWANPOTSLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANPOTSLinkConfig1ClientsByURL(loc *url.URL) ([]*WANPOTSLinkConfig1, error) {
return NewWANPOTSLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANPOTSLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANPOTSLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -5654,35 +5786,47 @@ type WANPPPConnection1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANPPPConnection1Clients discovers instances of the service on the network, // NewWANPPPConnection1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANPPPConnection1Clients() (clients []*WANPPPConnection1, errors []error, err error) { func NewWANPPPConnection1ClientsCtx(ctx context.Context) (clients []*WANPPPConnection1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPPPConnection_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANPPPConnection_1); err != nil {
return return
} }
clients = newWANPPPConnection1ClientsFromGenericClients(genericClients) clients = newWANPPPConnection1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANPPPConnection1ClientsByURL discovers instances of the service at the given // NewWANPPPConnection1Clients is the legacy version of NewWANPPPConnection1ClientsCtx, but uses
// context.Background() as the context.
func NewWANPPPConnection1Clients() (clients []*WANPPPConnection1, errors []error, err error) {
return NewWANPPPConnection1ClientsCtx(context.Background())
}
// NewWANPPPConnection1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) { func NewWANPPPConnection1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANPPPConnection1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPPPConnection_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANPPPConnection_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil
} }
// NewWANPPPConnection1ClientsByURL is the legacy version of NewWANPPPConnection1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) {
return NewWANPPPConnection1ClientsByURLCtx(context.Background(), loc)
}
// NewWANPPPConnection1ClientsFromRootDevice discovers instances of the service in // NewWANPPPConnection1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the

View File

@ -58,35 +58,47 @@ type LANHostConfigManagement1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewLANHostConfigManagement1Clients discovers instances of the service on the network, // NewLANHostConfigManagement1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewLANHostConfigManagement1Clients() (clients []*LANHostConfigManagement1, errors []error, err error) { func NewLANHostConfigManagement1ClientsCtx(ctx context.Context) (clients []*LANHostConfigManagement1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_LANHostConfigManagement_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_LANHostConfigManagement_1); err != nil {
return return
} }
clients = newLANHostConfigManagement1ClientsFromGenericClients(genericClients) clients = newLANHostConfigManagement1ClientsFromGenericClients(genericClients)
return return
} }
// NewLANHostConfigManagement1ClientsByURL discovers instances of the service at the given // NewLANHostConfigManagement1Clients is the legacy version of NewLANHostConfigManagement1ClientsCtx, but uses
// context.Background() as the context.
func NewLANHostConfigManagement1Clients() (clients []*LANHostConfigManagement1, errors []error, err error) {
return NewLANHostConfigManagement1ClientsCtx(context.Background())
}
// NewLANHostConfigManagement1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewLANHostConfigManagement1ClientsByURL(loc *url.URL) ([]*LANHostConfigManagement1, error) { func NewLANHostConfigManagement1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*LANHostConfigManagement1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_LANHostConfigManagement_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_LANHostConfigManagement_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil return newLANHostConfigManagement1ClientsFromGenericClients(genericClients), nil
} }
// NewLANHostConfigManagement1ClientsByURL is the legacy version of NewLANHostConfigManagement1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewLANHostConfigManagement1ClientsByURL(loc *url.URL) ([]*LANHostConfigManagement1, error) {
return NewLANHostConfigManagement1ClientsByURLCtx(context.Background(), loc)
}
// NewLANHostConfigManagement1ClientsFromRootDevice discovers instances of the service in // NewLANHostConfigManagement1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -807,35 +819,47 @@ type Layer3Forwarding1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewLayer3Forwarding1Clients discovers instances of the service on the network, // NewLayer3Forwarding1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewLayer3Forwarding1Clients() (clients []*Layer3Forwarding1, errors []error, err error) { func NewLayer3Forwarding1ClientsCtx(ctx context.Context) (clients []*Layer3Forwarding1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_Layer3Forwarding_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_Layer3Forwarding_1); err != nil {
return return
} }
clients = newLayer3Forwarding1ClientsFromGenericClients(genericClients) clients = newLayer3Forwarding1ClientsFromGenericClients(genericClients)
return return
} }
// NewLayer3Forwarding1ClientsByURL discovers instances of the service at the given // NewLayer3Forwarding1Clients is the legacy version of NewLayer3Forwarding1ClientsCtx, but uses
// context.Background() as the context.
func NewLayer3Forwarding1Clients() (clients []*Layer3Forwarding1, errors []error, err error) {
return NewLayer3Forwarding1ClientsCtx(context.Background())
}
// NewLayer3Forwarding1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewLayer3Forwarding1ClientsByURL(loc *url.URL) ([]*Layer3Forwarding1, error) { func NewLayer3Forwarding1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*Layer3Forwarding1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_Layer3Forwarding_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_Layer3Forwarding_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil return newLayer3Forwarding1ClientsFromGenericClients(genericClients), nil
} }
// NewLayer3Forwarding1ClientsByURL is the legacy version of NewLayer3Forwarding1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewLayer3Forwarding1ClientsByURL(loc *url.URL) ([]*Layer3Forwarding1, error) {
return NewLayer3Forwarding1ClientsByURLCtx(context.Background(), loc)
}
// NewLayer3Forwarding1ClientsFromRootDevice discovers instances of the service in // NewLayer3Forwarding1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -938,35 +962,47 @@ type WANCableLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANCableLinkConfig1Clients discovers instances of the service on the network, // NewWANCableLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANCableLinkConfig1Clients() (clients []*WANCableLinkConfig1, errors []error, err error) { func NewWANCableLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANCableLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCableLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANCableLinkConfig_1); err != nil {
return return
} }
clients = newWANCableLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANCableLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANCableLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANCableLinkConfig1Clients is the legacy version of NewWANCableLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANCableLinkConfig1Clients() (clients []*WANCableLinkConfig1, errors []error, err error) {
return NewWANCableLinkConfig1ClientsCtx(context.Background())
}
// NewWANCableLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANCableLinkConfig1ClientsByURL(loc *url.URL) ([]*WANCableLinkConfig1, error) { func NewWANCableLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANCableLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCableLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANCableLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANCableLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANCableLinkConfig1ClientsByURL is the legacy version of NewWANCableLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANCableLinkConfig1ClientsByURL(loc *url.URL) ([]*WANCableLinkConfig1, error) {
return NewWANCableLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANCableLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANCableLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -1356,35 +1392,47 @@ type WANCommonInterfaceConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANCommonInterfaceConfig1Clients discovers instances of the service on the network, // NewWANCommonInterfaceConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANCommonInterfaceConfig1Clients() (clients []*WANCommonInterfaceConfig1, errors []error, err error) { func NewWANCommonInterfaceConfig1ClientsCtx(ctx context.Context) (clients []*WANCommonInterfaceConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANCommonInterfaceConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANCommonInterfaceConfig_1); err != nil {
return return
} }
clients = newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients) clients = newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANCommonInterfaceConfig1ClientsByURL discovers instances of the service at the given // NewWANCommonInterfaceConfig1Clients is the legacy version of NewWANCommonInterfaceConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANCommonInterfaceConfig1Clients() (clients []*WANCommonInterfaceConfig1, errors []error, err error) {
return NewWANCommonInterfaceConfig1ClientsCtx(context.Background())
}
// NewWANCommonInterfaceConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANCommonInterfaceConfig1ClientsByURL(loc *url.URL) ([]*WANCommonInterfaceConfig1, error) { func NewWANCommonInterfaceConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANCommonInterfaceConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANCommonInterfaceConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANCommonInterfaceConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil return newWANCommonInterfaceConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANCommonInterfaceConfig1ClientsByURL is the legacy version of NewWANCommonInterfaceConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANCommonInterfaceConfig1ClientsByURL(loc *url.URL) ([]*WANCommonInterfaceConfig1, error) {
return NewWANCommonInterfaceConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANCommonInterfaceConfig1ClientsFromRootDevice discovers instances of the service in // NewWANCommonInterfaceConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -1793,35 +1841,47 @@ type WANDSLLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANDSLLinkConfig1Clients discovers instances of the service on the network, // NewWANDSLLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANDSLLinkConfig1Clients() (clients []*WANDSLLinkConfig1, errors []error, err error) { func NewWANDSLLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANDSLLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANDSLLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANDSLLinkConfig_1); err != nil {
return return
} }
clients = newWANDSLLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANDSLLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANDSLLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANDSLLinkConfig1Clients is the legacy version of NewWANDSLLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANDSLLinkConfig1Clients() (clients []*WANDSLLinkConfig1, errors []error, err error) {
return NewWANDSLLinkConfig1ClientsCtx(context.Background())
}
// NewWANDSLLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANDSLLinkConfig1ClientsByURL(loc *url.URL) ([]*WANDSLLinkConfig1, error) { func NewWANDSLLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANDSLLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANDSLLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANDSLLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANDSLLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANDSLLinkConfig1ClientsByURL is the legacy version of NewWANDSLLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANDSLLinkConfig1ClientsByURL(loc *url.URL) ([]*WANDSLLinkConfig1, error) {
return NewWANDSLLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANDSLLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANDSLLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2213,35 +2273,47 @@ type WANEthernetLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANEthernetLinkConfig1Clients discovers instances of the service on the network, // NewWANEthernetLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANEthernetLinkConfig1Clients() (clients []*WANEthernetLinkConfig1, errors []error, err error) { func NewWANEthernetLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANEthernetLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANEthernetLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANEthernetLinkConfig_1); err != nil {
return return
} }
clients = newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANEthernetLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANEthernetLinkConfig1Clients is the legacy version of NewWANEthernetLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANEthernetLinkConfig1Clients() (clients []*WANEthernetLinkConfig1, errors []error, err error) {
return NewWANEthernetLinkConfig1ClientsCtx(context.Background())
}
// NewWANEthernetLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANEthernetLinkConfig1ClientsByURL(loc *url.URL) ([]*WANEthernetLinkConfig1, error) { func NewWANEthernetLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANEthernetLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANEthernetLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANEthernetLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANEthernetLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANEthernetLinkConfig1ClientsByURL is the legacy version of NewWANEthernetLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANEthernetLinkConfig1ClientsByURL(loc *url.URL) ([]*WANEthernetLinkConfig1, error) {
return NewWANEthernetLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANEthernetLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANEthernetLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -2311,35 +2383,47 @@ type WANIPConnection1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANIPConnection1Clients discovers instances of the service on the network, // NewWANIPConnection1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANIPConnection1Clients() (clients []*WANIPConnection1, errors []error, err error) { func NewWANIPConnection1ClientsCtx(ctx context.Context) (clients []*WANIPConnection1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPConnection_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANIPConnection_1); err != nil {
return return
} }
clients = newWANIPConnection1ClientsFromGenericClients(genericClients) clients = newWANIPConnection1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANIPConnection1ClientsByURL discovers instances of the service at the given // NewWANIPConnection1Clients is the legacy version of NewWANIPConnection1ClientsCtx, but uses
// context.Background() as the context.
func NewWANIPConnection1Clients() (clients []*WANIPConnection1, errors []error, err error) {
return NewWANIPConnection1ClientsCtx(context.Background())
}
// NewWANIPConnection1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANIPConnection1ClientsByURL(loc *url.URL) ([]*WANIPConnection1, error) { func NewWANIPConnection1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANIPConnection1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPConnection_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANIPConnection_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANIPConnection1ClientsFromGenericClients(genericClients), nil return newWANIPConnection1ClientsFromGenericClients(genericClients), nil
} }
// NewWANIPConnection1ClientsByURL is the legacy version of NewWANIPConnection1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANIPConnection1ClientsByURL(loc *url.URL) ([]*WANIPConnection1, error) {
return NewWANIPConnection1ClientsByURLCtx(context.Background(), loc)
}
// NewWANIPConnection1ClientsFromRootDevice discovers instances of the service in // NewWANIPConnection1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -3157,35 +3241,47 @@ type WANIPConnection2 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANIPConnection2Clients discovers instances of the service on the network, // NewWANIPConnection2ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANIPConnection2Clients() (clients []*WANIPConnection2, errors []error, err error) { func NewWANIPConnection2ClientsCtx(ctx context.Context) (clients []*WANIPConnection2, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPConnection_2); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANIPConnection_2); err != nil {
return return
} }
clients = newWANIPConnection2ClientsFromGenericClients(genericClients) clients = newWANIPConnection2ClientsFromGenericClients(genericClients)
return return
} }
// NewWANIPConnection2ClientsByURL discovers instances of the service at the given // NewWANIPConnection2Clients is the legacy version of NewWANIPConnection2ClientsCtx, but uses
// context.Background() as the context.
func NewWANIPConnection2Clients() (clients []*WANIPConnection2, errors []error, err error) {
return NewWANIPConnection2ClientsCtx(context.Background())
}
// NewWANIPConnection2ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANIPConnection2ClientsByURL(loc *url.URL) ([]*WANIPConnection2, error) { func NewWANIPConnection2ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANIPConnection2, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPConnection_2) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANIPConnection_2)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANIPConnection2ClientsFromGenericClients(genericClients), nil return newWANIPConnection2ClientsFromGenericClients(genericClients), nil
} }
// NewWANIPConnection2ClientsByURL is the legacy version of NewWANIPConnection2ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANIPConnection2ClientsByURL(loc *url.URL) ([]*WANIPConnection2, error) {
return NewWANIPConnection2ClientsByURLCtx(context.Background(), loc)
}
// NewWANIPConnection2ClientsFromRootDevice discovers instances of the service in // NewWANIPConnection2ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -4246,35 +4342,47 @@ type WANIPv6FirewallControl1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANIPv6FirewallControl1Clients discovers instances of the service on the network, // NewWANIPv6FirewallControl1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANIPv6FirewallControl1Clients() (clients []*WANIPv6FirewallControl1, errors []error, err error) { func NewWANIPv6FirewallControl1ClientsCtx(ctx context.Context) (clients []*WANIPv6FirewallControl1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANIPv6FirewallControl_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANIPv6FirewallControl_1); err != nil {
return return
} }
clients = newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients) clients = newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANIPv6FirewallControl1ClientsByURL discovers instances of the service at the given // NewWANIPv6FirewallControl1Clients is the legacy version of NewWANIPv6FirewallControl1ClientsCtx, but uses
// context.Background() as the context.
func NewWANIPv6FirewallControl1Clients() (clients []*WANIPv6FirewallControl1, errors []error, err error) {
return NewWANIPv6FirewallControl1ClientsCtx(context.Background())
}
// NewWANIPv6FirewallControl1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANIPv6FirewallControl1ClientsByURL(loc *url.URL) ([]*WANIPv6FirewallControl1, error) { func NewWANIPv6FirewallControl1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANIPv6FirewallControl1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANIPv6FirewallControl_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANIPv6FirewallControl_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients), nil return newWANIPv6FirewallControl1ClientsFromGenericClients(genericClients), nil
} }
// NewWANIPv6FirewallControl1ClientsByURL is the legacy version of NewWANIPv6FirewallControl1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANIPv6FirewallControl1ClientsByURL(loc *url.URL) ([]*WANIPv6FirewallControl1, error) {
return NewWANIPv6FirewallControl1ClientsByURLCtx(context.Background(), loc)
}
// NewWANIPv6FirewallControl1ClientsFromRootDevice discovers instances of the service in // NewWANIPv6FirewallControl1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -4656,35 +4764,47 @@ type WANPOTSLinkConfig1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANPOTSLinkConfig1Clients discovers instances of the service on the network, // NewWANPOTSLinkConfig1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANPOTSLinkConfig1Clients() (clients []*WANPOTSLinkConfig1, errors []error, err error) { func NewWANPOTSLinkConfig1ClientsCtx(ctx context.Context) (clients []*WANPOTSLinkConfig1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPOTSLinkConfig_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANPOTSLinkConfig_1); err != nil {
return return
} }
clients = newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients) clients = newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANPOTSLinkConfig1ClientsByURL discovers instances of the service at the given // NewWANPOTSLinkConfig1Clients is the legacy version of NewWANPOTSLinkConfig1ClientsCtx, but uses
// context.Background() as the context.
func NewWANPOTSLinkConfig1Clients() (clients []*WANPOTSLinkConfig1, errors []error, err error) {
return NewWANPOTSLinkConfig1ClientsCtx(context.Background())
}
// NewWANPOTSLinkConfig1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANPOTSLinkConfig1ClientsByURL(loc *url.URL) ([]*WANPOTSLinkConfig1, error) { func NewWANPOTSLinkConfig1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANPOTSLinkConfig1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPOTSLinkConfig_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANPOTSLinkConfig_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil return newWANPOTSLinkConfig1ClientsFromGenericClients(genericClients), nil
} }
// NewWANPOTSLinkConfig1ClientsByURL is the legacy version of NewWANPOTSLinkConfig1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANPOTSLinkConfig1ClientsByURL(loc *url.URL) ([]*WANPOTSLinkConfig1, error) {
return NewWANPOTSLinkConfig1ClientsByURLCtx(context.Background(), loc)
}
// NewWANPOTSLinkConfig1ClientsFromRootDevice discovers instances of the service in // NewWANPOTSLinkConfig1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the
@ -5067,35 +5187,47 @@ type WANPPPConnection1 struct {
goupnp.ServiceClient goupnp.ServiceClient
} }
// NewWANPPPConnection1Clients discovers instances of the service on the network, // NewWANPPPConnection1ClientsCtx discovers instances of the service on the network,
// and returns clients to any that are found. errors will contain an error for // and returns clients to any that are found. errors will contain an error for
// any devices that replied but which could not be queried, and err will be set // any devices that replied but which could not be queried, and err will be set
// if the discovery process failed outright. // if the discovery process failed outright.
// //
// This is a typical entry calling point into this package. // This is a typical entry calling point into this package.
func NewWANPPPConnection1Clients() (clients []*WANPPPConnection1, errors []error, err error) { func NewWANPPPConnection1ClientsCtx(ctx context.Context) (clients []*WANPPPConnection1, errors []error, err error) {
var genericClients []goupnp.ServiceClient var genericClients []goupnp.ServiceClient
if genericClients, errors, err = goupnp.NewServiceClients(URN_WANPPPConnection_1); err != nil { if genericClients, errors, err = goupnp.NewServiceClientsCtx(ctx, URN_WANPPPConnection_1); err != nil {
return return
} }
clients = newWANPPPConnection1ClientsFromGenericClients(genericClients) clients = newWANPPPConnection1ClientsFromGenericClients(genericClients)
return return
} }
// NewWANPPPConnection1ClientsByURL discovers instances of the service at the given // NewWANPPPConnection1Clients is the legacy version of NewWANPPPConnection1ClientsCtx, but uses
// context.Background() as the context.
func NewWANPPPConnection1Clients() (clients []*WANPPPConnection1, errors []error, err error) {
return NewWANPPPConnection1ClientsCtx(context.Background())
}
// NewWANPPPConnection1ClientsByURLCtx discovers instances of the service at the given
// URL, and returns clients to any that are found. An error is returned if // URL, and returns clients to any that are found. An error is returned if
// there was an error probing the service. // there was an error probing the service.
// //
// This is a typical entry calling point into this package when reusing an // This is a typical entry calling point into this package when reusing an
// previously discovered service URL. // previously discovered service URL.
func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) { func NewWANPPPConnection1ClientsByURLCtx(ctx context.Context, loc *url.URL) ([]*WANPPPConnection1, error) {
genericClients, err := goupnp.NewServiceClientsByURL(loc, URN_WANPPPConnection_1) genericClients, err := goupnp.NewServiceClientsByURLCtx(ctx, loc, URN_WANPPPConnection_1)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil return newWANPPPConnection1ClientsFromGenericClients(genericClients), nil
} }
// NewWANPPPConnection1ClientsByURL is the legacy version of NewWANPPPConnection1ClientsByURLCtx, but uses
// context.Background() as the context.
func NewWANPPPConnection1ClientsByURL(loc *url.URL) ([]*WANPPPConnection1, error) {
return NewWANPPPConnection1ClientsByURLCtx(context.Background(), loc)
}
// NewWANPPPConnection1ClientsFromRootDevice discovers instances of the service in // NewWANPPPConnection1ClientsFromRootDevice discovers instances of the service in
// a given root device, and returns clients to any that are found. An error is // a given root device, and returns clients to any that are found. An error is
// returned if there was not at least one instance of the service within the // returned if there was not at least one instance of the service within the

View File

@ -3,6 +3,7 @@
package goupnp package goupnp
import ( import (
"context"
"encoding/xml" "encoding/xml"
"errors" "errors"
"fmt" "fmt"
@ -149,19 +150,25 @@ func (srv *Service) String() string {
return fmt.Sprintf("Service ID %s : %s", srv.ServiceId, srv.ServiceType) return fmt.Sprintf("Service ID %s : %s", srv.ServiceId, srv.ServiceType)
} }
// RequestSCPD requests the SCPD (soap actions and state variables description) // RequestSCPDCtx requests the SCPD (soap actions and state variables description)
// for the service. // for the service.
func (srv *Service) RequestSCPD() (*scpd.SCPD, error) { func (srv *Service) RequestSCPDCtx(ctx context.Context) (*scpd.SCPD, error) {
if !srv.SCPDURL.Ok { if !srv.SCPDURL.Ok {
return nil, errors.New("bad/missing SCPD URL, or no URLBase has been set") return nil, errors.New("bad/missing SCPD URL, or no URLBase has been set")
} }
s := new(scpd.SCPD) s := new(scpd.SCPD)
if err := requestXml(srv.SCPDURL.URL.String(), scpd.SCPDXMLNamespace, s); err != nil { if err := requestXml(ctx, srv.SCPDURL.URL.String(), scpd.SCPDXMLNamespace, s); err != nil {
return nil, err return nil, err
} }
return s, nil return s, nil
} }
// RequestSCPD is the legacy version of RequestSCPDCtx, but uses
// context.Background() as the context.
func (srv *Service) RequestSCPD() (*scpd.SCPD, error) {
return srv.RequestSCPDCtx(context.Background())
}
// RequestSCDP is for compatibility only, prefer RequestSCPD. This was a // RequestSCDP is for compatibility only, prefer RequestSCPD. This was a
// misspelling of RequestSCDP. // misspelling of RequestSCDP.
func (srv *Service) RequestSCDP() (*scpd.SCPD, error) { func (srv *Service) RequestSCDP() (*scpd.SCPD, error) {

View File

@ -15,6 +15,7 @@
package goupnp package goupnp
import ( import (
"context"
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"io" "io"
@ -72,19 +73,19 @@ type MaybeRootDevice struct {
Err error Err error
} }
// DiscoverDevices attempts to find targets of the given type. This is // DiscoverDevicesCtx attempts to find targets of the given type. This is
// typically the entry-point for this package. searchTarget is typically a URN // typically the entry-point for this package. searchTarget is typically a URN
// in the form "urn:schemas-upnp-org:device:..." or // in the form "urn:schemas-upnp-org:device:..." or
// "urn:schemas-upnp-org:service:...". A single error is returned for errors // "urn:schemas-upnp-org:service:...". A single error is returned for errors
// while attempting to send the query. An error or RootDevice is returned for // while attempting to send the query. An error or RootDevice is returned for
// each discovered RootDevice. // each discovered RootDevice.
func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) { func DiscoverDevicesCtx(ctx context.Context, searchTarget string) ([]MaybeRootDevice, error) {
hc, hcCleanup, err := httpuClient() hc, hcCleanup, err := httpuClient()
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer hcCleanup() defer hcCleanup()
responses, err := ssdp.SSDPRawSearch(hc, string(searchTarget), 2, 3) responses, err := ssdp.SSDPRawSearchCtx(ctx, hc, string(searchTarget), 2, 3)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -99,7 +100,7 @@ func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) {
continue continue
} }
maybe.Location = loc maybe.Location = loc
if root, err := DeviceByURL(loc); err != nil { if root, err := DeviceByURLCtx(ctx, loc); err != nil {
maybe.Err = err maybe.Err = err
} else { } else {
maybe.Root = root maybe.Root = root
@ -112,10 +113,16 @@ func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) {
return results, nil return results, nil
} }
func DeviceByURL(loc *url.URL) (*RootDevice, error) { // DiscoverDevices is the legacy version of DiscoverDevicesCtx, but uses
// context.Background() as the context.
func DiscoverDevices(searchTarget string) ([]MaybeRootDevice, error) {
return DiscoverDevicesCtx(context.Background(), searchTarget)
}
func DeviceByURLCtx(ctx context.Context, loc *url.URL) (*RootDevice, error) {
locStr := loc.String() locStr := loc.String()
root := new(RootDevice) root := new(RootDevice)
if err := requestXml(locStr, DeviceXMLNamespace, root); err != nil { if err := requestXml(ctx, locStr, DeviceXMLNamespace, root); err != nil {
return nil, ContextError{fmt.Sprintf("error requesting root device details from %q", locStr), err} return nil, ContextError{fmt.Sprintf("error requesting root device details from %q", locStr), err}
} }
var urlBaseStr string var urlBaseStr string
@ -132,17 +139,25 @@ func DeviceByURL(loc *url.URL) (*RootDevice, error) {
return root, nil return root, nil
} }
func DeviceByURL(loc *url.URL) (*RootDevice, error) {
return DeviceByURLCtx(context.Background(), loc)
}
// CharsetReaderDefault specifies the charset reader used while decoding the output // CharsetReaderDefault specifies the charset reader used while decoding the output
// from a UPnP server. It can be modified in an init function to allow for non-utf8 encodings, // from a UPnP server. It can be modified in an init function to allow for non-utf8 encodings,
// but should not be changed after requesting clients. // but should not be changed after requesting clients.
var CharsetReaderDefault func(charset string, input io.Reader) (io.Reader, error) var CharsetReaderDefault func(charset string, input io.Reader) (io.Reader, error)
func requestXml(url string, defaultSpace string, doc interface{}) error { func requestXml(ctx context.Context, url string, defaultSpace string, doc interface{}) error {
timeout := time.Duration(3 * time.Second) ctx, cancel := context.WithTimeout(ctx, 3*time.Second)
client := http.Client{ defer cancel()
Timeout: timeout,
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
return err
} }
resp, err := client.Get(url)
resp, err := http.DefaultClient.Do(req)
if err != nil { if err != nil {
return err return err
} }

View File

@ -1,6 +1,7 @@
package goupnp package goupnp
import ( import (
"context"
"fmt" "fmt"
"net" "net"
"net/url" "net/url"
@ -21,12 +22,12 @@ type ServiceClient struct {
localAddr net.IP localAddr net.IP
} }
// NewServiceClients discovers services, and returns clients for them. err will // NewServiceClientsCtx discovers services, and returns clients for them. err will
// report any error with the discovery process (blocking any device/service // report any error with the discovery process (blocking any device/service
// discovery), errors reports errors on a per-root-device basis. // discovery), errors reports errors on a per-root-device basis.
func NewServiceClients(searchTarget string) (clients []ServiceClient, errors []error, err error) { func NewServiceClientsCtx(ctx context.Context, searchTarget string) (clients []ServiceClient, errors []error, err error) {
var maybeRootDevices []MaybeRootDevice var maybeRootDevices []MaybeRootDevice
if maybeRootDevices, err = DiscoverDevices(searchTarget); err != nil { if maybeRootDevices, err = DiscoverDevicesCtx(ctx, searchTarget); err != nil {
return return
} }
@ -49,16 +50,28 @@ func NewServiceClients(searchTarget string) (clients []ServiceClient, errors []e
return return
} }
// NewServiceClientsByURL creates client(s) for the given service URN, for a // NewServiceClients is the legacy version of NewServiceClientsCtx, but uses
// context.Background() as the context.
func NewServiceClients(searchTarget string) (clients []ServiceClient, errors []error, err error) {
return NewServiceClientsCtx(context.Background(), searchTarget)
}
// NewServiceClientsByURLCtx creates client(s) for the given service URN, for a
// root device at the given URL. // root device at the given URL.
func NewServiceClientsByURL(loc *url.URL, searchTarget string) ([]ServiceClient, error) { func NewServiceClientsByURLCtx(ctx context.Context, loc *url.URL, searchTarget string) ([]ServiceClient, error) {
rootDevice, err := DeviceByURL(loc) rootDevice, err := DeviceByURLCtx(ctx, loc)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return NewServiceClientsFromRootDevice(rootDevice, loc, searchTarget) return NewServiceClientsFromRootDevice(rootDevice, loc, searchTarget)
} }
// NewServiceClientsByURL is the legacy version of NewServiceClientsByURLCtx, but uses
// context.Background() as the context.
func NewServiceClientsByURL(loc *url.URL, searchTarget string) ([]ServiceClient, error) {
return NewServiceClientsByURLCtx(context.Background(), loc, searchTarget)
}
// NewServiceClientsFromDevice creates client(s) for the given service URN, in // NewServiceClientsFromDevice creates client(s) for the given service URN, in
// a given root device. The loc parameter is simply assigned to the // a given root device. The loc parameter is simply assigned to the
// Location attribute of the returned ServiceClient(s). // Location attribute of the returned ServiceClient(s).

View File

@ -1,6 +1,7 @@
package ssdp package ssdp
import ( import (
"context"
"errors" "errors"
"log" "log"
"net/http" "net/http"
@ -34,14 +35,15 @@ type HTTPUClient interface {
) ([]*http.Response, error) ) ([]*http.Response, error)
} }
// SSDPRawSearch performs a fairly raw SSDP search request, and returns the // SSDPRawSearchCtx performs a fairly raw SSDP search request, and returns the
// unique response(s) that it receives. Each response has the requested // unique response(s) that it receives. Each response has the requested
// searchTarget, a USN, and a valid location. maxWaitSeconds states how long to // searchTarget, a USN, and a valid location. maxWaitSeconds states how long to
// wait for responses in seconds, and must be a minimum of 1 (the // wait for responses in seconds, and must be a minimum of 1 (the
// implementation waits an additional 100ms for responses to arrive), 2 is a // implementation waits an additional 100ms for responses to arrive), 2 is a
// reasonable value for this. numSends is the number of requests to send - 3 is // reasonable value for this. numSends is the number of requests to send - 3 is
// a reasonable value for this. // a reasonable value for this.
func SSDPRawSearch( func SSDPRawSearchCtx(
ctx context.Context,
httpu HTTPUClient, httpu HTTPUClient,
searchTarget string, searchTarget string,
maxWaitSeconds int, maxWaitSeconds int,
@ -51,7 +53,7 @@ func SSDPRawSearch(
return nil, errors.New("ssdp: maxWaitSeconds must be >= 1") return nil, errors.New("ssdp: maxWaitSeconds must be >= 1")
} }
req := http.Request{ req := (&http.Request{
Method: methodSearch, Method: methodSearch,
// TODO: Support both IPv4 and IPv6. // TODO: Support both IPv4 and IPv6.
Host: ssdpUDP4Addr, Host: ssdpUDP4Addr,
@ -64,8 +66,8 @@ func SSDPRawSearch(
"MAN": []string{ssdpDiscover}, "MAN": []string{ssdpDiscover},
"ST": []string{searchTarget}, "ST": []string{searchTarget},
}, },
} }).WithContext(ctx)
allResponses, err := httpu.Do(&req, time.Duration(maxWaitSeconds)*time.Second+100*time.Millisecond, numSends) allResponses, err := httpu.Do(req, time.Duration(maxWaitSeconds)*time.Second+100*time.Millisecond, numSends)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -97,3 +99,9 @@ func SSDPRawSearch(
return responses, nil return responses, nil
} }
// SSDPRawSearch is the legacy version of SSDPRawSearchCtx, but uses
// context.Background() as the context.
func SSDPRawSearch(httpu HTTPUClient, searchTarget string, maxWaitSeconds int, numSends int) ([]*http.Response, error) {
return SSDPRawSearchCtx(context.Background(), httpu, searchTarget, maxWaitSeconds, numSends)
}