mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-02-20 23:47:21 -05:00
hysteria2, grpc: fix the use of GetTLSConfig (#3176)
This commit is contained in:
parent
6c091e6645
commit
408e76f445
@ -52,7 +52,7 @@ func dialgRPC(ctx context.Context, dest net.Destination, streamSettings *interne
|
||||
|
||||
transportCredentials := insecure.NewCredentials()
|
||||
if config != nil {
|
||||
transportCredentials = credentials.NewTLS(config.GetTLSConfig())
|
||||
transportCredentials = credentials.NewTLS(config.GetTLSConfig(tls.WithDestination(dest)))
|
||||
}
|
||||
dialOption := grpc.WithTransportCredentials(transportCredentials)
|
||||
|
||||
|
@ -24,12 +24,12 @@ var RunningClient map[dialerConf](hyClient.Client)
|
||||
var ClientMutex sync.Mutex
|
||||
var MBps uint64 = 1000000 / 8 // MByte
|
||||
|
||||
func GetClientTLSConfig(streamSettings *internet.MemoryStreamConfig) (*hyClient.TLSConfig, error) {
|
||||
func GetClientTLSConfig(dest net.Destination, streamSettings *internet.MemoryStreamConfig) (*hyClient.TLSConfig, error) {
|
||||
config := tls.ConfigFromStreamSettings(streamSettings)
|
||||
if config == nil {
|
||||
return nil, newError(Hy2MustNeedTLS)
|
||||
}
|
||||
tlsConfig := config.GetTLSConfig()
|
||||
tlsConfig := config.GetTLSConfig(tls.WithDestination(dest))
|
||||
|
||||
return &hyClient.TLSConfig{
|
||||
RootCAs: tlsConfig.RootCAs,
|
||||
@ -67,7 +67,7 @@ func (f *connFactory) New(addr net.Addr) (net.PacketConn, error) {
|
||||
}
|
||||
|
||||
func NewHyClient(dest net.Destination, streamSettings *internet.MemoryStreamConfig) (hyClient.Client, error) {
|
||||
tlsConfig, err := GetClientTLSConfig(streamSettings)
|
||||
tlsConfig, err := GetClientTLSConfig(dest, streamSettings)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user