diff options
author | Felix Lange <fjl@twurst.com> | 2015-02-12 00:19:31 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-02-13 18:39:31 +0800 |
commit | d0a2e655c9599f462bb20bd49bc69b8e1e330a21 (patch) | |
tree | ebd2685477461d33b80207b5eeee2f08ade33f3a /cmd/mist | |
parent | 1543833ca0b920d38e98994367f3871867d66781 (diff) | |
download | go-tangerine-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.tar.gz go-tangerine-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.tar.zst go-tangerine-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.zip |
cmd/ethereum, cmd/mist, eth, p2p: use package p2p/nat
This deletes the old NAT implementation.
Diffstat (limited to 'cmd/mist')
-rw-r--r-- | cmd/mist/flags.go | 10 | ||||
-rw-r--r-- | cmd/mist/main.go | 25 |
2 files changed, 18 insertions, 17 deletions
diff --git a/cmd/mist/flags.go b/cmd/mist/flags.go index dd72b5043..eb280f71b 100644 --- a/cmd/mist/flags.go +++ b/cmd/mist/flags.go @@ -34,6 +34,7 @@ import ( "bitbucket.org/kardianos/osext" "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" ) @@ -41,12 +42,10 @@ var ( Identifier string KeyRing string KeyStore string - PMPGateway string StartRpc bool StartWebSockets bool RpcPort int WsPort int - NatType string OutboundPort string ShowGenesis bool AddPeer string @@ -54,6 +53,7 @@ var ( GenAddr bool BootNodes string NodeKey *ecdsa.PrivateKey + NAT nat.Interface SecretFile string ExportDir string NonInteractive bool @@ -117,7 +117,6 @@ func Init() { flag.BoolVar(&StartWebSockets, "ws", false, "start websocket server") flag.BoolVar(&NonInteractive, "y", false, "non-interactive mode (say yes to confirmations)") flag.BoolVar(&GenAddr, "genaddr", false, "create a new priv/pub key") - flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)") flag.StringVar(&SecretFile, "import", "", "imports the file given (hex or mnemonic formats)") flag.StringVar(&ExportDir, "export", "", "exports the session keyring to files in the directory given") flag.StringVar(&LogFile, "logfile", "", "log file (defaults to standard output)") @@ -132,15 +131,18 @@ 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.StringVar(&OutboundPort, "port", "30303", "listening port") - 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/mist/main.go b/cmd/mist/main.go index 4d6bac9b7..52b5e4e94 100644 --- a/cmd/mist/main.go +++ b/cmd/mist/main.go @@ -52,19 +52,18 @@ func run() error { config := utils.InitConfig(VmType, ConfigFile, Datadir, "ETH") ethereum, err := eth.New(ð.Config{ - Name: p2p.MakeName(ClientIdentifier, Version), - KeyStore: KeyStore, - DataDir: Datadir, - LogFile: LogFile, - LogLevel: LogLevel, - MaxPeers: MaxPeer, - Port: OutboundPort, - NATType: NatType, - PMPGateway: PMPGateway, - BootNodes: BootNodes, - NodeKey: NodeKey, - KeyRing: KeyRing, - Dial: true, + Name: p2p.MakeName(ClientIdentifier, Version), + KeyStore: KeyStore, + DataDir: Datadir, + LogFile: LogFile, + LogLevel: LogLevel, + MaxPeers: MaxPeer, + Port: OutboundPort, + NAT: NAT, + BootNodes: BootNodes, + NodeKey: NodeKey, + KeyRing: KeyRing, + Dial: true, }) if err != nil { mainlogger.Fatalln(err) |