Skip to content

Commit

Permalink
cmd/utils, node: const for listen and disc ports
Browse files Browse the repository at this point in the history
  • Loading branch information
weiihann committed Mar 18, 2024
1 parent cba8264 commit 78f172e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cmd/utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -2242,6 +2242,6 @@ func setInstance(ctx *cli.Context, cfg *node.Config) {
cfg.AuthPort = node.DefaultConfig.AuthPort + cfg.Instance*100 - 100
cfg.HTTPPort = node.DefaultHTTPPort - cfg.Instance + 1
cfg.WSPort = node.DefaultWSPort + cfg.Instance*2 - 2
cfg.P2P.ListenAddr = fmt.Sprintf(":%d", 30303+cfg.Instance-1)
cfg.P2P.DiscAddr = fmt.Sprintf(":%d", 30303+cfg.Instance-1)
cfg.P2P.ListenAddr = fmt.Sprintf(":%d", node.DefaultListenPort+cfg.Instance-1)
cfg.P2P.DiscAddr = fmt.Sprintf(":%d", node.DefaultDiscPort+cfg.Instance-1)
}
17 changes: 10 additions & 7 deletions node/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package node

import (
"fmt"
"os"
"os/user"
"path/filepath"
Expand All @@ -28,12 +29,14 @@ import (
)

const (
DefaultHTTPHost = "localhost" // Default host interface for the HTTP RPC server
DefaultHTTPPort = 8545 // Default TCP port for the HTTP RPC server
DefaultWSHost = "localhost" // Default host interface for the websocket RPC server
DefaultWSPort = 8546 // Default TCP port for the websocket RPC server
DefaultAuthHost = "localhost" // Default host interface for the authenticated apis
DefaultAuthPort = 8551 // Default port for the authenticated apis
DefaultHTTPHost = "localhost" // Default host interface for the HTTP RPC server
DefaultHTTPPort = 8545 // Default TCP port for the HTTP RPC server
DefaultWSHost = "localhost" // Default host interface for the websocket RPC server
DefaultWSPort = 8546 // Default TCP port for the websocket RPC server
DefaultAuthHost = "localhost" // Default host interface for the authenticated apis
DefaultAuthPort = 8551 // Default port for the authenticated apis
DefaultListenPort = 30303 // Default port for the TCP listening address
DefaultDiscPort = 30303 // Default port for the UDP discovery address
)

const (
Expand Down Expand Up @@ -68,7 +71,7 @@ var DefaultConfig = Config{
BatchResponseMaxSize: 25 * 1000 * 1000,
GraphQLVirtualHosts: []string{"localhost"},
P2P: p2p.Config{
ListenAddr: ":30303",
ListenAddr: fmt.Sprintf(":%d", DefaultListenPort),
MaxPeers: 50,
NAT: nat.Any(),
},
Expand Down

0 comments on commit 78f172e

Please sign in to comment.