diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-05-10 22:51:52 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-05-10 22:51:52 +0800 |
commit | 3b3989de6a1db98eb5290d6a14c5354da5d7d76a (patch) | |
tree | 0ce8858a0526c7c441e4cfdf3979c097b6078fc0 | |
parent | 40976ea1a009f1358bcc6f85db97efd61868dd4f (diff) | |
download | go-tangerine-3b3989de6a1db98eb5290d6a14c5354da5d7d76a.tar go-tangerine-3b3989de6a1db98eb5290d6a14c5354da5d7d76a.tar.gz go-tangerine-3b3989de6a1db98eb5290d6a14c5354da5d7d76a.tar.bz2 go-tangerine-3b3989de6a1db98eb5290d6a14c5354da5d7d76a.tar.lz go-tangerine-3b3989de6a1db98eb5290d6a14c5354da5d7d76a.tar.xz go-tangerine-3b3989de6a1db98eb5290d6a14c5354da5d7d76a.tar.zst go-tangerine-3b3989de6a1db98eb5290d6a14c5354da5d7d76a.zip |
cmd, node: support different bootnodes, fix default light port
-rw-r--r-- | cmd/geth/main.go | 2 | ||||
-rw-r--r-- | cmd/geth/usage.go | 2 | ||||
-rw-r--r-- | cmd/utils/flags.go | 29 | ||||
-rw-r--r-- | node/defaults.go | 7 |
4 files changed, 32 insertions, 8 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 7d9760cc9..56652f3bd 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -55,6 +55,8 @@ var ( utils.UnlockedAccountFlag, utils.PasswordFileFlag, utils.BootnodesFlag, + utils.BootnodesV4Flag, + utils.BootnodesV5Flag, utils.DataDirFlag, utils.KeyStoreDirFlag, utils.NoUSBFlag, diff --git a/cmd/geth/usage.go b/cmd/geth/usage.go index 5012a4b38..c719a87b1 100644 --- a/cmd/geth/usage.go +++ b/cmd/geth/usage.go @@ -129,6 +129,8 @@ var AppHelpFlagGroups = []flagGroup{ Name: "NETWORKING", Flags: []cli.Flag{ utils.BootnodesFlag, + utils.BootnodesV4Flag, + utils.BootnodesV5Flag, utils.ListenPortFlag, utils.MaxPeersFlag, utils.MaxPendingPeersFlag, diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 8ed294cae..57fbe22c2 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -360,7 +360,17 @@ var ( } BootnodesFlag = cli.StringFlag{ Name: "bootnodes", - Usage: "Comma separated enode URLs for P2P discovery bootstrap", + Usage: "Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)", + Value: "", + } + BootnodesV4Flag = cli.StringFlag{ + Name: "bootnodesv4", + Usage: "Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)", + Value: "", + } + BootnodesV5Flag = cli.StringFlag{ + Name: "bootnodesv5", + Usage: "Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes)", Value: "", } NodeKeyFileFlag = cli.StringFlag{ @@ -469,8 +479,12 @@ func setNodeUserIdent(ctx *cli.Context, cfg *node.Config) { func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) { urls := params.MainnetBootnodes switch { - case ctx.GlobalIsSet(BootnodesFlag.Name): - urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",") + case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(BootnodesV4Flag.Name): + if ctx.GlobalIsSet(BootnodesV4Flag.Name) { + urls = strings.Split(ctx.GlobalString(BootnodesV4Flag.Name), ",") + } else { + urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",") + } case ctx.GlobalBool(TestnetFlag.Name): urls = params.TestnetBootnodes case ctx.GlobalBool(RinkebyFlag.Name): @@ -493,8 +507,12 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) { func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) { urls := params.DiscoveryV5Bootnodes switch { - case ctx.GlobalIsSet(BootnodesFlag.Name): - urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",") + case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(BootnodesV5Flag.Name): + if ctx.GlobalIsSet(BootnodesV5Flag.Name) { + urls = strings.Split(ctx.GlobalString(BootnodesV5Flag.Name), ",") + } else { + urls = strings.Split(ctx.GlobalString(BootnodesFlag.Name), ",") + } case ctx.GlobalBool(RinkebyFlag.Name): urls = params.RinkebyV5Bootnodes case cfg.BootstrapNodesV5 != nil: @@ -717,6 +735,7 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) { // --dev mode can't use p2p networking. cfg.MaxPeers = 0 cfg.ListenAddr = ":0" + cfg.DiscoveryV5Addr = ":0" cfg.NoDiscovery = true cfg.DiscoveryV5 = false } diff --git a/node/defaults.go b/node/defaults.go index d4e148683..848f08e05 100644 --- a/node/defaults.go +++ b/node/defaults.go @@ -41,9 +41,10 @@ var DefaultConfig = Config{ WSPort: DefaultWSPort, WSModules: []string{"net", "web3"}, P2P: p2p.Config{ - ListenAddr: ":30303", - MaxPeers: 25, - NAT: nat.Any(), + ListenAddr: ":30303", + DiscoveryV5Addr: ":30304", + MaxPeers: 25, + NAT: nat.Any(), }, } |