status-go/vendor/github.com/jackpal/go-nat-pmp
RichΛrd 40359f9c1b
go-waku integration (#2247)
* Adding wakunode module
* Adding wakuv2 fleet files
* Add waku fleets to update-fleet-config script
* Adding config items for waku v2
* Conditionally start waku v2 node depending on config
* Adapting common code to use go-waku
* Setting log level to info
* update dependencies
* update fleet config to use WakuNodes instead of BootNodes
* send and receive messages
* use hash returned when publishing a message
* add waku store protocol
* trigger signal after receiving store messages
* exclude linting rule SA1019 to check deprecated packages
2021-06-16 16:19:45 -04:00
..
.travis.yml go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
LICENSE Initial refactoring + vendor update (after rebase) 2016-09-15 06:12:25 +03:00
README.md go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
natpmp.go go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
network.go go-waku integration (#2247) 2021-06-16 16:19:45 -04:00
recorder.go go-waku integration (#2247) 2021-06-16 16:19:45 -04:00

README.md

go-nat-pmp

A Go language client for the NAT-PMP internet protocol for port mapping and discovering the external IP address of a firewall.

NAT-PMP is supported by Apple brand routers and open source routers like Tomato and DD-WRT.

See https://tools.ietf.org/rfc/rfc6886.txt

Build Status

Get the package

# Get the go-nat-pmp package.
go get -u github.com/jackpal/go-nat-pmp

Usage

Get one more package, used by the example code:

go get -u github.com/jackpal/gateway

Create a directory:

cd ~/go
mkdir -p src/hello
cd src/hello

Create a file hello.go with these contents:

package main

import (
    "fmt"

    "github.com/jackpal/gateway"
    natpmp "github.com/jackpal/go-nat-pmp"
)

func main() {
    gatewayIP, err := gateway.DiscoverGateway()
    if err != nil {
        return
    }

    client := natpmp.NewClient(gatewayIP)
    response, err := client.GetExternalAddress()
    if err != nil {
        return
    }
    fmt.Printf("External IP address: %v\n", response.ExternalIPAddress)
}

Build the example

go build
./hello

External IP address: [www xxx yyy zzz]

Clients

This library is used in the Taipei Torrent BitTorrent client http://github.com/jackpal/Taipei-Torrent

Complete documentation

http://godoc.org/github.com/jackpal/go-nat-pmp

License

This project is licensed under the Apache License 2.0.