UPNPDevice

package
v0.0.0-...-ff35923 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Universal Plug and Play (UPnP) device. See graphics.gd/classdb/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 [1]gdclass.UPNPDevice

func (Expanded) AddPortMapping

func (self Expanded) 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 graphics.gd/classdb/UPNPDevice for the given protocol to the local machine. See graphics.gd/classdb/UPNP.Instance.AddPortMapping.

func (Expanded) DeletePortMapping

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

Deletes the port mapping identified by the given port and protocol combination on this device. See graphics.gd/classdb/UPNP.Instance.DeletePortMapping.

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 graphics.gd/classdb/UPNPDevice for the given protocol to the local machine. See graphics.gd/classdb/UPNP.Instance.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 graphics.gd/classdb/UPNP.Instance.DeletePortMapping.

func (Instance) DescriptionUrl

func (self Instance) DescriptionUrl() string

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IgdControlUrl

func (self Instance) IgdControlUrl() string

func (Instance) IgdOurAddr

func (self Instance) IgdOurAddr() string

func (Instance) IgdServiceType

func (self Instance) IgdServiceType() string

func (Instance) IgdStatus

func (self Instance) IgdStatus() IGDStatus

func (Instance) IsValidGateway

func (self Instance) IsValidGateway() bool

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

func (Instance) QueryExternalAddress

func (self Instance) QueryExternalAddress() string

Returns the external IP address of this graphics.gd/classdb/UPNPDevice or an empty string.

func (Instance) ServiceType

func (self Instance) ServiceType() string

func (Instance) SetDescriptionUrl

func (self Instance) SetDescriptionUrl(value string)

func (Instance) SetIgdControlUrl

func (self Instance) SetIgdControlUrl(value string)

func (Instance) SetIgdOurAddr

func (self Instance) SetIgdOurAddr(value string)

func (Instance) SetIgdServiceType

func (self Instance) SetIgdServiceType(value string)

func (Instance) SetIgdStatus

func (self Instance) SetIgdStatus(value IGDStatus)

func (*Instance) SetObject

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

func (Instance) SetServiceType

func (self Instance) SetServiceType(value string)

func (Instance) Virtual

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

Jump to

Keyboard shortcuts

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