UPNPDevice

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Universal Plug and Play (UPnP) device. See UPNP for UPnP discovery and utility functions. Provides low-level access to UPNP control commands. Allows to manage port mappings (port forwarding) and to query network information of the device (like local and external IP address and status). Note that methods on this class are synchronous and block the calling thread.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsUPNPDevice() Instance
}

type Expanded

type Expanded = MoreArgs

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsUPNPDevice

func (self *Extension[T]) AsUPNPDevice() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type IGDStatus

type IGDStatus int //gd:UPNPDevice.IGDStatus
const (
	// OK.
	IgdStatusOk IGDStatus = 0
	// HTTP error.
	IgdStatusHttpError IGDStatus = 1
	// Empty HTTP response.
	IgdStatusHttpEmpty IGDStatus = 2
	// Returned response contained no URLs.
	IgdStatusNoUrls IGDStatus = 3
	// Not a valid IGD.
	IgdStatusNoIgd IGDStatus = 4
	// Disconnected.
	IgdStatusDisconnected IGDStatus = 5
	// Unknown device.
	IgdStatusUnknownDevice IGDStatus = 6
	// Invalid control.
	IgdStatusInvalidControl IGDStatus = 7
	// Memory allocation error.
	IgdStatusMallocError IGDStatus = 8
	// Unknown error.
	IgdStatusUnknownError IGDStatus = 9
)

type Instance

type Instance [1]gdclass.UPNPDevice

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddPortMapping

func (self Instance) AddPortMapping(port int) int

Adds a port mapping to forward the given external port on this UPNPDevice for the given protocol to the local machine. See UPNP.AddPortMapping.

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsUPNPDevice

func (self Instance) AsUPNPDevice() Instance

func (Instance) DeletePortMapping

func (self Instance) DeletePortMapping(port int) int

Deletes the port mapping identified by the given port and protocol combination on this device. See UPNP.DeletePortMapping.

func (Instance) DescriptionUrl

func (self Instance) DescriptionUrl() string

URL to the device description.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IgdControlUrl

func (self Instance) IgdControlUrl() string

IDG control URL.

func (Instance) IgdOurAddr

func (self Instance) IgdOurAddr() string

Address of the local machine in the network connecting it to this UPNPDevice.

func (Instance) IgdServiceType

func (self Instance) IgdServiceType() string

IGD service type.

func (Instance) IgdStatus

func (self Instance) IgdStatus() IGDStatus

IGD status.

func (Instance) IsValidGateway

func (self Instance) IsValidGateway() bool

Returns true if this is a valid IGD (InternetGatewayDevice) which potentially supports port forwarding.

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (Instance) QueryExternalAddress

func (self Instance) QueryExternalAddress() string

Returns the external IP address of this UPNPDevice or an empty string.

func (Instance) ServiceType

func (self Instance) ServiceType() string

Service type.

func (Instance) SetDescriptionUrl

func (self Instance) SetDescriptionUrl(value string)

SetDescriptionUrl sets the property returned by [GetDescriptionUrl].

func (Instance) SetIgdControlUrl

func (self Instance) SetIgdControlUrl(value string)

SetIgdControlUrl sets the property returned by [GetIgdControlUrl].

func (Instance) SetIgdOurAddr

func (self Instance) SetIgdOurAddr(value string)

SetIgdOurAddr sets the property returned by [GetIgdOurAddr].

func (Instance) SetIgdServiceType

func (self Instance) SetIgdServiceType(value string)

SetIgdServiceType sets the property returned by [GetIgdServiceType].

func (Instance) SetIgdStatus

func (self Instance) SetIgdStatus(value IGDStatus)

SetIgdStatus sets the property returned by [GetIgdStatus].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetServiceType

func (self Instance) SetServiceType(value string)

SetServiceType sets the property returned by [GetServiceType].

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type MoreArgs

type MoreArgs [1]gdclass.UPNPDevice

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) AddPortMapping

func (self MoreArgs) AddPortMapping(port int, port_internal int, desc string, proto string, duration int) int

Adds a port mapping to forward the given external port on this UPNPDevice for the given protocol to the local machine. See UPNP.AddPortMapping.

func (MoreArgs) DeletePortMapping

func (self MoreArgs) DeletePortMapping(port int, proto string) int

Deletes the port mapping identified by the given port and protocol combination on this device. See UPNP.DeletePortMapping.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL