|
|
|
@ -346,13 +346,18 @@ func NewClient(config *Config) (*Client, error) {
|
|
|
|
|
config.HttpClient = defConfig.HttpClient |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if parts := strings.SplitN(config.Address, "unix://", 2); len(parts) == 2 { |
|
|
|
|
trans := cleanhttp.DefaultTransport() |
|
|
|
|
trans.Dial = func(_, _ string) (net.Conn, error) { |
|
|
|
|
return net.Dial("unix", parts[1]) |
|
|
|
|
} |
|
|
|
|
config.HttpClient = &http.Client{ |
|
|
|
|
Transport: trans, |
|
|
|
|
parts := strings.SplitN(config.Address, "://", 2) |
|
|
|
|
if len(parts) == 2 { |
|
|
|
|
if parts[0] == "https" { |
|
|
|
|
config.Scheme = "https" |
|
|
|
|
} else if parts[0] == "unix" { |
|
|
|
|
trans := cleanhttp.DefaultTransport() |
|
|
|
|
trans.Dial = func(_, _ string) (net.Conn, error) { |
|
|
|
|
return net.Dial("unix", parts[1]) |
|
|
|
|
} |
|
|
|
|
config.HttpClient = &http.Client{ |
|
|
|
|
Transport: trans, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
config.Address = parts[1] |
|
|
|
|
} |
|
|
|
|