Documentation
¶
Index ¶
- Constants
- Variables
- func WithAnyConnection(opts *NewClientOpts)
- func WithIG1WANIP1Connection1(opts *NewClientOpts)
- func WithIG1WANPPP1Connection1(opts *NewClientOpts)
- func WithIG2WANIPConnection1(opts *NewClientOpts)
- func WithIG2WANIPConnection2(opts *NewClientOpts)
- func WithIG2WANPPPConnection1(opts *NewClientOpts)
- type Client
- type GoUPnPClient
- type NewClientOpt
- type NewClientOpts
- type PortMapping
- type Protocol
Constants ¶
View Source
const ( // ProtocolUDP is the UDP Protocol. ProtocolUDP = corev1.ProtocolUDP // ProtocolTCP is the TCP Protocol. ProtocolTCP = corev1.ProtocolTCP )
Variables ¶
View Source
var ( // ErrNoClients is returned when no UPnP clients are found. ErrNoClients = errors.New("no clients found") )
Functions ¶
func WithAnyConnection ¶
func WithAnyConnection(opts *NewClientOpts)
func WithIG1WANIP1Connection1 ¶
func WithIG1WANIP1Connection1(opts *NewClientOpts)
func WithIG1WANPPP1Connection1 ¶
func WithIG1WANPPP1Connection1(opts *NewClientOpts)
func WithIG2WANIPConnection1 ¶
func WithIG2WANIPConnection1(opts *NewClientOpts)
func WithIG2WANIPConnection2 ¶
func WithIG2WANIPConnection2(opts *NewClientOpts)
func WithIG2WANPPPConnection1 ¶
func WithIG2WANPPPConnection1(opts *NewClientOpts)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper around any goupnp client to standardize the API for doing UPnP operations.
func (*Client) AddPortMapping ¶
func (c *Client) AddPortMapping(ctx context.Context, pm *PortMapping) error
GetExternalIPAddress adds the port mapping via UPnP.
func (*Client) GetExternalIPAddress ¶
GetExternalIPAddress gets the external IP address via UPnP.
func (*Client) GetServiceIPAddress ¶
GetServiceIPAddress gets the IP address of the router.
type GoUPnPClient ¶
type GoUPnPClient interface {
GetExternalIPAddressCtx(context.Context) (string, error)
GetServiceClient() *goupnp.ServiceClient
AddPortMappingCtx(
context.Context,
string,
uint16,
string,
uint16,
string,
bool,
string,
uint32,
) error
DeletePortMappingCtx(
context.Context,
string,
uint16,
string,
) error
}
type NewClientOpt ¶
type NewClientOpt func(*NewClientOpts)
func WithGoUPnPClient ¶
func WithGoUPnPClient(client GoUPnPClient) NewClientOpt
type NewClientOpts ¶
type NewClientOpts struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.