mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-05 09:14:28 +00:00
da20785685
Former-commit-id: 23f542f43b4b493e38f5aa4c29788ed93a63b43b [formerly 71b23a6a28eb045fcfeab6329de69f1e5455486b] Former-commit-id: d12b3a6decc876f010a71f98e11df7387c1aaf2a |
||
---|---|---|
.. | ||
LICENSE | ||
natpmp.go | ||
network.go | ||
README.md | ||
recorder.go |
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 http://tools.ietf.org/html/draft-cheshire-nat-pmp-03
Get the package
go get -u github.com/jackpal/go-nat-pmp
Usage
import (
"github.com/jackpal/gateway"
natpmp "github.com/jackpal/go-nat-pmp"
)
gatewayIP, err = gateway.DiscoverGateway()
if err != nil {
return
}
client := natpmp.NewClient(gatewayIP)
response, err := client.GetExternalAddress()
if err != nil {
return
}
print("External IP address:", response.ExternalIPAddress)
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.