2018-04-19 13:07:27 -04:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
2020-11-17 08:19:27 -05:00
|
|
|
"context"
|
2018-04-19 13:07:27 -04:00
|
|
|
"net"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
|
|
|
|
2020-11-17 08:19:27 -05:00
|
|
|
func dialer(ctx context.Context, address string) (net.Conn, error) {
|
2018-04-19 13:07:27 -04:00
|
|
|
addrParts := strings.SplitN(address, "://", 2)
|
|
|
|
if len(addrParts) != 2 {
|
|
|
|
return nil, errors.Errorf("invalid address %s", address)
|
|
|
|
}
|
2020-11-17 08:19:27 -05:00
|
|
|
var d net.Dialer
|
|
|
|
return d.DialContext(ctx, addrParts[0], addrParts[1])
|
2018-04-19 13:07:27 -04:00
|
|
|
}
|