Set ServerName (SNI) to *hostname. Useful for spoofing our way through restrictive gateways.

This commit is contained in:
ip-rw
2022-08-26 20:41:34 +01:00
parent bea454040d
commit a64df5e37c
3 changed files with 6 additions and 1 deletions
+4
View File
@@ -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")
+1 -1
View File
@@ -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)
}
+1
View File
@@ -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)