mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-01-07 09:53:58 +08:00
feat: Support insecure gRPC
This commit is contained in:
parent
fe51e95d88
commit
90bf28cb89
@ -596,15 +596,19 @@ func NewVless(option VlessOption) (*Vless, error) {
|
|||||||
Host: v.option.ServerName,
|
Host: v.option.ServerName,
|
||||||
ClientFingerprint: v.option.ClientFingerprint,
|
ClientFingerprint: v.option.ClientFingerprint,
|
||||||
}
|
}
|
||||||
tlsConfig := tlsC.GetGlobalTLSConfig(&tls.Config{
|
if option.ServerName == "" {
|
||||||
InsecureSkipVerify: v.option.SkipCertVerify,
|
gunConfig.Host = v.addr
|
||||||
ServerName: v.option.ServerName,
|
}
|
||||||
})
|
var tlsConfig *tls.Config
|
||||||
|
if option.TLS {
|
||||||
if v.option.ServerName == "" {
|
tlsConfig = tlsC.GetGlobalTLSConfig(&tls.Config{
|
||||||
host, _, _ := net.SplitHostPort(v.addr)
|
InsecureSkipVerify: v.option.SkipCertVerify,
|
||||||
tlsConfig.ServerName = host
|
ServerName: v.option.ServerName,
|
||||||
gunConfig.Host = host
|
})
|
||||||
|
if option.ServerName == "" {
|
||||||
|
host, _, _ := net.SplitHostPort(v.addr)
|
||||||
|
tlsConfig.ServerName = host
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v.gunTLSConfig = tlsConfig
|
v.gunTLSConfig = tlsConfig
|
||||||
|
@ -413,13 +413,6 @@ func NewVmess(option VmessOption) (*Vmess, error) {
|
|||||||
option.PacketAddr = false
|
option.PacketAddr = false
|
||||||
}
|
}
|
||||||
|
|
||||||
switch option.Network {
|
|
||||||
case "h2", "grpc":
|
|
||||||
if !option.TLS {
|
|
||||||
option.TLS = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
v := &Vmess{
|
v := &Vmess{
|
||||||
Base: &Base{
|
Base: &Base{
|
||||||
name: option.Name,
|
name: option.Name,
|
||||||
@ -464,15 +457,19 @@ func NewVmess(option VmessOption) (*Vmess, error) {
|
|||||||
Host: v.option.ServerName,
|
Host: v.option.ServerName,
|
||||||
ClientFingerprint: v.option.ClientFingerprint,
|
ClientFingerprint: v.option.ClientFingerprint,
|
||||||
}
|
}
|
||||||
tlsConfig := &tls.Config{
|
if option.ServerName == "" {
|
||||||
InsecureSkipVerify: v.option.SkipCertVerify,
|
gunConfig.Host = v.addr
|
||||||
ServerName: v.option.ServerName,
|
|
||||||
}
|
}
|
||||||
|
var tlsConfig *tls.Config
|
||||||
if v.option.ServerName == "" {
|
if option.TLS {
|
||||||
host, _, _ := net.SplitHostPort(v.addr)
|
tlsConfig = tlsC.GetGlobalTLSConfig(&tls.Config{
|
||||||
tlsConfig.ServerName = host
|
InsecureSkipVerify: v.option.SkipCertVerify,
|
||||||
gunConfig.Host = host
|
ServerName: v.option.ServerName,
|
||||||
|
})
|
||||||
|
if option.ServerName == "" {
|
||||||
|
host, _, _ := net.SplitHostPort(v.addr)
|
||||||
|
tlsConfig.ServerName = host
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v.gunTLSConfig = tlsConfig
|
v.gunTLSConfig = tlsConfig
|
||||||
|
@ -199,9 +199,12 @@ func NewHTTP2Client(dialFn DialFn, tlsConfig *tls.Config, Fingerprint string, re
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
wrap.remoteAddr = pconn.RemoteAddr()
|
wrap.remoteAddr = pconn.RemoteAddr()
|
||||||
|
|
||||||
|
if tlsConfig == nil {
|
||||||
|
return pconn, nil
|
||||||
|
}
|
||||||
|
|
||||||
if len(Fingerprint) != 0 {
|
if len(Fingerprint) != 0 {
|
||||||
if realityConfig == nil {
|
if realityConfig == nil {
|
||||||
if fingerprint, exists := tlsC.GetFingerprint(Fingerprint); exists {
|
if fingerprint, exists := tlsC.GetFingerprint(Fingerprint); exists {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user