mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-12-20 00:50:06 +08:00
chore: remove unused code
This commit is contained in:
parent
6fb1f796a5
commit
f3edbc2b45
@ -51,26 +51,12 @@ func (p *Proxy) AliveForTestUrl(url string) bool {
|
|||||||
return p.alive.Load()
|
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
|
// DialContext implements C.ProxyAdapter
|
||||||
func (p *Proxy) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn, error) {
|
func (p *Proxy) DialContext(ctx context.Context, metadata *C.Metadata) (C.Conn, error) {
|
||||||
conn, err := p.ProxyAdapter.DialContext(ctx, metadata)
|
conn, err := p.ProxyAdapter.DialContext(ctx, metadata)
|
||||||
return conn, err
|
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
|
// ListenPacketContext implements C.ProxyAdapter
|
||||||
func (p *Proxy) ListenPacketContext(ctx context.Context, metadata *C.Metadata) (C.PacketConn, error) {
|
func (p *Proxy) ListenPacketContext(ctx context.Context, metadata *C.Metadata) (C.PacketConn, error) {
|
||||||
pc, err := p.ProxyAdapter.ListenPacketContext(ctx, metadata)
|
pc, err := p.ProxyAdapter.ListenPacketContext(ctx, metadata)
|
||||||
|
|||||||
@ -139,8 +139,11 @@ type ProxyAdapter interface {
|
|||||||
// SupportUOT return UDP over TCP support
|
// SupportUOT return UDP over TCP support
|
||||||
SupportUOT() bool
|
SupportUOT() bool
|
||||||
|
|
||||||
|
// SupportWithDialer only for deprecated relay group, the new protocol does not need to be implemented.
|
||||||
SupportWithDialer() NetWork
|
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)
|
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)
|
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)
|
// 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
|
ExtraDelayHistories() map[string]ProxyState
|
||||||
LastDelayForTestUrl(url string) uint16
|
LastDelayForTestUrl(url string) uint16
|
||||||
URLTest(ctx context.Context, url string, expectedStatus utils.IntRanges[uint16]) (uint16, error)
|
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
|
// AdapterType is enum of adapter type
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user