mirror of
https://github.com/syncthing/syncthing.git
synced 2024-11-16 02:18:44 -07:00
vendor: Bump github.com/AudriusButkevicius/go-nat-pmp
This commit is contained in:
parent
a0ec4467fd
commit
a89d487510
48
vendor/github.com/AudriusButkevicius/go-nat-pmp/README.md
generated
vendored
48
vendor/github.com/AudriusButkevicius/go-nat-pmp/README.md
generated
vendored
@ -1,48 +0,0 @@
|
||||
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 natpmp "github.com/jackpal/go-nat-pmp"
|
||||
|
||||
client := natpmp.NewClient(gatewayIP)
|
||||
response, err := client.GetExternalAddress()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
print("External IP address:", response.ExternalIPAddress)
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
There doesn't seem to be an easy way to programmatically determine the address of the default gateway.
|
||||
(Linux and OSX have a "routes" kernel API that can be examined to get this information, but there is
|
||||
no Go package for getting this information.)
|
||||
|
||||
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.
|
13
vendor/github.com/AudriusButkevicius/go-nat-pmp/natpmp.go
generated
vendored
13
vendor/github.com/AudriusButkevicius/go-nat-pmp/natpmp.go
generated
vendored
@ -4,8 +4,6 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/jackpal/gateway"
|
||||
)
|
||||
|
||||
// Implement the NAT-PMP protocol, typically supported by Apple routers and open source
|
||||
@ -34,17 +32,6 @@ func NewClient(gateway net.IP, timeout time.Duration) (nat *Client) {
|
||||
return &Client{gateway, timeout}
|
||||
}
|
||||
|
||||
// Create a NAT-PMP client for the NAT-PMP server at the default gateway.
|
||||
func NewClientForDefaultGateway(timeout time.Duration) (nat *Client, err error) {
|
||||
var g net.IP
|
||||
g, err = gateway.DiscoverGateway()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
nat = NewClient(g, timeout)
|
||||
return
|
||||
}
|
||||
|
||||
// Results of the NAT-PMP GetExternalAddress operation
|
||||
type GetExternalAddressResult struct {
|
||||
SecondsSinceStartOfEpoc uint32
|
||||
|
11
vendor/github.com/AudriusButkevicius/go-nat-pmp/natpmp_test.go
generated
vendored
11
vendor/github.com/AudriusButkevicius/go-nat-pmp/natpmp_test.go
generated
vendored
@ -1,11 +0,0 @@
|
||||
package natpmp
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestNatPMP(t *testing.T) {
|
||||
client, err := NewClientForDefaultGateway(0)
|
||||
if err != nil {
|
||||
t.Errorf("NewClientForDefaultGateway() = %v,%v", client, err)
|
||||
return
|
||||
}
|
||||
}
|
2
vendor/manifest
vendored
2
vendor/manifest
vendored
@ -4,7 +4,7 @@
|
||||
{
|
||||
"importpath": "github.com/AudriusButkevicius/go-nat-pmp",
|
||||
"repository": "https://github.com/AudriusButkevicius/go-nat-pmp",
|
||||
"revision": "e9d7ecafd6f4cd4f59fc45bb9a47466ce637d0fe",
|
||||
"revision": "452c97607362b2ab5a7839b8d1704f0396b640ca",
|
||||
"branch": "master"
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user