1
0
mirror of https://github.com/MetaCubeX/mihomo.git synced 2025-09-19 20:15:59 +08:00

fix: improve feature check and add missing patches

This commit is contained in:
Steve Johnson
2023-11-17 19:03:39 +08:00
parent d9cfdc3242
commit b5a8f0fce1
12 changed files with 64 additions and 45 deletions

View File

@ -13,7 +13,6 @@ import (
"github.com/metacubex/mihomo/component/resolver"
"github.com/metacubex/mihomo/constant/features"
"golang.org/x/exp/slices"
)
type dialFunc func(ctx context.Context, network string, ips []netip.Addr, port string, opt *option) (net.Conn, error)
@ -72,7 +71,7 @@ func DialContext(ctx context.Context, network, address string, options ...Option
}
func ListenPacket(ctx context.Context, network, address string, options ...Option) (net.PacketConn, error) {
if slices.Contains(features.TAGS, "cmfa") {
if features.Contains("cmfa") && DefaultSocketHook != nil{
return listenPacketHooked(ctx, network, address)
}
@ -120,7 +119,7 @@ func GetTcpConcurrent() bool {
}
func dialContext(ctx context.Context, network string, destination netip.Addr, port string, opt *option) (net.Conn, error) {
if slices.Contains(features.TAGS, "cmfa") {
if features.Contains("cmfa") && DefaultSocketHook != nil{
return dialContextHooked(ctx, network, destination, port)
}