mirror of
https://github.com/mmatczuk/go-http-tunnel.git
synced 2026-05-15 14:16:17 -06:00
Merge 53684ea401 into a75b36908f
This commit is contained in:
commit
1b19b98a31
2 changed files with 15 additions and 10 deletions
|
|
@ -42,12 +42,13 @@ type Tunnel struct {
|
|||
|
||||
// ClientConfig is a tunnel client configuration.
|
||||
type ClientConfig struct {
|
||||
ServerAddr string `yaml:"server_addr"`
|
||||
TLSCrt string `yaml:"tls_crt"`
|
||||
TLSKey string `yaml:"tls_key"`
|
||||
RootCA string `yaml:"root_ca"`
|
||||
Backoff BackoffConfig `yaml:"backoff"`
|
||||
Tunnels map[string]*Tunnel `yaml:"tunnels"`
|
||||
ServerAddr string `yaml:"server_addr"`
|
||||
ServerHostname string `yaml:"server_hostname"`
|
||||
TLSCrt string `yaml:"tls_crt"`
|
||||
TLSKey string `yaml:"tls_key"`
|
||||
RootCA string `yaml:"root_ca"`
|
||||
Backoff BackoffConfig `yaml:"backoff"`
|
||||
Tunnels map[string]*Tunnel `yaml:"tunnels"`
|
||||
}
|
||||
|
||||
func loadClientConfigFromFile(file string) (*ClientConfig, error) {
|
||||
|
|
|
|||
|
|
@ -130,11 +130,15 @@ func tlsConfig(config *ClientConfig) (*tls.Config, error) {
|
|||
}
|
||||
}
|
||||
|
||||
host, _, err := net.SplitHostPort(config.ServerAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var host string
|
||||
if config.ServerHostname != "" {
|
||||
host = config.ServerHostname
|
||||
} else {
|
||||
host, _, err = net.SplitHostPort(config.ServerAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return &tls.Config{
|
||||
ServerName: host,
|
||||
Certificates: []tls.Certificate{cert},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue