From f3edbc2b4593d6727e98e9694806b55efeb68e80 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Mon, 3 Nov 2025 09:56:19 +0800 Subject: [PATCH] chore: remove unused code --- adapter/adapter.go | 14 -------------- constant/adapters.go | 9 +++------ 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/adapter/adapter.go b/adapter/adapter.go index 4f127bcf..ef8d4ee3 100644 --- a/adapter/adapter.go +++ b/adapter/adapter.go @@ -51,26 +51,12 @@ func (p *Proxy) AliveForTestUrl(url string) bool { return p.alive.Load() } -// Dial implements C.Proxy -func (p *Proxy) Dial(metadata *C.Metadata) (C.Conn, error) { - ctx, cancel := context.WithTimeout(context.Background(), C.DefaultTCPTimeout) - defer cancel() - return p.DialContext(ctx, metadata) -} - // DialContext implements C.ProxyAdapter func (p *Proxy) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn, error) { conn, err := p.ProxyAdapter.DialContext(ctx, metadata) return conn, err } -// DialUDP implements C.ProxyAdapter -func (p *Proxy) DialUDP(metadata *C.Metadata) (C.PacketConn, error) { - ctx, cancel := context.WithTimeout(context.Background(), C.DefaultUDPTimeout) - defer cancel() - return p.ListenPacketContext(ctx, metadata) -} - // ListenPacketContext implements C.ProxyAdapter func (p *Proxy) ListenPacketContext(ctx context.Context, metadata *C.Metadata) (C.PacketConn, error) { pc, err := p.ProxyAdapter.ListenPacketContext(ctx, metadata) diff --git a/constant/adapters.go b/constant/adapters.go index ab48c47d..97e9235b 100644 --- a/constant/adapters.go +++ b/constant/adapters.go @@ -139,8 +139,11 @@ type ProxyAdapter interface { // SupportUOT return UDP over TCP support SupportUOT() bool + // SupportWithDialer only for deprecated relay group, the new protocol does not need to be implemented. SupportWithDialer() NetWork + // DialContextWithDialer only for deprecated relay group, the new protocol does not need to be implemented. DialContextWithDialer(ctx context.Context, dialer Dialer, metadata *Metadata) (Conn, error) + // ListenPacketWithDialer only for deprecated relay group, the new protocol does not need to be implemented. ListenPacketWithDialer(ctx context.Context, dialer Dialer, metadata *Metadata) (PacketConn, error) // IsL3Protocol return ProxyAdapter working in L3 (tell dns module not pass the domain to avoid loopback) @@ -178,12 +181,6 @@ type Proxy interface { ExtraDelayHistories() map[string]ProxyState LastDelayForTestUrl(url string) uint16 URLTest(ctx context.Context, url string, expectedStatus utils.IntRanges[uint16]) (uint16, error) - - // Deprecated: use DialContext instead. - Dial(metadata *Metadata) (Conn, error) - - // Deprecated: use DialPacketConn instead. - DialUDP(metadata *Metadata) (PacketConn, error) } // AdapterType is enum of adapter type