|
@@ -4,8 +4,6 @@ import (
|
|
|
"fmt"
|
|
"fmt"
|
|
|
"net"
|
|
"net"
|
|
|
"time"
|
|
"time"
|
|
|
-
|
|
|
|
|
- "github.com/jackpal/gateway"
|
|
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
// Implement the NAT-PMP protocol, typically supported by Apple routers and open source
|
|
// 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}
|
|
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
|
|
// Results of the NAT-PMP GetExternalAddress operation
|
|
|
type GetExternalAddressResult struct {
|
|
type GetExternalAddressResult struct {
|
|
|
SecondsSinceStartOfEpoc uint32
|
|
SecondsSinceStartOfEpoc uint32
|