aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/ethereum
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-02-12 00:19:31 +0800
committerFelix Lange <fjl@twurst.com>2015-02-13 18:39:31 +0800
commitd0a2e655c9599f462bb20bd49bc69b8e1e330a21 (patch)
treeebd2685477461d33b80207b5eeee2f08ade33f3a /cmd/ethereum
parent1543833ca0b920d38e98994367f3871867d66781 (diff)
downloaddexon-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.tar.gz
dexon-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.tar.zst
dexon-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.zip
cmd/ethereum, cmd/mist, eth, p2p: use package p2p/nat
This deletes the old NAT implementation.
Diffstat (limited to 'cmd/ethereum')
-rw-r--r--cmd/ethereum/flags.go11
-rw-r--r--cmd/ethereum/main.go27
2 files changed, 20 insertions, 18 deletions
diff --git a/cmd/ethereum/flags.go b/cmd/ethereum/flags.go
index 594acdf7f..99e094b47 100644
--- a/cmd/ethereum/flags.go
+++ b/cmd/ethereum/flags.go
@@ -31,6 +31,7 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/logger"
+ "github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/vm"
)
@@ -44,8 +45,6 @@ var (
StartWebSockets bool
RpcPort int
WsPort int
- NatType string
- PMPGateway string
OutboundPort string
ShowGenesis bool
AddPeer string
@@ -53,6 +52,7 @@ var (
GenAddr bool
BootNodes string
NodeKey *ecdsa.PrivateKey
+ NAT nat.Interface
SecretFile string
ExportDir string
NonInteractive bool
@@ -127,18 +127,21 @@ func Init() {
var (
nodeKeyFile = flag.String("nodekey", "", "network private key file")
nodeKeyHex = flag.String("nodekeyhex", "", "network private key (for testing)")
+ natstr = flag.String("nat", "any", "port mapping mechanism (any|none|upnp|pmp|extip:<IP>)")
)
flag.BoolVar(&Dial, "dial", true, "dial out connections (default on)")
flag.BoolVar(&SHH, "shh", true, "run whisper protocol (default on)")
flag.StringVar(&OutboundPort, "port", "30303", "listening port")
- flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)")
- flag.StringVar(&PMPGateway, "pmp", "", "Gateway IP for NAT-PMP")
+
flag.StringVar(&BootNodes, "bootnodes", "", "space-separated node URLs for discovery bootstrap")
flag.IntVar(&MaxPeer, "maxpeer", 30, "maximum desired peers")
flag.Parse()
var err error
+ if NAT, err = nat.Parse(*natstr); err != nil {
+ log.Fatalf("-nat: %v", err)
+ }
switch {
case *nodeKeyFile != "" && *nodeKeyHex != "":
log.Fatal("Options -nodekey and -nodekeyhex are mutually exclusive")
diff --git a/cmd/ethereum/main.go b/cmd/ethereum/main.go
index 3f616c094..d2b3418cd 100644
--- a/cmd/ethereum/main.go
+++ b/cmd/ethereum/main.go
@@ -62,20 +62,19 @@ func main() {
utils.InitConfig(VmType, ConfigFile, Datadir, "ETH")
ethereum, err := eth.New(&eth.Config{
- Name: p2p.MakeName(ClientIdentifier, Version),
- KeyStore: KeyStore,
- DataDir: Datadir,
- LogFile: LogFile,
- LogLevel: LogLevel,
- MaxPeers: MaxPeer,
- Port: OutboundPort,
- NATType: PMPGateway,
- PMPGateway: PMPGateway,
- KeyRing: KeyRing,
- Shh: SHH,
- Dial: Dial,
- BootNodes: BootNodes,
- NodeKey: NodeKey,
+ Name: p2p.MakeName(ClientIdentifier, Version),
+ KeyStore: KeyStore,
+ DataDir: Datadir,
+ LogFile: LogFile,
+ LogLevel: LogLevel,
+ MaxPeers: MaxPeer,
+ Port: OutboundPort,
+ NAT: NAT,
+ KeyRing: KeyRing,
+ Shh: SHH,
+ Dial: Dial,
+ BootNodes: BootNodes,
+ NodeKey: NodeKey,
})
if err != nil {