mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 06:42:16 +00:00
15 lines
309 B
Go
15 lines
309 B
Go
|
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
|
||
|
}
|