chore: Cleanup code

This commit is contained in:
H1JK
2023-11-17 23:12:10 +08:00
parent fef5ad780d
commit 1479b449df
32 changed files with 77 additions and 56 deletions

View File

@@ -71,10 +71,10 @@ func DialContext(ctx context.Context, network, address string, options ...Option
}
func ListenPacket(ctx context.Context, network, address string, options ...Option) (net.PacketConn, error) {
if features.Contains("cmfa") && DefaultSocketHook != nil{
if features.CMFA && DefaultSocketHook != nil {
return listenPacketHooked(ctx, network, address)
}
cfg := applyOptions(options...)
lc := &net.ListenConfig{}
@@ -119,10 +119,10 @@ func GetTcpConcurrent() bool {
}
func dialContext(ctx context.Context, network string, destination netip.Addr, port string, opt *option) (net.Conn, error) {
if features.Contains("cmfa") && DefaultSocketHook != nil{
if features.CMFA && DefaultSocketHook != nil {
return dialContextHooked(ctx, network, destination, port)
}
address := net.JoinHostPort(destination.String(), port)
netDialer := opt.netDialer

View File

@@ -1,4 +1,4 @@
// +build android,cmfa
//go:build android && cmfa
package dialer

View File

@@ -1,4 +1,4 @@
// +build !cmfa
//go:build !(android && cmfa)
package dialer

View File

@@ -1,4 +1,4 @@
// +build android,cmfa
//go:build android && cmfa
package mmdb

View File

@@ -3,7 +3,6 @@ package process
import (
"errors"
"net/netip"
"github.com/metacubex/mihomo/constant"
)
var (
@@ -20,7 +19,3 @@ const (
func FindProcessName(network string, srcIP netip.Addr, srcPort int) (uint32, string, error) {
return findProcessName(network, srcIP, srcPort)
}
func FindPackageName(metadata *constant.Metadata) (string, error) {
return "", nil
}

View File

@@ -1,4 +1,4 @@
// +build android,cmfa
//go:build android && cmfa
package process

View File

@@ -0,0 +1,9 @@
//go:build !(android && cmfa)
package process
import "github.com/metacubex/mihomo/constant"
func FindPackageName(metadata *constant.Metadata) (string, error) {
return "", nil
}