aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/bootnode/main.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2016-11-23 03:52:31 +0800
committerFelix Lange <fjl@twurst.com>2016-11-23 05:21:18 +0800
commite5edd3b983189790391dca5b2ae4a0e460cb7f42 (patch)
treefee7b38c781ccd8eb57f68c59a1142c53c9c8dcd /cmd/bootnode/main.go
parenta47341cf96498332e2f0f67c1a6456c67831a5d0 (diff)
downloadgo-tangerine-e5edd3b983189790391dca5b2ae4a0e460cb7f42.tar.gz
go-tangerine-e5edd3b983189790391dca5b2ae4a0e460cb7f42.tar.zst
go-tangerine-e5edd3b983189790391dca5b2ae4a0e460cb7f42.zip
cmd/bootnode, cmd/geth, cmd/bzzd: add --netrestrict
Diffstat (limited to 'cmd/bootnode/main.go')
-rw-r--r--cmd/bootnode/main.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/cmd/bootnode/main.go b/cmd/bootnode/main.go
index abecac3d8..9b5ba1936 100644
--- a/cmd/bootnode/main.go
+++ b/cmd/bootnode/main.go
@@ -29,6 +29,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"
)
func main() {
@@ -39,6 +40,7 @@ func main() {
nodeKeyFile = flag.String("nodekey", "", "private key filename")
nodeKeyHex = flag.String("nodekeyhex", "", "private key as hex (for testing)")
natdesc = flag.String("nat", "none", "port mapping mechanism (any|none|upnp|pmp|extip:<IP>)")
+ netrestrict = flag.String("netrestrict", "", "restrict network communication to the given IP networks (CIDR masks)")
runv5 = flag.Bool("v5", false, "run a v5 topic discovery bootnode")
nodeKey *ecdsa.PrivateKey
@@ -81,12 +83,20 @@ func main() {
os.Exit(0)
}
+ var restrictList *netutil.Netlist
+ if *netrestrict != "" {
+ restrictList, err = netutil.ParseNetlist(*netrestrict)
+ if err != nil {
+ utils.Fatalf("-netrestrict: %v", err)
+ }
+ }
+
if *runv5 {
- if _, err := discv5.ListenUDP(nodeKey, *listenAddr, natm, ""); err != nil {
+ if _, err := discv5.ListenUDP(nodeKey, *listenAddr, natm, "", restrictList); err != nil {
utils.Fatalf("%v", err)
}
} else {
- if _, err := discover.ListenUDP(nodeKey, *listenAddr, natm, ""); err != nil {
+ if _, err := discover.ListenUDP(nodeKey, *listenAddr, natm, "", restrictList); err != nil {
utils.Fatalf("%v", err)
}
}