api: create fresh http client for unix sockets (#8602)
Co-authored-by: Matt Keeler <mkeeler@users.noreply.github.com>
This commit is contained in:
parent
581f19b9d4
commit
99b822c4b3
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:improvement
|
||||||
|
api: Allow for the client to use TLS over a Unix domain socket.
|
||||||
|
```
|
|
@ -607,9 +607,11 @@ func NewClient(config *Config) (*Client, error) {
|
||||||
trans.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) {
|
trans.DialContext = func(_ context.Context, _, _ string) (net.Conn, error) {
|
||||||
return net.Dial("unix", parts[1])
|
return net.Dial("unix", parts[1])
|
||||||
}
|
}
|
||||||
config.HttpClient = &http.Client{
|
httpClient, err := NewHttpClient(trans, config.TLSConfig)
|
||||||
Transport: trans,
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
}
|
}
|
||||||
|
config.HttpClient = httpClient
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("Unknown protocol scheme: %s", parts[0])
|
return nil, fmt.Errorf("Unknown protocol scheme: %s", parts[0])
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue