diff --git a/client/client.go b/client/client.go index 49c7aeb..40ce1a2 100644 --- a/client/client.go +++ b/client/client.go @@ -50,6 +50,7 @@ type TLSConfig struct { CA string Cert string Key string + ServerName string } //Client represents a client instance @@ -107,6 +108,9 @@ func NewClient(c *Config) (*Client, error) { //configure tls if u.Scheme == "wss" { tc := &tls.Config{} + if c.TLS.ServerName != "" { + tc.ServerName = c.TLS.ServerName + } //certificate verification config if c.TLS.SkipVerify { client.Infof("TLS verification disabled") diff --git a/client/client_connect.go b/client/client_connect.go index b33ea5b..8841d0c 100644 --- a/client/client_connect.go +++ b/client/client_connect.go @@ -39,7 +39,7 @@ func (c *Client) connectionLoop(ctx context.Context) error { if attempt > 0 { maxAttemptVal := fmt.Sprint(maxAttempt) if maxAttempt < 0 { - maxAttemptVal = "unlimited"; + maxAttemptVal = "unlimited" } msg += fmt.Sprintf(" (Attempt: %d/%s)", attempt, maxAttemptVal) } diff --git a/main.go b/main.go index bba3e74..7490bb8 100644 --- a/main.go +++ b/main.go @@ -422,6 +422,7 @@ func client(args []string) { //move hostname onto headers if *hostname != "" { config.Headers.Set("Host", *hostname) + config.TLS.ServerName = *hostname } //ready c, err := chclient.NewClient(&config)