Added uTLS to gRPC (#1264)

* Added uTLS to gRPC

* Use base 16 of ciphers as StandardName
This commit is contained in:
Hirbod Behnam 2022-10-22 04:36:36 +03:30 committed by GitHub
parent 1f93cbbc5d
commit da0b13cca0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 114 additions and 1 deletions

View file

@ -121,7 +121,13 @@ func getGrpcClient(ctx context.Context, dest net.Destination, streamSettings *in
}
if tlsConfig != nil {
dialOptions = append(dialOptions, grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig.GetTLSConfig())))
var transportCredential credentials.TransportCredentials
if fingerprint, exists := tls.Fingerprints[tlsConfig.Fingerprint]; exists {
transportCredential = tls.NewGrpcUtls(tlsConfig.GetTLSConfig(), fingerprint)
} else { // Fallback to normal gRPC TLS
transportCredential = credentials.NewTLS(tlsConfig.GetTLSConfig())
}
dialOptions = append(dialOptions, grpc.WithTransportCredentials(transportCredential))
} else {
dialOptions = append(dialOptions, grpc.WithInsecure())
}