mirror of
https://github.com/tendermint/tendermint.git
synced 2026-06-01 03:46:22 +00:00
tests: bind test servers to 127.0.0.1 (#4322)
This commit is contained in:
@@ -415,8 +415,8 @@ func DefaultRPCConfig() *RPCConfig {
|
||||
// TestRPCConfig returns a configuration for testing the RPC server
|
||||
func TestRPCConfig() *RPCConfig {
|
||||
cfg := DefaultRPCConfig()
|
||||
cfg.ListenAddress = "tcp://0.0.0.0:36657"
|
||||
cfg.GRPCListenAddress = "tcp://0.0.0.0:36658"
|
||||
cfg.ListenAddress = "tcp://127.0.0.1:36657"
|
||||
cfg.GRPCListenAddress = "tcp://127.0.0.1:36658"
|
||||
cfg.Unsafe = true
|
||||
return cfg
|
||||
}
|
||||
@@ -584,7 +584,7 @@ func DefaultP2PConfig() *P2PConfig {
|
||||
// TestP2PConfig returns a configuration for testing the peer-to-peer layer
|
||||
func TestP2PConfig() *P2PConfig {
|
||||
cfg := DefaultP2PConfig()
|
||||
cfg.ListenAddress = "tcp://0.0.0.0:36656"
|
||||
cfg.ListenAddress = "tcp://127.0.0.1:36656"
|
||||
cfg.FlushThrottleTimeout = 10 * time.Millisecond
|
||||
cfg.AllowDuplicateIP = true
|
||||
return cfg
|
||||
|
||||
@@ -125,9 +125,9 @@ func randPort() int {
|
||||
|
||||
func makeAddrs() (string, string, string) {
|
||||
start := randPort()
|
||||
return fmt.Sprintf("tcp://0.0.0.0:%d", start),
|
||||
fmt.Sprintf("tcp://0.0.0.0:%d", start+1),
|
||||
fmt.Sprintf("tcp://0.0.0.0:%d", start+2)
|
||||
return fmt.Sprintf("tcp://127.0.0.1:%d", start),
|
||||
fmt.Sprintf("tcp://127.0.0.1:%d", start+1),
|
||||
fmt.Sprintf("tcp://127.0.0.1:%d", start+2)
|
||||
}
|
||||
|
||||
// getConfig returns a config for test cases
|
||||
|
||||
@@ -48,7 +48,7 @@ func NewNetAddress(id ID, addr net.Addr) *NetAddress {
|
||||
if flag.Lookup("test.v") == nil { // normal run
|
||||
panic(fmt.Sprintf("Only TCPAddrs are supported. Got: %v", addr))
|
||||
} else { // in testing
|
||||
netAddr := NewNetAddressIPPort(net.IP("0.0.0.0"), 0)
|
||||
netAddr := NewNetAddressIPPort(net.IP("127.0.0.1"), 0)
|
||||
netAddr.ID = id
|
||||
return netAddr
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import (
|
||||
|
||||
// Client and Server should work over tcp or unix sockets
|
||||
const (
|
||||
tcpAddr = "tcp://0.0.0.0:47768"
|
||||
tcpAddr = "tcp://127.0.0.1:47768"
|
||||
|
||||
unixSocket = "/tmp/rpc_test.sock"
|
||||
unixAddr = "unix://" + unixSocket
|
||||
|
||||
@@ -37,7 +37,7 @@ func main() {
|
||||
|
||||
rpcserver.RegisterRPCFuncs(mux, routes, cdc, logger)
|
||||
config := rpcserver.DefaultConfig()
|
||||
listener, err := rpcserver.Listen("0.0.0.0:8008", config)
|
||||
listener, err := rpcserver.Listen("tcp://127.0.0.1:8008", config)
|
||||
if err != nil {
|
||||
tmos.Exit(err.Error())
|
||||
}
|
||||
|
||||
@@ -85,9 +85,9 @@ func randPort() int {
|
||||
}
|
||||
|
||||
func makeAddrs() (string, string, string) {
|
||||
return fmt.Sprintf("tcp://0.0.0.0:%d", randPort()),
|
||||
fmt.Sprintf("tcp://0.0.0.0:%d", randPort()),
|
||||
fmt.Sprintf("tcp://0.0.0.0:%d", randPort())
|
||||
return fmt.Sprintf("tcp://127.0.0.1:%d", randPort()),
|
||||
fmt.Sprintf("tcp://127.0.0.1:%d", randPort()),
|
||||
fmt.Sprintf("tcp://127.0.0.1:%d", randPort())
|
||||
}
|
||||
|
||||
func createConfig() *cfg.Config {
|
||||
|
||||
Reference in New Issue
Block a user