fastupnp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 8 Imported by: 0

README

fastupnp

fastupnp is the fastest UPnP library for Go, which allows you to open and close ports on your router! Also, you can see your public address :)

This project was inspired by goupnp and go-ssdp

Installation

go get -u github.com/alex-gubin/fastupnp

Usage

import "github.com/alex-gubin/fastupnp"

//initializes internet gateway device
device := fastupnp.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()

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

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
}

func InitDevice

func InitDevice() (*Device, error)

func (*Device) Close

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

func (*Device) Forward

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

func (*Device) Location

func (d *Device) Location() string

func (*Device) PublicIP

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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