aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/bootnode/main.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-13 18:38:34 +0800
committerFelix Lange <fjl@twurst.com>2015-02-13 18:39:32 +0800
commit170eb3ac684231dc2ddebc34e7006e0f2b5fc0c1 (patch)
tree01ccbe10fb2bfec738b3a3584f7999a01f9fbdd5 /cmd/bootnode/main.go
parent82f0bd9009d8d577c86e800e9673a1972117113d (diff)
downloadgo-tangerine-170eb3ac684231dc2ddebc34e7006e0f2b5fc0c1.tar
go-tangerine-170eb3ac684231dc2ddebc34e7006e0f2b5fc0c1.tar.gz
go-tangerine-170eb3ac684231dc2ddebc34e7006e0f2b5fc0c1.tar.bz2
go-tangerine-170eb3ac684231dc2ddebc34e7006e0f2b5fc0c1.tar.lz
go-tangerine-170eb3ac684231dc2ddebc34e7006e0f2b5fc0c1.tar.xz
go-tangerine-170eb3ac684231dc2ddebc34e7006e0f2b5fc0c1.tar.zst
go-tangerine-170eb3ac684231dc2ddebc34e7006e0f2b5fc0c1.zip
p2p/discover: map listening port using configured mechanism
Diffstat (limited to 'cmd/bootnode/main.go')
-rw-r--r--cmd/bootnode/main.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go
index fd96a7b48..dda9f34d4 100644
--- a/cmd/bootnode/main.go
+++ b/cmd/bootnode/main.go
@@ -30,6 +30,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p/discover"
+ "github.com/ethereum/go-ethereum/p2p/nat"
)
func main() {
@@ -38,8 +39,10 @@ func main() {
genKey = flag.String("genkey", "", "generate a node key and quit")
nodeKeyFile = flag.String("nodekey", "", "private key filename")
nodeKeyHex = flag.String("nodekeyhex", "", "private key as hex (for testing)")
- nodeKey *ecdsa.PrivateKey
- err error
+ natdesc = flag.String("nat", "none", "port mapping mechanism (any|none|upnp|pmp|extip:<IP>)")
+
+ nodeKey *ecdsa.PrivateKey
+ err error
)
flag.Parse()
logger.AddLogSystem(logger.NewStdLogSystem(os.Stdout, log.LstdFlags, logger.DebugLevel))
@@ -49,6 +52,10 @@ func main() {
os.Exit(0)
}
+ natm, err := nat.Parse(*natdesc)
+ if err != nil {
+ log.Fatalf("-nat: %v", err)
+ }
switch {
case *nodeKeyFile == "" && *nodeKeyHex == "":
log.Fatal("Use -nodekey or -nodekeyhex to specify a private key")
@@ -64,7 +71,7 @@ func main() {
}
}
- if _, err := discover.ListenUDP(nodeKey, *listenAddr); err != nil {
+ if _, err := discover.ListenUDP(nodeKey, *listenAddr, natm); err != nil {
log.Fatal(err)
}
select {}