mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-21 00:46:32 +00:00
Resolve host for NetAddressFromString(). Test fix.
This commit is contained in:
@ -170,7 +170,7 @@ func readReflect(rv reflect.Value, rt reflect.Type, r io.Reader, n *int64, err *
|
|||||||
}
|
}
|
||||||
crt, ok := typeInfo.ByteToType[typeByte]
|
crt, ok := typeInfo.ByteToType[typeByte]
|
||||||
if !ok {
|
if !ok {
|
||||||
*err = errors.New(Fmt("Unexpected type byte %X for type %v", typeByte, crt))
|
*err = errors.New(Fmt("Unexpected type byte %X for type %v", typeByte, rt))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
crv := reflect.New(crt).Elem()
|
crv := reflect.New(crt).Elem()
|
||||||
|
@ -86,6 +86,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(Fmt("Error creating barak rootDir: %v", err))
|
panic(Fmt("Error creating barak rootDir: %v", err))
|
||||||
}
|
}
|
||||||
|
barak.registries = options.Registries
|
||||||
|
|
||||||
// Write pid to file.
|
// Write pid to file.
|
||||||
err = AtomicWriteFile(barak.rootDir+"/pidfile", []byte(Fmt("%v", barak.pid)))
|
err = AtomicWriteFile(barak.rootDir+"/pidfile", []byte(Fmt("%v", barak.pid)))
|
||||||
|
@ -5,5 +5,8 @@
|
|||||||
"VotingPower": 1,
|
"VotingPower": 1,
|
||||||
"PubKey": [1,"3A2C5C341FFC1D5F7AB518519FF8289D3BFAB82DFD6E167B926FAD72C1BF10F8"]
|
"PubKey": [1,"3A2C5C341FFC1D5F7AB518519FF8289D3BFAB82DFD6E167B926FAD72C1BF10F8"]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"Registries": [
|
||||||
|
"http://navytoad.chaintest.net:46660"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,8 @@
|
|||||||
"VotingPower": 1,
|
"VotingPower": 1,
|
||||||
"PubKey": [1,"3A2C5C341FFC1D5F7AB518519FF8289D3BFAB82DFD6E167B926FAD72C1BF10F8"]
|
"PubKey": [1,"3A2C5C341FFC1D5F7AB518519FF8289D3BFAB82DFD6E167B926FAD72C1BF10F8"]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"Registries": [
|
||||||
|
"http://navytoad.chaintest.net:46660"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,8 @@
|
|||||||
"VotingPower": 1,
|
"VotingPower": 1,
|
||||||
"PubKey": [1,"3A2C5C341FFC1D5F7AB518519FF8289D3BFAB82DFD6E167B926FAD72C1BF10F8"]
|
"PubKey": [1,"3A2C5C341FFC1D5F7AB518519FF8289D3BFAB82DFD6E167B926FAD72C1BF10F8"]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"Registries": [
|
||||||
|
"http://navytoad.chaintest.net:46660"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,22 @@ func NewNetAddress(addr net.Addr) *NetAddress {
|
|||||||
return NewNetAddressIPPort(ip, port)
|
return NewNetAddressIPPort(ip, port)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Also resolves the host if host is not an IP.
|
||||||
func NewNetAddressString(addr string) *NetAddress {
|
func NewNetAddressString(addr string) *NetAddress {
|
||||||
host, portStr, err := net.SplitHostPort(addr)
|
host, portStr, err := net.SplitHostPort(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
ip := net.ParseIP(host)
|
ip := net.ParseIP(host)
|
||||||
|
if ip == nil {
|
||||||
|
if len(host) > 0 {
|
||||||
|
ips, err := net.LookupIP(host)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
ip = ips[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
port, err := strconv.ParseUint(portStr, 10, 16)
|
port, err := strconv.ParseUint(portStr, 10, 16)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Reference in New Issue
Block a user