The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
woop/internal/configs/node/network.go

125 lines
3.7 KiB

package nodeconfig
var (
mainnetBootNodes = []string{
"/ip4/100.26.90.187/tcp/9874/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv",
"/ip4/54.213.43.194/tcp/9874/p2p/QmZJJx6AdaoEkGLrYG4JeLCKeCKDjnFz2wfHNHxAqFSGA9",
"/ip4/13.113.101.219/tcp/12019/p2p/QmQayinFSgMMw5cSpDUiD9pQ2WeP6WNmGxpZ6ou3mdVFJX",
"/ip4/99.81.170.167/tcp/12019/p2p/QmRVbTpEYup8dSaURZfF6ByrMTSKa4UyUzJhSjahFzRqNj",
}
testnetBootNodes = []string{
"/ip4/54.86.126.90/tcp/9867/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv",
"/ip4/52.40.84.2/tcp/9867/p2p/QmbPVwrqWsTYXq1RxGWcxx9SWaTUCfoo1wA6wmdbduWe29",
}
pangaeaBootNodes = []string{
"/ip4/52.40.84.2/tcp/9800/p2p/QmbPVwrqWsTYXq1RxGWcxx9SWaTUCfoo1wA6wmdbduWe29",
"/ip4/54.86.126.90/tcp/9800/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv",
}
partnerBootNodes = []string{
"/ip4/52.40.84.2/tcp/9800/p2p/QmbPVwrqWsTYXq1RxGWcxx9SWaTUCfoo1wA6wmdbduWe29",
"/ip4/54.86.126.90/tcp/9800/p2p/Qmdfjtk6hPoyrH1zVD9PEH4zfWLo38dP2mDvvKXfh3tnEv",
}
stressBootNodes = []string{
"/ip4/52.40.84.2/tcp/9842/p2p/QmbPVwrqWsTYXq1RxGWcxx9SWaTUCfoo1wA6wmdbduWe29",
}
devnetBootNodes = []string{}
)
const (
mainnetDNSZone = "t.hmny.io"
testnetDNSZone = "b.hmny.io"
pangaeaDNSZone = "os.hmny.io"
partnerDNSZone = "ps.hmny.io"
stressnetDNSZone = "stn.hmny.io"
)
const (
// DefaultLocalListenIP is the IP used for local hosting
DefaultLocalListenIP = "127.0.0.1"
// DefaultPublicListenIP is the IP used for public hosting
DefaultPublicListenIP = "0.0.0.0"
// 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
// DefaultRPCPort is the default rpc port. The actual port used is 9000+500
DefaultRPCPort = 9500
// DefaultRosettaPort is the default rosetta port. The actual port used is 9000+700
DefaultRosettaPort = 9700
// DefaultWSPort is the default port for web socket endpoint. The actual port used is
DefaultWSPort = 9800
)
const (
// rpcHTTPPortOffset is the port offset for RPC HTTP requests
rpcHTTPPortOffset = 500
// rpcHTTPPortOffset is the port offset for rosetta HTTP requests
rosettaHTTPPortOffset = 700
// rpcWSPortOffSet is the port offset for RPC websocket requests
rpcWSPortOffSet = 800
)
// GetDefaultBootNodes get the default bootnode with the given network type
func GetDefaultBootNodes(networkType NetworkType) []string {
switch networkType {
case Mainnet:
return mainnetBootNodes
case Testnet:
return testnetBootNodes
case Pangaea:
return pangaeaBootNodes
case Partner:
return partnerBootNodes
case Stressnet:
return stressBootNodes
case Devnet:
return devnetBootNodes
}
return nil
}
// GetDefaultDNSZone get the default DNS zone with the given network type
func GetDefaultDNSZone(networkType NetworkType) string {
switch networkType {
case Mainnet:
return mainnetDNSZone
case Testnet:
return testnetDNSZone
case Pangaea:
return pangaeaDNSZone
case Partner:
return partnerDNSZone
case Stressnet:
return stressnetDNSZone
}
return ""
}
// GetDefaultDNSPort get the default DNS port for the given network type
func GetDefaultDNSPort(NetworkType) int {
return DefaultDNSPort
}
// GetRPCHTTPPortFromBase return the rpc HTTP port from base port
func GetRPCHTTPPortFromBase(basePort int) int {
return basePort + rpcHTTPPortOffset
}
// GetRosettaHTTPPortFromBase return the rosetta HTTP port from base port
func GetRosettaHTTPPortFromBase(basePort int) int {
return basePort + rosettaHTTPPortOffset
}
// GetWSPortFromBase return the Websocket port from the base port
func GetWSPortFromBase(basePort int) int {
return basePort + rpcWSPortOffSet
}