mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-12 11:29:36 +03:00
Add REALITY support to gRPC client and server
Now you are able to configure REALITY gRPC client and server Duplicate of REALITY H2, perhaps, just for fun
This commit is contained in:
@ -11,6 +11,7 @@ import (
|
||||
"github.com/xtls/xray-core/common/session"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
"github.com/xtls/xray-core/transport/internet/grpc/encoding"
|
||||
"github.com/xtls/xray-core/transport/internet/reality"
|
||||
"github.com/xtls/xray-core/transport/internet/stat"
|
||||
"github.com/xtls/xray-core/transport/internet/tls"
|
||||
"google.golang.org/grpc"
|
||||
@ -77,6 +78,7 @@ func getGrpcClient(ctx context.Context, dest net.Destination, streamSettings *in
|
||||
globalDialerMap = make(map[dialerConf]*grpc.ClientConn)
|
||||
}
|
||||
tlsConfig := tls.ConfigFromStreamSettings(streamSettings)
|
||||
realityConfig := reality.ConfigFromStreamSettings(streamSettings)
|
||||
sockopt := streamSettings.SocketSettings
|
||||
grpcSettings := streamSettings.ProtocolSettings.(*Config)
|
||||
|
||||
@ -116,7 +118,11 @@ func getGrpcClient(ctx context.Context, dest net.Destination, streamSettings *in
|
||||
return nil, err
|
||||
}
|
||||
address := net.ParseAddress(rawHost)
|
||||
return internet.DialSystem(gctx, net.TCPDestination(address, port), sockopt)
|
||||
c, err := internet.DialSystem(gctx, net.TCPDestination(address, port), sockopt)
|
||||
if err == nil && realityConfig != nil {
|
||||
return reality.UClient(c, realityConfig, ctx, dest)
|
||||
}
|
||||
return c, err
|
||||
}),
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user