mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
Fix: tls server name missing in vmess
This commit is contained in:
parent
c04f3748c3
commit
a52f29acda
|
@ -75,7 +75,8 @@ func NewVmess(option VmessOption) (*Vmess, error) {
|
|||
AlterID: uint16(option.AlterID),
|
||||
Security: security,
|
||||
TLS: option.TLS,
|
||||
Host: net.JoinHostPort(option.Server, strconv.Itoa(option.Port)),
|
||||
HostName: option.Server,
|
||||
Port: strconv.Itoa(option.Port),
|
||||
NetWork: option.Network,
|
||||
WebSocketPath: option.WSPath,
|
||||
SkipCertVerify: option.SkipCertVerify,
|
||||
|
|
|
@ -79,7 +79,8 @@ type Config struct {
|
|||
AlterID uint16
|
||||
Security string
|
||||
TLS bool
|
||||
Host string
|
||||
HostName string
|
||||
Port string
|
||||
NetWork string
|
||||
WebSocketPath string
|
||||
SkipCertVerify bool
|
||||
|
@ -129,9 +130,12 @@ func NewClient(config Config) (*Client, error) {
|
|||
return nil, fmt.Errorf("Unknown network type: %s", config.NetWork)
|
||||
}
|
||||
|
||||
host := net.JoinHostPort(config.HostName, config.Port)
|
||||
|
||||
var tlsConfig *tls.Config
|
||||
if config.TLS {
|
||||
tlsConfig = &tls.Config{
|
||||
ServerName: config.HostName,
|
||||
InsecureSkipVerify: config.SkipCertVerify,
|
||||
ClientSessionCache: config.SessionCacahe,
|
||||
}
|
||||
|
@ -143,7 +147,7 @@ func NewClient(config Config) (*Client, error) {
|
|||
var wsConfig *websocketConfig
|
||||
if config.NetWork == "ws" {
|
||||
wsConfig = &websocketConfig{
|
||||
host: config.Host,
|
||||
host: host,
|
||||
path: config.WebSocketPath,
|
||||
tls: config.TLS,
|
||||
tlsConfig: tlsConfig,
|
||||
|
@ -155,7 +159,7 @@ func NewClient(config Config) (*Client, error) {
|
|||
uuid: &uid,
|
||||
security: security,
|
||||
tls: config.TLS,
|
||||
host: config.Host,
|
||||
host: host,
|
||||
wsConfig: wsConfig,
|
||||
tlsConfig: tlsConfig,
|
||||
}, nil
|
||||
|
|
Loading…
Reference in New Issue
Block a user