Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
c5840ce1
Commit
c5840ce1
authored
May 10, 2017
by
Péter Szilágyi
Committed by
GitHub
May 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14452 from karalabe/dual-bootnodes
cmd, node: support different bootnodes, fix default light port
parents
40976ea1
3b3989de
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
8 deletions
+32
-8
main.go
cmd/geth/main.go
+2
-0
usage.go
cmd/geth/usage.go
+2
-0
flags.go
cmd/utils/flags.go
+24
-5
defaults.go
node/defaults.go
+4
-3
No files found.
cmd/geth/main.go
View file @
c5840ce1
...
...
@@ -55,6 +55,8 @@ var (
utils
.
UnlockedAccountFlag
,
utils
.
PasswordFileFlag
,
utils
.
BootnodesFlag
,
utils
.
BootnodesV4Flag
,
utils
.
BootnodesV5Flag
,
utils
.
DataDirFlag
,
utils
.
KeyStoreDirFlag
,
utils
.
NoUSBFlag
,
...
...
cmd/geth/usage.go
View file @
c5840ce1
...
...
@@ -129,6 +129,8 @@ var AppHelpFlagGroups = []flagGroup{
Name
:
"NETWORKING"
,
Flags
:
[]
cli
.
Flag
{
utils
.
BootnodesFlag
,
utils
.
BootnodesV4Flag
,
utils
.
BootnodesV5Flag
,
utils
.
ListenPortFlag
,
utils
.
MaxPeersFlag
,
utils
.
MaxPendingPeersFlag
,
...
...
cmd/utils/flags.go
View file @
c5840ce1
...
...
@@ -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
}
...
...
node/defaults.go
View file @
c5840ce1
...
...
@@ -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
(),
},
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment