diff options
Diffstat (limited to 'Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go b/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go index 8ce4e8342..7d9fb604e 100644 --- a/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go +++ b/Godeps/_workspace/src/github.com/jackpal/go-nat-pmp/natpmp.go @@ -2,6 +2,7 @@ package natpmp import ( "fmt" + "github.com/jackpal/gateway" "log" "net" "time" @@ -36,6 +37,17 @@ func NewClient(gateway net.IP) (nat *Client) { return &Client{gateway} } +// Create a NAT-PMP client for the NAT-PMP server at the default gateway. +func NewClientForDefaultGateway() (nat *Client, err error) { + var g net.IP + g, err = gateway.DiscoverGateway() + if err != nil { + return + } + nat = NewClient(g) + return +} + // Results of the NAT-PMP GetExternalAddress operation type GetExternalAddressResult struct { SecondsSinceStartOfEpoc uint32 |