storage/transport/transport.go
Vasiliy Tolstov 83f9fa19ad initial import
Signed-off-by: Vasiliy Tolstov <v.tolstov@selfip.ru>
2018-03-22 13:38:56 +03:00

28 lines
583 B
Go

package transport
import (
"errors"
"net"
"time"
)
func DialTimeout(network string, address string, timeout time.Duration) (net.Conn, error) {
switch network {
// case "utp":
// return utp.DialTimeout(address, timeout)
case "tcp":
return net.DialTimeout("tcp", address, timeout)
}
return nil, errors.New("unsupported network")
}
func Listen(network string, laddr string) (net.Listener, error) {
switch network {
// case "utp":
// return utp.NewSocket("udp", laddr)
case "tcp":
return net.Listen(network, laddr)
}
return nil, errors.New("unsupported network")
}