upnp

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: MIT Imports: 8 Imported by: 0

README

Turbo-UPnP

Go Reference

Installation

Remember to enable UPnP on your router!

go get -u github.com/DeNetPRO/turbo-upnp

Usage

import upnp "github.com/DeNetPRO/turbo-upnp"

//initializes internet gateway device
device := upnp.InitDevice()

// forward port
description := "test"
port := 9999
device.Forward(port, description)

Image alt

// close port 
device.Close(port)

// get your public ip 
ip := device.PublicIP()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	// contains filtered or unexported fields
}

Device contains real location your router (ip address) and clientURL. ClientURl is address, where we will send requests

func InitDevice

func InitDevice() (*Device, error)

Initialisation device, which is detected by ssdp

func (*Device) Close

func (d *Device) Close(port int) error

Close ports on the router

func (*Device) Forward

func (d *Device) Forward(port int, mapDescription string) error

Forward opens ports on the router

func (*Device) Location

func (d *Device) Location() string

Internet Gateway Device address

func (*Device) PublicIP

func (d *Device) PublicIP() (string, error)

Real public IP address

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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