2017-06-08 18:17:44 +00:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
2020-07-18 21:52:29 +00:00
|
|
|
"context"
|
2017-06-08 18:17:44 +00:00
|
|
|
"net"
|
|
|
|
"strings"
|
2017-09-21 15:49:26 +00:00
|
|
|
|
|
|
|
"github.com/pkg/errors"
|
2017-06-08 18:17:44 +00:00
|
|
|
)
|
|
|
|
|
2020-07-18 21:52:29 +00:00
|
|
|
func dialer(ctx context.Context, address string) (net.Conn, error) {
|
2017-09-21 15:49:26 +00:00
|
|
|
addrParts := strings.SplitN(address, "://", 2)
|
|
|
|
if len(addrParts) != 2 {
|
|
|
|
return nil, errors.Errorf("invalid address %s", address)
|
|
|
|
}
|
2020-07-18 21:52:29 +00:00
|
|
|
var d net.Dialer
|
|
|
|
return d.DialContext(ctx, addrParts[0], addrParts[1])
|
2017-06-08 18:17:44 +00:00
|
|
|
}
|