From 28a8da2fb38e28c1bdb9b2018de183296d452669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Thu, 24 Nov 2016 23:15:05 -0500 Subject: [PATCH] Don't grab addresses from public remotes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- client.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/client.go b/client.go index 3efc5377c40b..0aaee2b465d9 100644 --- a/client.go +++ b/client.go @@ -330,16 +330,24 @@ func NewClientFromInfo(info ConnectInfo) (*Client, error) { func (c *Client) Addresses() ([]string, error) { addresses := make([]string, 0) - serverStatus, err := c.ServerStatus() - if err != nil { - return nil, err - } - if c.Transport == "unix" { + serverStatus, err := c.ServerStatus() + if err != nil { + return nil, err + } + addresses = serverStatus.Environment.Addresses } else if c.Transport == "https" { addresses = append(addresses, c.BaseURL[8:]) - addresses = append(addresses, serverStatus.Environment.Addresses...) + + if !c.Remote.Public { + serverStatus, err := c.ServerStatus() + if err != nil { + return nil, err + } + + addresses = append(addresses, serverStatus.Environment.Addresses...) + } } else { return nil, fmt.Errorf("unknown transport type: %s", c.Transport) }