adapt cmd/cli to new backend

- new flag nat for nat support UPNP|PMP
- new flag pmp for PMP gateway IP
- add NatType to utils/cmd to get p2p.NAT from nat type string
- obsolete usepnp flag
- get rid of IsUpToDate and sleep in miner start
- ethereum constructor takes nat type, port, maxpeer
- add pubkey arg to client identity
pull/205/head
zelig 10 years ago
parent e77b720ead
commit 61940b2275
  1. 5
      cmd/ethereum/flags.go
  2. 9
      cmd/utils/cmd.go

@ -85,8 +85,13 @@ func Init() {
flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use") flag.StringVar(&KeyRing, "keyring", "", "identifier for keyring to use")
flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)") flag.StringVar(&KeyStore, "keystore", "db", "system to store keyrings: db|file (db)")
flag.StringVar(&OutboundPort, "port", "30303", "listening port") flag.StringVar(&OutboundPort, "port", "30303", "listening port")
<<<<<<< HEAD
flag.StringVar(&NatType, "nat", "", "nat support (UPNP|PMP)") flag.StringVar(&NatType, "nat", "", "nat support (UPNP|PMP)")
flag.StringVar(&PMPGateway, "gateway", "", "PMP gateway IP") flag.StringVar(&PMPGateway, "gateway", "", "PMP gateway IP")
=======
flag.StringVar(&NatType, "nat", "", "NAT support (UPNP|PMP) (none)")
flag.StringVar(&PMPGateway, "pmp", "", "Gateway IP for PMP")
>>>>>>> adapt cmd/cli to new backend
flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers") flag.IntVar(&MaxPeer, "maxpeer", 10, "maximum desired peers")
flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on") flag.IntVar(&RpcPort, "rpcport", 8080, "port to start json-rpc server on")
flag.BoolVar(&StartRpc, "rpc", false, "start rpc server") flag.BoolVar(&StartRpc, "rpc", false, "start rpc server")

@ -154,13 +154,22 @@ func NatType(natType string, gateway string) (nat p2p.NAT) {
nat = p2p.UPNP() nat = p2p.UPNP()
case "PMP": case "PMP":
ip := net.ParseIP(gateway) ip := net.ParseIP(gateway)
<<<<<<< HEAD
if ip != nil { if ip != nil {
clilogger.Fatalf("bad PMP gateway '%s'", gateway) clilogger.Fatalf("bad PMP gateway '%s'", gateway)
=======
if ip == nil {
clilogger.Fatalln("cannot resolve PMP gateway IP %s", gateway)
>>>>>>> adapt cmd/cli to new backend
} }
nat = p2p.PMP(ip) nat = p2p.PMP(ip)
case "": case "":
default: default:
<<<<<<< HEAD
clilogger.Fatalf("unrecognised NAT type '%s'", natType) clilogger.Fatalf("unrecognised NAT type '%s'", natType)
=======
clilogger.Fatalln("unrecognised NAT type %s", natType)
>>>>>>> adapt cmd/cli to new backend
} }
return return
} }

Loading…
Cancel
Save