mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-29 12:41:44 +00:00
Added net.go Connect()
This commit is contained in:
14
net.go
Normal file
14
net.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package common
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// protoAddr: e.g. "tcp://127.0.0.1:8080" or "unix:///tmp/test.sock"
|
||||||
|
func Connect(protoAddr string) (net.Conn, error) {
|
||||||
|
parts := strings.SplitN(protoAddr, "://", 2)
|
||||||
|
proto, address := parts[0], parts[1]
|
||||||
|
conn, err := net.Dial(proto, address)
|
||||||
|
return conn, err
|
||||||
|
}
|
Reference in New Issue
Block a user