aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/utils
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-11-25 20:59:18 +0800
committerGitHub <noreply@github.com>2016-11-25 20:59:18 +0800
commitd1a95c643eadd506f6ae85784d22c7823e411ee9 (patch)
tree7872593b296835e07a96d5bb40ddcd1f04849ea3 /cmd/utils
parent9c3ea0d32d26957fd73ddf07e37d93091de596fd (diff)
parente5edd3b983189790391dca5b2ae4a0e460cb7f42 (diff)
downloaddexon-d1a95c643eadd506f6ae85784d22c7823e411ee9.tar
dexon-d1a95c643eadd506f6ae85784d22c7823e411ee9.tar.gz
dexon-d1a95c643eadd506f6ae85784d22c7823e411ee9.tar.bz2
dexon-d1a95c643eadd506f6ae85784d22c7823e411ee9.tar.lz
dexon-d1a95c643eadd506f6ae85784d22c7823e411ee9.tar.xz
dexon-d1a95c643eadd506f6ae85784d22c7823e411ee9.tar.zst
dexon-d1a95c643eadd506f6ae85784d22c7823e411ee9.zip
Merge pull request #3325 from fjl/p2p-netrestrict
Prevent relay of invalid IPs, add --netrestrict
Diffstat (limited to 'cmd/utils')
-rw-r--r--cmd/utils/flags.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 3bb625387..5c09e44ec 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -45,6 +45,7 @@ import (
"github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/p2p/discv5"
"github.com/ethereum/go-ethereum/p2p/nat"
+ "github.com/ethereum/go-ethereum/p2p/netutil"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/rpc"
@@ -366,10 +367,16 @@ var (
Name: "v5disc",
Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism",
}
+ NetrestrictFlag = cli.StringFlag{
+ Name: "netrestrict",
+ Usage: "Restricts network communication to the given IP networks (CIDR masks)",
+ }
+
WhisperEnabledFlag = cli.BoolFlag{
Name: "shh",
Usage: "Enable Whisper",
}
+
// ATM the url is left to the user and deployment to
JSpathFlag = cli.StringFlag{
Name: "jspath",
@@ -693,6 +700,14 @@ func MakeNode(ctx *cli.Context, name, gitCommit string) *node.Node {
config.MaxPeers = 0
config.ListenAddr = ":0"
}
+ if netrestrict := ctx.GlobalString(NetrestrictFlag.Name); netrestrict != "" {
+ list, err := netutil.ParseNetlist(netrestrict)
+ if err != nil {
+ Fatalf("Option %q: %v", NetrestrictFlag.Name, err)
+ }
+ config.NetRestrict = list
+ }
+
stack, err := node.New(config)
if err != nil {
Fatalf("Failed to create the protocol stack: %v", err)