[cmd] added more in network.go

pull/3278/head
Jacky Wang 4 years ago
parent 3259aafce0
commit 69d3607fdd
No known key found for this signature in database
GPG Key ID: 1085CE5F4FF5842C
  1. 3
      cmd/harmony/const.go
  2. 6
      cmd/harmony/network.go
  3. 15
      cmd/harmony/p2p.go
  4. 9
      internal/configs/node/network.go

@ -4,9 +4,6 @@ import nodeconfig "github.com/harmony-one/harmony/internal/configs/node"
const ( const (
defNetworkType = nodeconfig.Mainnet defNetworkType = nodeconfig.Mainnet
defDNSPort = 9000
defP2PPort = 9000
) )
const ( const (

@ -41,12 +41,12 @@ var (
} }
dnsZoneFlag = cli.StringSliceFlag{ dnsZoneFlag = cli.StringSliceFlag{
Name: "dns.zone", 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{ dnsPortFlag = cli.IntFlag{
Name: "dns.port", Name: "dns.port",
DefValue: defDNSPort, DefValue: defDNSPort,
Usage: "port of dns node", Usage: "port of customized dns node",
} }
legacyDNSZoneFlag = cli.StringFlag{ legacyDNSZoneFlag = cli.StringFlag{
Name: "dns_zone", Name: "dns_zone",
@ -62,7 +62,7 @@ var (
Name: "dns", Name: "dns",
DefValue: true, DefValue: true,
Usage: "use dns for syncing", 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{ legacyNetworkTypeFlag = cli.StringFlag{
Name: "network_type", Name: "network_type",

@ -1 +1,16 @@
package main 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.,
}
)

@ -37,7 +37,12 @@ const (
) )
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 // 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 // GetDefaultDNSPort get the default DNS port for the given network type
func GetDefaultDNSPort(NetworkType) int { func GetDefaultDNSPort(NetworkType) int {
return defaultDNSPort return DefaultDNSPort
} }

Loading…
Cancel
Save