From 69d3607fdd482d8be1cd0e2f1e417adcde1821a1 Mon Sep 17 00:00:00 2001 From: Jacky Wang Date: Sat, 18 Jul 2020 23:47:55 -0700 Subject: [PATCH] [cmd] added more in network.go --- cmd/harmony/const.go | 3 --- cmd/harmony/network.go | 6 +++--- cmd/harmony/p2p.go | 15 +++++++++++++++ internal/configs/node/network.go | 9 +++++++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/cmd/harmony/const.go b/cmd/harmony/const.go index d194dfcc1..8dd859624 100644 --- a/cmd/harmony/const.go +++ b/cmd/harmony/const.go @@ -4,9 +4,6 @@ import nodeconfig "github.com/harmony-one/harmony/internal/configs/node" const ( defNetworkType = nodeconfig.Mainnet - - defDNSPort = 9000 - defP2PPort = 9000 ) const ( diff --git a/cmd/harmony/network.go b/cmd/harmony/network.go index c03727775..92cb65efc 100644 --- a/cmd/harmony/network.go +++ b/cmd/harmony/network.go @@ -41,12 +41,12 @@ var ( } dnsZoneFlag = cli.StringSliceFlag{ Name: "dns.zone", - Usage: "use peers from the zone for state syncing", + Usage: "use customized peers from the zone for state syncing", } dnsPortFlag = cli.IntFlag{ Name: "dns.port", DefValue: defDNSPort, - Usage: "port of dns node", + Usage: "port of customized dns node", } legacyDNSZoneFlag = cli.StringFlag{ Name: "dns_zone", @@ -62,7 +62,7 @@ var ( Name: "dns", DefValue: true, Usage: "use dns for syncing", - Deprecated: "equivalent to --dns.zone t.hmny.io", + Deprecated: "set to false only used for self discovery peers for syncing", } legacyNetworkTypeFlag = cli.StringFlag{ Name: "network_type", diff --git a/cmd/harmony/p2p.go b/cmd/harmony/p2p.go index 06ab7d0f9..b2932ba92 100644 --- a/cmd/harmony/p2p.go +++ b/cmd/harmony/p2p.go @@ -1 +1,16 @@ package main + +import "github.com/harmony-one/harmony/internal/cli" + +type p2pConfig struct { + Port int + KeyFile string +} + +var ( + p2pPortFlag = &cli.IntFlag{ + Name: "p2p.port", + Usage: "port to listen for p2p communication", + DefValue: nodeconfig., + } +) diff --git a/internal/configs/node/network.go b/internal/configs/node/network.go index 53110e5ac..8f9f747c1 100644 --- a/internal/configs/node/network.go +++ b/internal/configs/node/network.go @@ -37,7 +37,12 @@ const ( ) const ( - defaultDNSPort = 9000 + // DefaultP2PPort is the key to be used for p2p communication + DefaultP2PPort = 9000 + // DefaultDNSPort is the default DNS port. The actual port used is DNSPort - 3000. This is a + // very bad design. Will refactor later + // TODO: refactor all 9000-3000 = 6000 stuff + DefaultDNSPort = 9000 ) // GetDefaultBootNodes get the default bootnode with the given network type @@ -75,5 +80,5 @@ func GetDefaultDNSZone(networkType NetworkType) string { // GetDefaultDNSPort get the default DNS port for the given network type func GetDefaultDNSPort(NetworkType) int { - return defaultDNSPort + return DefaultDNSPort }