зеркало из https://github.com/microsoft/docker.git
client: Expose DaemonHost to client users
This commit exposes `Client.host` as `Client.DaemonHost()` This allows users of the client, a CLI for example, to query the Host that the client is attempting to contact and vary their behaviour accordingly. For example, to allow client-side configuration of HTTP proxy settings for a number of different docker hosts. Signed-off-by: Dave Tucker <dt@docker.com>
This commit is contained in:
Родитель
6f6ee6fd04
Коммит
6ce6ae1cd1
|
@ -247,6 +247,12 @@ func (cli *Client) UpdateClientVersion(v string) {
|
|||
|
||||
}
|
||||
|
||||
// DaemonHost returns the host associated with this instance of the Client.
|
||||
// This operation doesn't acquire a mutex.
|
||||
func (cli *Client) DaemonHost() string {
|
||||
return cli.host
|
||||
}
|
||||
|
||||
// ParseHost verifies that the given host strings is valid.
|
||||
func ParseHost(host string) (string, string, string, error) {
|
||||
protoAddrParts := strings.SplitN(host, "://", 2)
|
||||
|
|
|
@ -31,6 +31,7 @@ type CommonAPIClient interface {
|
|||
SystemAPIClient
|
||||
VolumeAPIClient
|
||||
ClientVersion() string
|
||||
DaemonHost() string
|
||||
ServerVersion(ctx context.Context) (types.Version, error)
|
||||
UpdateClientVersion(v string)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче