mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-10-13 09:48:17 +03:00
Compare commits
3
Commits
dns
...
grpc/block
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dee122c5f3 | ||
|
|
ba4aa2896d | ||
|
|
1e3d739a5b |
@@ -40,7 +40,6 @@
|
|||||||
- [luci-app-xray](https://github.com/yichya/luci-app-xray) ([openwrt-xray](https://github.com/yichya/openwrt-xray))
|
- [luci-app-xray](https://github.com/yichya/luci-app-xray) ([openwrt-xray](https://github.com/yichya/openwrt-xray))
|
||||||
- Windows
|
- Windows
|
||||||
- [v2rayN](https://github.com/2dust/v2rayN)
|
- [v2rayN](https://github.com/2dust/v2rayN)
|
||||||
- [Qv2ray](https://github.com/Qv2ray/Qv2ray)
|
|
||||||
- [Netch (NetFilter & TUN/TAP)](https://github.com/NetchX/Netch)
|
- [Netch (NetFilter & TUN/TAP)](https://github.com/NetchX/Netch)
|
||||||
- Android
|
- Android
|
||||||
- [v2rayNG](https://github.com/2dust/v2rayNG)
|
- [v2rayNG](https://github.com/2dust/v2rayNG)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ func dialgRPC(ctx context.Context, dest net.Destination, streamSettings *interne
|
|||||||
conn, err := getGrpcClient(ctx, dest, tlsConfig, streamSettings.SocketSettings)
|
conn, err := getGrpcClient(ctx, dest, tlsConfig, streamSettings.SocketSettings)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, newError("Cannot dial gRPC").Base(err)
|
return nil, newError("failed to dial gRPC").Base(err)
|
||||||
}
|
}
|
||||||
client := encoding.NewGRPCServiceClient(conn)
|
client := encoding.NewGRPCServiceClient(conn)
|
||||||
if grpcSettings.MultiMode {
|
if grpcSettings.MultiMode {
|
||||||
@@ -113,12 +113,6 @@ func getGrpcClient(ctx context.Context, dest net.Destination, tlsConfig *tls.Con
|
|||||||
gctx = session.ContextWithOutbound(gctx, session.OutboundFromContext(ctx))
|
gctx = session.ContextWithOutbound(gctx, session.OutboundFromContext(ctx))
|
||||||
|
|
||||||
rawHost, rawPort, err := net.SplitHostPort(s)
|
rawHost, rawPort, err := net.SplitHostPort(s)
|
||||||
select {
|
|
||||||
case <-gctx.Done():
|
|
||||||
return nil, gctx.Err()
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -130,8 +124,15 @@ func getGrpcClient(ctx context.Context, dest net.Destination, tlsConfig *tls.Con
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
address := net.ParseAddress(rawHost)
|
address := net.ParseAddress(rawHost)
|
||||||
return internet.DialSystem(gctx, net.TCPDestination(address, port), sockopt)
|
conn, err := internet.DialSystem(gctx, net.TCPDestination(address, port), sockopt)
|
||||||
|
if err != nil {
|
||||||
|
newError("failed to dial connection for gRPC").Base(err).WriteToLog()
|
||||||
|
}
|
||||||
|
return conn, err
|
||||||
}),
|
}),
|
||||||
|
grpc.WithBlock(),
|
||||||
|
grpc.WithReturnConnectionError(),
|
||||||
|
grpc.WithDisableRetry(),
|
||||||
)
|
)
|
||||||
globalDialerMap[dialerConf{dest, sockopt, tlsConfig}] = conn
|
globalDialerMap[dialerConf{dest, sockopt, tlsConfig}] = conn
|
||||||
return conn, err
|
return conn, err
|
||||||
|
|||||||
Reference in New Issue
Block a user