aboutsummaryrefslogtreecommitdiffstats
path: root/eth
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 /eth
parent1543833ca0b920d38e98994367f3871867d66781 (diff)
downloaddexon-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.tar
dexon-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.tar.gz
dexon-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.tar.bz2
dexon-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.tar.lz
dexon-d0a2e655c9599f462bb20bd49bc69b8e1e330a21.tar.xz
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 'eth')
-rw-r--r--eth/backend.go14
1 files changed, 5 insertions, 9 deletions
diff --git a/eth/backend.go b/eth/backend.go
index f3e4842a7..29cf7d836 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -13,6 +13,7 @@ import (
ethlogger "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/discover"
+ "github.com/ethereum/go-ethereum/p2p/nat"
"github.com/ethereum/go-ethereum/pow/ezp"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/whisper"
@@ -28,10 +29,8 @@ type Config struct {
LogLevel int
KeyRing string
- MaxPeers int
- Port string
- NATType string
- PMPGateway string
+ MaxPeers int
+ Port string
// This should be a space-separated list of
// discovery node URLs.
@@ -41,6 +40,7 @@ type Config struct {
// If nil, an ephemeral key is used.
NodeKey *ecdsa.PrivateKey
+ NAT nat.Interface
Shh bool
Dial bool
@@ -147,10 +147,6 @@ func New(config *Config) (*Ethereum, error) {
ethProto := EthProtocol(eth.txPool, eth.chainManager, eth.blockPool)
protocols := []p2p.Protocol{ethProto, eth.whisper.Protocol()}
- nat, err := p2p.ParseNAT(config.NATType, config.PMPGateway)
- if err != nil {
- return nil, err
- }
netprv := config.NodeKey
if netprv == nil {
if netprv, err = crypto.GenerateKey(); err != nil {
@@ -163,7 +159,7 @@ func New(config *Config) (*Ethereum, error) {
MaxPeers: config.MaxPeers,
Protocols: protocols,
Blacklist: eth.blacklist,
- NAT: nat,
+ NAT: config.NAT,
NoDial: !config.Dial,
BootstrapNodes: config.parseBootNodes(),
}