Fix: tls server name missing in vmess
This commit is contained in:
parent
a64cea5011
commit
dc24dd4d89
2 changed files with 9 additions and 4 deletions
|
@ -75,7 +75,8 @@ func NewVmess(option VmessOption) (*Vmess, error) {
|
||||||
AlterID: uint16(option.AlterID),
|
AlterID: uint16(option.AlterID),
|
||||||
Security: security,
|
Security: security,
|
||||||
TLS: option.TLS,
|
TLS: option.TLS,
|
||||||
Host: net.JoinHostPort(option.Server, strconv.Itoa(option.Port)),
|
HostName: option.Server,
|
||||||
|
Port: strconv.Itoa(option.Port),
|
||||||
NetWork: option.Network,
|
NetWork: option.Network,
|
||||||
WebSocketPath: option.WSPath,
|
WebSocketPath: option.WSPath,
|
||||||
SkipCertVerify: option.SkipCertVerify,
|
SkipCertVerify: option.SkipCertVerify,
|
||||||
|
|
|
@ -79,7 +79,8 @@ type Config struct {
|
||||||
AlterID uint16
|
AlterID uint16
|
||||||
Security string
|
Security string
|
||||||
TLS bool
|
TLS bool
|
||||||
Host string
|
HostName string
|
||||||
|
Port string
|
||||||
NetWork string
|
NetWork string
|
||||||
WebSocketPath string
|
WebSocketPath string
|
||||||
SkipCertVerify bool
|
SkipCertVerify bool
|
||||||
|
@ -129,9 +130,12 @@ func NewClient(config Config) (*Client, error) {
|
||||||
return nil, fmt.Errorf("Unknown network type: %s", config.NetWork)
|
return nil, fmt.Errorf("Unknown network type: %s", config.NetWork)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
host := net.JoinHostPort(config.HostName, config.Port)
|
||||||
|
|
||||||
var tlsConfig *tls.Config
|
var tlsConfig *tls.Config
|
||||||
if config.TLS {
|
if config.TLS {
|
||||||
tlsConfig = &tls.Config{
|
tlsConfig = &tls.Config{
|
||||||
|
ServerName: config.HostName,
|
||||||
InsecureSkipVerify: config.SkipCertVerify,
|
InsecureSkipVerify: config.SkipCertVerify,
|
||||||
ClientSessionCache: config.SessionCacahe,
|
ClientSessionCache: config.SessionCacahe,
|
||||||
}
|
}
|
||||||
|
@ -143,7 +147,7 @@ func NewClient(config Config) (*Client, error) {
|
||||||
var wsConfig *websocketConfig
|
var wsConfig *websocketConfig
|
||||||
if config.NetWork == "ws" {
|
if config.NetWork == "ws" {
|
||||||
wsConfig = &websocketConfig{
|
wsConfig = &websocketConfig{
|
||||||
host: config.Host,
|
host: host,
|
||||||
path: config.WebSocketPath,
|
path: config.WebSocketPath,
|
||||||
tls: config.TLS,
|
tls: config.TLS,
|
||||||
tlsConfig: tlsConfig,
|
tlsConfig: tlsConfig,
|
||||||
|
@ -155,7 +159,7 @@ func NewClient(config Config) (*Client, error) {
|
||||||
uuid: &uid,
|
uuid: &uid,
|
||||||
security: security,
|
security: security,
|
||||||
tls: config.TLS,
|
tls: config.TLS,
|
||||||
host: config.Host,
|
host: host,
|
||||||
wsConfig: wsConfig,
|
wsConfig: wsConfig,
|
||||||
tlsConfig: tlsConfig,
|
tlsConfig: tlsConfig,
|
||||||
}, nil
|
}, nil
|
||||||
|
|
Loading…
Reference in a new issue