Do not check bindaddress when not using the server

This commit is contained in:
Wim 2016-07-17 22:15:19 +02:00
parent 6991d85da9
commit 5fe4b749cf

View File

@ -60,15 +60,15 @@ type Config struct {
// New Mattermost client. // New Mattermost client.
func New(url string, config Config) *Client { func New(url string, config Config) *Client {
c := &Client{Url: url, In: make(chan IMessage), Out: make(chan OMessage), Config: config} c := &Client{Url: url, In: make(chan IMessage), Out: make(chan OMessage), Config: config}
_, _, err := net.SplitHostPort(c.BindAddress)
if err != nil {
log.Fatalf("incorrect bindaddress %s", c.BindAddress)
}
tr := &http.Transport{ tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: config.InsecureSkipVerify}, TLSClientConfig: &tls.Config{InsecureSkipVerify: config.InsecureSkipVerify},
} }
c.httpclient = &http.Client{Transport: tr} c.httpclient = &http.Client{Transport: tr}
if !c.DisableServer { if !c.DisableServer {
_, _, err := net.SplitHostPort(c.BindAddress)
if err != nil {
log.Fatalf("incorrect bindaddress %s", c.BindAddress)
}
go c.StartServer() go c.StartServer()
} }
return c return c