Cleaned up some of that util
This commit is contained in:
@@ -17,10 +17,10 @@ type SimpleClientIdentity struct {
|
||||
customIdentifier string
|
||||
os string
|
||||
implementation string
|
||||
pubkey string
|
||||
pubkey []byte
|
||||
}
|
||||
|
||||
func NewSimpleClientIdentity(clientIdentifier string, version string, customIdentifier string, pubkey string) *SimpleClientIdentity {
|
||||
func NewSimpleClientIdentity(clientIdentifier string, version string, customIdentifier string, pubkey []byte) *SimpleClientIdentity {
|
||||
clientIdentity := &SimpleClientIdentity{
|
||||
clientIdentifier: clientIdentifier,
|
||||
version: version,
|
||||
|
23
p2p/nat.go
Normal file
23
p2p/nat.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package p2p
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
func ParseNAT(natType string, gateway string) (nat NAT, err error) {
|
||||
switch natType {
|
||||
case "UPNP":
|
||||
nat = UPNP()
|
||||
case "PMP":
|
||||
ip := net.ParseIP(gateway)
|
||||
if ip == nil {
|
||||
return nil, fmt.Errorf("cannot resolve PMP gateway IP %s", gateway)
|
||||
}
|
||||
nat = PMP(ip)
|
||||
case "":
|
||||
default:
|
||||
return nil, fmt.Errorf("unrecognised NAT type '%s'", natType)
|
||||
}
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user