Add support for ech retry configs

This commit is contained in:
neletor
2025-08-11 21:18:34 +08:00
committed by 世界
parent 2534a7b531
commit 5d1a3c4d04
11 changed files with 48 additions and 73 deletions

View File

@@ -27,7 +27,7 @@ func RegisterOutbound(registry *outbound.Registry) {
type Outbound struct {
outbound.Adapter
dialer N.Dialer
dialer tls.Dialer
server M.Socksaddr
tlsConfig tls.Config
client *anytls.Client
@@ -66,7 +66,8 @@ func NewOutbound(ctx context.Context, router adapter.Router, logger log.ContextL
if err != nil {
return nil, err
}
outbound.dialer = outboundDialer
outbound.dialer = tls.NewDialer(outboundDialer, tlsConfig)
client, err := anytls.NewClient(ctx, anytls.ClientConfig{
Password: options.Password,
@@ -99,16 +100,7 @@ func (d anytlsDialer) ListenPacket(ctx context.Context, destination M.Socksaddr)
}
func (h *Outbound) dialOut(ctx context.Context) (net.Conn, error) {
conn, err := h.dialer.DialContext(ctx, N.NetworkTCP, h.server)
if err != nil {
return nil, err
}
tlsConn, err := tls.ClientHandshake(ctx, conn, h.tlsConfig)
if err != nil {
common.Close(tlsConn, conn)
return nil, err
}
return tlsConn, nil
return h.dialer.DialTLSContext(ctx, h.server)
}
func (h *Outbound) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {