Merge pull request #360 from tgNotHouse/Alpha
fix: get tlsconfig err not handle, return nil pointer #358
This commit is contained in:
commit
6db71ce97f
2 changed files with 8 additions and 5 deletions
|
@ -101,6 +101,9 @@ func (v *Vless) StreamConn(c net.Conn, metadata *C.Metadata) (net.Conn, error) {
|
||||||
wsOpts.TLSConfig = tlsC.GetGlobalTLSConfig(tlsConfig)
|
wsOpts.TLSConfig = tlsC.GetGlobalTLSConfig(tlsConfig)
|
||||||
} else {
|
} else {
|
||||||
wsOpts.TLSConfig, err = tlsC.GetSpecifiedFingerprintTLSConfig(tlsConfig, v.option.Fingerprint)
|
wsOpts.TLSConfig, err = tlsC.GetSpecifiedFingerprintTLSConfig(tlsConfig, v.option.Fingerprint)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.option.ServerName != "" {
|
if v.option.ServerName != "" {
|
||||||
|
|
|
@ -63,7 +63,7 @@ func convertFingerprint(fingerprint string) (*[32]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(fpByte) != 32 {
|
if len(fpByte) != 32 {
|
||||||
return nil, fmt.Errorf("fingerprint string length error,need sha25 fingerprint")
|
return nil, fmt.Errorf("fingerprint string length error,need sha256 fingerprint")
|
||||||
}
|
}
|
||||||
return (*[32]byte)(fpByte), nil
|
return (*[32]byte)(fpByte), nil
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ func GetSpecifiedFingerprintXTLSConfig(tlsConfig *xtls.Config, fingerprint strin
|
||||||
if fingerprintBytes, err := convertFingerprint(fingerprint); err != nil {
|
if fingerprintBytes, err := convertFingerprint(fingerprint); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
} else {
|
||||||
tlsConfig=GetGlobalXTLSConfig(tlsConfig)
|
tlsConfig = GetGlobalXTLSConfig(tlsConfig)
|
||||||
tlsConfig.VerifyPeerCertificate = verifyFingerprint(fingerprintBytes)
|
tlsConfig.VerifyPeerCertificate = verifyFingerprint(fingerprintBytes)
|
||||||
tlsConfig.InsecureSkipVerify = true
|
tlsConfig.InsecureSkipVerify = true
|
||||||
return tlsConfig, nil
|
return tlsConfig, nil
|
||||||
|
|
Loading…
Reference in a new issue