chore: hello mihomo

This commit is contained in:
wwqgtxx
2023-11-03 21:01:45 +08:00
parent 8c3557e96b
commit 17c9d507be
325 changed files with 1297 additions and 1315 deletions

View File

@@ -5,7 +5,7 @@ import (
"net"
"runtime"
"github.com/Dreamacro/clash/component/dialer"
"github.com/metacubex/mihomo/component/dialer"
)
func ListenDHCPClient(ctx context.Context, ifaceName string) (net.PacketConn, error) {

View File

@@ -6,8 +6,8 @@ import (
"net"
"net/netip"
"github.com/Dreamacro/clash/common/nnip"
"github.com/Dreamacro/clash/component/iface"
"github.com/metacubex/mihomo/common/nnip"
"github.com/metacubex/mihomo/component/iface"
"github.com/insomniacslk/dhcp/dhcpv4"
)

View File

@@ -6,7 +6,7 @@ import (
"strconv"
"strings"
"github.com/Dreamacro/clash/component/iface"
"github.com/metacubex/mihomo/component/iface"
)
func LookupLocalAddrFromIfaceName(ifaceName string, network string, destination netip.Addr, port int) (net.Addr, error) {

View File

@@ -6,7 +6,7 @@ import (
"net/netip"
"syscall"
"github.com/Dreamacro/clash/component/iface"
"github.com/metacubex/mihomo/component/iface"
"golang.org/x/sys/unix"
)

View File

@@ -9,7 +9,7 @@ import (
"syscall"
"unsafe"
"github.com/Dreamacro/clash/component/iface"
"github.com/metacubex/mihomo/component/iface"
)
const (

View File

@@ -11,7 +11,7 @@ import (
"sync"
"time"
"github.com/Dreamacro/clash/component/resolver"
"github.com/metacubex/mihomo/component/resolver"
)
type dialFunc func(ctx context.Context, network string, ips []netip.Addr, port string, opt *option) (net.Conn, error)

View File

@@ -7,7 +7,7 @@ import (
"net/netip"
"sync"
"github.com/Dreamacro/clash/log"
"github.com/metacubex/mihomo/log"
)
var printMarkWarnOnce sync.Once

View File

@@ -4,8 +4,8 @@ import (
"context"
"net"
"github.com/Dreamacro/clash/common/atomic"
"github.com/Dreamacro/clash/component/resolver"
"github.com/metacubex/mihomo/common/atomic"
"github.com/metacubex/mihomo/component/resolver"
)
var (

View File

@@ -173,7 +173,7 @@ static __always_inline bool is_lan_ip(__be32 addr) {
return false;
}
SEC("tc_clash_auto_redir_ingress")
SEC("tc_mihomo_auto_redir_ingress")
int tc_redir_ingress_func(struct __sk_buff *skb) {
void *data = (void *)(long)skb->data;
void *data_end = (void *)(long)skb->data_end;
@@ -264,7 +264,7 @@ int tc_redir_ingress_func(struct __sk_buff *skb) {
return TC_ACT_OK;
}
SEC("tc_clash_auto_redir_egress")
SEC("tc_mihomo_auto_redir_egress")
int tc_redir_egress_func(struct __sk_buff *skb) {
void *data = (void *)(long)skb->data;
void *data_end = (void *)(long)skb->data_end;
@@ -276,10 +276,10 @@ int tc_redir_egress_func(struct __sk_buff *skb) {
if (eth->h_proto != bpf_htons(ETH_P_IP))
return TC_ACT_OK;
__u32 key = 0, *redir_ip, *redir_port; // *clash_mark
__u32 key = 0, *redir_ip, *redir_port; // *mihomo_mark
// clash_mark = bpf_map_lookup_elem(&redir_params_map, &key);
// if (clash_mark && *clash_mark != 0 && *clash_mark == skb->mark)
// mihomo_mark = bpf_map_lookup_elem(&redir_params_map, &key);
// if (mihomo_mark && *mihomo_mark != 0 && *mihomo_mark == skb->mark)
// return TC_ACT_OK;
struct iphdr *iph = (struct iphdr *)(eth + 1);

View File

@@ -38,7 +38,7 @@ static __always_inline bool is_lan_ip(__be32 addr) {
return false;
}
SEC("tc_clash_redirect_to_tun")
SEC("tc_mihomo_redirect_to_tun")
int tc_tun_func(struct __sk_buff *skb) {
void *data = (void *)(long)skb->data;
void *data_end = (void *)(long)skb->data_end;
@@ -50,13 +50,13 @@ int tc_tun_func(struct __sk_buff *skb) {
if (eth->h_proto == bpf_htons(ETH_P_ARP))
return TC_ACT_OK;
__u32 key = 0, *clash_mark, *tun_ifindex;
__u32 key = 0, *mihomo_mark, *tun_ifindex;
clash_mark = bpf_map_lookup_elem(&tc_params_map, &key);
if (!clash_mark)
mihomo_mark = bpf_map_lookup_elem(&tc_params_map, &key);
if (!mihomo_mark)
return TC_ACT_OK;
if (skb->mark == *clash_mark)
if (skb->mark == *mihomo_mark)
return TC_ACT_OK;
if (eth->h_proto == bpf_htons(ETH_P_IP)) {

View File

@@ -3,8 +3,8 @@ package ebpf
import (
"net/netip"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/transport/socks5"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/transport/socks5"
)
type TcEBpfProgram struct {

View File

@@ -6,11 +6,11 @@ import (
"fmt"
"net/netip"
"github.com/Dreamacro/clash/common/cmd"
"github.com/Dreamacro/clash/component/dialer"
"github.com/Dreamacro/clash/component/ebpf/redir"
"github.com/Dreamacro/clash/component/ebpf/tc"
C "github.com/Dreamacro/clash/constant"
"github.com/metacubex/mihomo/common/cmd"
"github.com/metacubex/mihomo/component/dialer"
"github.com/metacubex/mihomo/component/ebpf/redir"
"github.com/metacubex/mihomo/component/ebpf/tc"
C "github.com/metacubex/mihomo/constant"
"github.com/sagernet/netlink"
)
@@ -47,7 +47,7 @@ func NewTcEBpfProgram(ifaceNames []string, tunName string) (*TcEBpfProgram, erro
tunIndex := uint32(tunIface.Attrs().Index)
dialer.DefaultRoutingMark.Store(C.ClashTrafficMark)
dialer.DefaultRoutingMark.Store(C.MihomoTrafficMark)
ifMark := uint32(dialer.DefaultRoutingMark.Load())

View File

@@ -16,9 +16,9 @@ import (
"github.com/sagernet/netlink"
"golang.org/x/sys/unix"
"github.com/Dreamacro/clash/component/ebpf/byteorder"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/transport/socks5"
"github.com/metacubex/mihomo/component/ebpf/byteorder"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/transport/socks5"
)
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc $BPF_CLANG -cflags $BPF_CFLAGS bpf ../bpf/redir.c
@@ -131,7 +131,7 @@ func (e *EBpfRedirect) Start() error {
filter := &netlink.BpfFilter{
FilterAttrs: filterAttrs,
Fd: objs.bpfPrograms.TcRedirIngressFunc.FD(),
Name: "clash-redir-ingress-" + e.ifName,
Name: "mihomo-redir-ingress-" + e.ifName,
DirectAction: true,
}
@@ -153,7 +153,7 @@ func (e *EBpfRedirect) Start() error {
filterEgress := &netlink.BpfFilter{
FilterAttrs: filterAttrsEgress,
Fd: objs.bpfPrograms.TcRedirEgressFunc.FD(),
Name: "clash-redir-egress-" + e.ifName,
Name: "mihomo-redir-egress-" + e.ifName,
DirectAction: true,
}

View File

@@ -14,8 +14,8 @@ import (
"github.com/sagernet/netlink"
"golang.org/x/sys/unix"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/transport/socks5"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/transport/socks5"
)
//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc $BPF_CLANG -cflags $BPF_CFLAGS bpf ../bpf/tc.c
@@ -115,7 +115,7 @@ func (e *EBpfTC) Start() error {
filter := &netlink.BpfFilter{
FilterAttrs: filterAttrs,
Fd: objs.bpfPrograms.TcTunFunc.FD(),
Name: "clash-tc-" + e.ifName,
Name: "mihomo-tc-" + e.ifName,
DirectAction: true,
}

View File

@@ -3,7 +3,7 @@ package fakeip
import (
"net/netip"
"github.com/Dreamacro/clash/component/profile/cachefile"
"github.com/metacubex/mihomo/component/profile/cachefile"
)
type cachefileStore struct {

View File

@@ -3,7 +3,7 @@ package fakeip
import (
"net/netip"
"github.com/Dreamacro/clash/common/cache"
"github.com/metacubex/mihomo/common/cache"
)
type memoryStore struct {

View File

@@ -6,9 +6,9 @@ import (
"strings"
"sync"
"github.com/Dreamacro/clash/common/nnip"
"github.com/Dreamacro/clash/component/profile/cachefile"
"github.com/Dreamacro/clash/component/trie"
"github.com/metacubex/mihomo/common/nnip"
"github.com/metacubex/mihomo/component/profile/cachefile"
"github.com/metacubex/mihomo/component/trie"
)
const (

View File

@@ -7,8 +7,8 @@ import (
"testing"
"time"
"github.com/Dreamacro/clash/component/profile/cachefile"
"github.com/Dreamacro/clash/component/trie"
"github.com/metacubex/mihomo/component/profile/cachefile"
"github.com/metacubex/mihomo/component/trie"
"github.com/stretchr/testify/assert"
"go.etcd.io/bbolt"
@@ -32,7 +32,7 @@ func createCachefileStore(options Options) (*Pool, string, error) {
if err != nil {
return nil, "", err
}
f, err := os.CreateTemp("", "clash")
f, err := os.CreateTemp("", "mihomo")
if err != nil {
return nil, "", err
}

View File

@@ -3,7 +3,7 @@ package geodata
import (
"strings"
"github.com/Dreamacro/clash/component/geodata/router"
"github.com/metacubex/mihomo/component/geodata/router"
)
type AttributeList struct {

View File

@@ -3,8 +3,8 @@ package geodata
import (
"fmt"
"github.com/Dreamacro/clash/component/geodata/router"
C "github.com/Dreamacro/clash/constant"
"github.com/metacubex/mihomo/component/geodata/router"
C "github.com/metacubex/mihomo/constant"
)
type loader struct {

View File

@@ -1,7 +1,7 @@
package geodata
import (
"github.com/Dreamacro/clash/component/geodata/router"
"github.com/metacubex/mihomo/component/geodata/router"
)
type LoaderImplementation interface {

View File

@@ -8,10 +8,10 @@ import (
"os"
"time"
clashHttp "github.com/Dreamacro/clash/component/http"
"github.com/Dreamacro/clash/component/mmdb"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log"
mihomoHttp "github.com/metacubex/mihomo/component/http"
"github.com/metacubex/mihomo/component/mmdb"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/log"
)
var initGeoSite bool
@@ -44,7 +44,7 @@ func InitGeoSite() error {
func downloadGeoSite(path string) (err error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
defer cancel()
resp, err := clashHttp.HttpRequest(ctx, C.GeoSiteUrl, http.MethodGet, http.Header{"User-Agent": {"clash"}}, nil)
resp, err := mihomoHttp.HttpRequest(ctx, C.GeoSiteUrl, http.MethodGet, http.Header{"User-Agent": {"mihomo"}}, nil)
if err != nil {
return
}
@@ -63,7 +63,7 @@ func downloadGeoSite(path string) (err error) {
func downloadGeoIP(path string) (err error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
defer cancel()
resp, err := clashHttp.HttpRequest(ctx, C.GeoIpUrl, http.MethodGet, http.Header{"User-Agent": {"clash"}}, nil)
resp, err := mihomoHttp.HttpRequest(ctx, C.GeoIpUrl, http.MethodGet, http.Header{"User-Agent": {"mihomo"}}, nil)
if err != nil {
return
}

View File

@@ -5,9 +5,9 @@ import (
"os"
"strings"
"github.com/Dreamacro/clash/component/geodata/router"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log"
"github.com/metacubex/mihomo/component/geodata/router"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/log"
"google.golang.org/protobuf/proto"
)

View File

@@ -5,8 +5,8 @@ import (
"fmt"
"runtime"
"github.com/Dreamacro/clash/component/geodata"
"github.com/Dreamacro/clash/component/geodata/router"
"github.com/metacubex/mihomo/component/geodata"
"github.com/metacubex/mihomo/component/geodata/router"
)
type memConservativeLoader struct {

View File

@@ -7,7 +7,7 @@ import (
"sort"
"strings"
"github.com/Dreamacro/clash/component/geodata/strmatcher"
"github.com/metacubex/mihomo/component/geodata/strmatcher"
)
var matcherTypeMap = map[Domain_Type]strmatcher.Type{

View File

@@ -84,7 +84,7 @@ type Domain struct {
unknownFields protoimpl.UnknownFields
// Domain matching type.
Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=clash.component.geodata.router.Domain_Type" json:"type,omitempty"`
Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=mihomo.component.geodata.router.Domain_Type" json:"type,omitempty"`
// Domain value.
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
// Attributes of this domain. May be used for filtering.
@@ -585,22 +585,22 @@ func file_component_geodata_router_config_proto_rawDescGZIP() []byte {
var file_component_geodata_router_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_component_geodata_router_config_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_component_geodata_router_config_proto_goTypes = []interface{}{
(Domain_Type)(0), // 0: clash.component.geodata.router.Domain.Type
(*Domain)(nil), // 1: clash.component.geodata.router.Domain
(*CIDR)(nil), // 2: clash.component.geodata.router.CIDR
(*GeoIP)(nil), // 3: clash.component.geodata.router.GeoIP
(*GeoIPList)(nil), // 4: clash.component.geodata.router.GeoIPList
(*GeoSite)(nil), // 5: clash.component.geodata.router.GeoSite
(*GeoSiteList)(nil), // 6: clash.component.geodata.router.GeoSiteList
(*Domain_Attribute)(nil), // 7: clash.component.geodata.router.Domain.Attribute
(Domain_Type)(0), // 0: mihomo.component.geodata.router.Domain.Type
(*Domain)(nil), // 1: mihomo.component.geodata.router.Domain
(*CIDR)(nil), // 2: mihomo.component.geodata.router.CIDR
(*GeoIP)(nil), // 3: mihomo.component.geodata.router.GeoIP
(*GeoIPList)(nil), // 4: mihomo.component.geodata.router.GeoIPList
(*GeoSite)(nil), // 5: mihomo.component.geodata.router.GeoSite
(*GeoSiteList)(nil), // 6: mihomo.component.geodata.router.GeoSiteList
(*Domain_Attribute)(nil), // 7: mihomo.component.geodata.router.Domain.Attribute
}
var file_component_geodata_router_config_proto_depIdxs = []int32{
0, // 0: clash.component.geodata.router.Domain.type:type_name -> clash.component.geodata.router.Domain.Type
7, // 1: clash.component.geodata.router.Domain.attribute:type_name -> clash.component.geodata.router.Domain.Attribute
2, // 2: clash.component.geodata.router.GeoIP.cidr:type_name -> clash.component.geodata.router.CIDR
3, // 3: clash.component.geodata.router.GeoIPList.entry:type_name -> clash.component.geodata.router.GeoIP
1, // 4: clash.component.geodata.router.GeoSite.domain:type_name -> clash.component.geodata.router.Domain
5, // 5: clash.component.geodata.router.GeoSiteList.entry:type_name -> clash.component.geodata.router.GeoSite
0, // 0: mihomo.component.geodata.router.Domain.type:type_name -> mihomo.component.geodata.router.Domain.Type
7, // 1: mihomo.component.geodata.router.Domain.attribute:type_name -> mihomo.component.geodata.router.Domain.Attribute
2, // 2: mihomo.component.geodata.router.GeoIP.cidr:type_name -> mihomo.component.geodata.router.CIDR
3, // 3: mihomo.component.geodata.router.GeoIPList.entry:type_name -> mihomo.component.geodata.router.GeoIP
1, // 4: mihomo.component.geodata.router.GeoSite.domain:type_name -> mihomo.component.geodata.router.Domain
5, // 5: mihomo.component.geodata.router.GeoSiteList.entry:type_name -> mihomo.component.geodata.router.GeoSite
6, // [6:6] is the sub-list for method output_type
6, // [6:6] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension type_name

View File

@@ -1,9 +1,9 @@
syntax = "proto3";
package clash.component.geodata.router;
option csharp_namespace = "Clash.Component.Geodata.Router";
option go_package = "github.com/Dreamacro/clash/component/geodata/router";
option java_package = "com.clash.component.geodata.router";
package mihomo.component.geodata.router;
option csharp_namespace = "Mihomo.Component.Geodata.Router";
option go_package = "github.com/metacubex/mihomo/component/geodata/router";
option java_package = "com.mihomo.component.geodata.router";
option java_multiple_files = true;
// Domain for routing decision.

View File

@@ -6,9 +6,9 @@ import (
"os"
"strings"
"github.com/Dreamacro/clash/component/geodata"
"github.com/Dreamacro/clash/component/geodata/router"
C "github.com/Dreamacro/clash/constant"
"github.com/metacubex/mihomo/component/geodata"
"github.com/metacubex/mihomo/component/geodata/router"
C "github.com/metacubex/mihomo/constant"
"google.golang.org/protobuf/proto"
)

View File

@@ -1,7 +1,7 @@
package strmatcher
import (
"github.com/Dreamacro/clash/common/generics/list"
"github.com/metacubex/mihomo/common/generics/list"
)
const validCharCount = 53

View File

@@ -6,9 +6,9 @@ import (
"golang.org/x/sync/singleflight"
"strings"
"github.com/Dreamacro/clash/component/geodata/router"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log"
"github.com/metacubex/mihomo/component/geodata/router"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/log"
)
var geoLoaderName = "memconservative"

View File

@@ -11,9 +11,9 @@ import (
"strings"
"time"
"github.com/Dreamacro/clash/component/ca"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/listener/inner"
"github.com/metacubex/mihomo/component/ca"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/listener/inner"
)
func HttpRequest(ctx context.Context, url, method string, header map[string][]string, body io.Reader) (*http.Response, error) {

View File

@@ -7,7 +7,7 @@ import (
"strings"
"time"
"github.com/Dreamacro/clash/common/singledo"
"github.com/metacubex/mihomo/common/singledo"
)
type Interface struct {

View File

@@ -8,9 +8,9 @@ import (
"sync"
"time"
clashHttp "github.com/Dreamacro/clash/component/http"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log"
mihomoHttp "github.com/metacubex/mihomo/component/http"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/log"
"github.com/oschwald/maxminddb-golang"
)
@@ -79,7 +79,7 @@ func Instance() Reader {
func DownloadMMDB(path string) (err error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*90)
defer cancel()
resp, err := clashHttp.HttpRequest(ctx, C.MmdbUrl, http.MethodGet, http.Header{"User-Agent": {"clash"}}, nil)
resp, err := mihomoHttp.HttpRequest(ctx, C.MmdbUrl, http.MethodGet, http.Header{"User-Agent": {"mihomo"}}, nil)
if err != nil {
return
}

View File

@@ -3,8 +3,8 @@ package nat
import (
"net"
"github.com/Dreamacro/clash/common/atomic"
C "github.com/Dreamacro/clash/constant"
"github.com/metacubex/mihomo/common/atomic"
C "github.com/metacubex/mihomo/constant"
)
type writeBackProxy struct {

View File

@@ -4,7 +4,7 @@ import (
"net"
"sync"
C "github.com/Dreamacro/clash/constant"
C "github.com/metacubex/mihomo/constant"
"github.com/puzpuzpuz/xsync/v2"
)

View File

@@ -10,8 +10,8 @@ import (
"syscall"
"unsafe"
"github.com/Dreamacro/clash/common/nnip"
"github.com/Dreamacro/clash/log"
"github.com/metacubex/mihomo/common/nnip"
"github.com/metacubex/mihomo/log"
)
// store process name for when dealing with multiple PROCESS-NAME rules

View File

@@ -7,8 +7,8 @@ import (
"syscall"
"unsafe"
"github.com/Dreamacro/clash/common/nnip"
"github.com/Dreamacro/clash/log"
"github.com/metacubex/mihomo/common/nnip"
"github.com/metacubex/mihomo/log"
"golang.org/x/sys/windows"
)

View File

@@ -5,9 +5,9 @@ import (
"sync"
"time"
"github.com/Dreamacro/clash/component/profile"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log"
"github.com/metacubex/mihomo/component/profile"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/log"
"go.etcd.io/bbolt"
)

View File

@@ -1,7 +1,7 @@
package profile
import (
"github.com/Dreamacro/clash/common/atomic"
"github.com/metacubex/mihomo/common/atomic"
)
// StoreSelected is a global switch for storing selected proxy to cache

View File

@@ -8,12 +8,12 @@ import (
"net/netip"
"strings"
N "github.com/Dreamacro/clash/common/net"
"github.com/Dreamacro/clash/component/dialer"
"github.com/Dreamacro/clash/component/resolver"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/tunnel"
"github.com/Dreamacro/clash/tunnel/statistic"
N "github.com/metacubex/mihomo/common/net"
"github.com/metacubex/mihomo/component/dialer"
"github.com/metacubex/mihomo/component/resolver"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/tunnel"
"github.com/metacubex/mihomo/tunnel/statistic"
)
type proxyDialer struct {

View File

@@ -4,7 +4,7 @@ import (
"context"
"net"
C "github.com/Dreamacro/clash/constant"
C "github.com/metacubex/mihomo/constant"
M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network"

View File

@@ -6,8 +6,8 @@ import (
"strings"
_ "unsafe"
"github.com/Dreamacro/clash/common/utils"
"github.com/Dreamacro/clash/component/trie"
"github.com/metacubex/mihomo/common/utils"
"github.com/metacubex/mihomo/component/trie"
"github.com/zhangyunhao116/fastrand"
)

View File

@@ -9,8 +9,8 @@ import (
"strings"
"time"
"github.com/Dreamacro/clash/common/utils"
"github.com/Dreamacro/clash/component/trie"
"github.com/metacubex/mihomo/common/utils"
"github.com/metacubex/mihomo/component/trie"
"github.com/miekg/dns"
"github.com/zhangyunhao116/fastrand"

View File

@@ -7,8 +7,8 @@ import (
"path/filepath"
"time"
types "github.com/Dreamacro/clash/constant/provider"
"github.com/Dreamacro/clash/log"
types "github.com/metacubex/mihomo/constant/provider"
"github.com/metacubex/mihomo/log"
"github.com/samber/lo"
)

View File

@@ -8,8 +8,8 @@ import (
"os"
"time"
clashHttp "github.com/Dreamacro/clash/component/http"
types "github.com/Dreamacro/clash/constant/provider"
mihomoHttp "github.com/metacubex/mihomo/component/http"
types "github.com/metacubex/mihomo/constant/provider"
)
type FileVehicle struct {
@@ -52,7 +52,7 @@ func (h *HTTPVehicle) Path() string {
func (h *HTTPVehicle) Read() ([]byte, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*20)
defer cancel()
resp, err := clashHttp.HttpRequest(ctx, h.url, http.MethodGet, nil, nil)
resp, err := mihomoHttp.HttpRequest(ctx, h.url, http.MethodGet, nil, nil)
if err != nil {
return nil, err
}

View File

@@ -3,9 +3,9 @@ package sniffer
import (
"errors"
"github.com/Dreamacro/clash/common/utils"
"github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/constant/sniffer"
"github.com/metacubex/mihomo/common/utils"
"github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/constant/sniffer"
)
type SnifferConfig struct {

View File

@@ -8,12 +8,12 @@ import (
"sync"
"time"
"github.com/Dreamacro/clash/common/cache"
N "github.com/Dreamacro/clash/common/net"
"github.com/Dreamacro/clash/component/trie"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/constant/sniffer"
"github.com/Dreamacro/clash/log"
"github.com/metacubex/mihomo/common/cache"
N "github.com/metacubex/mihomo/common/net"
"github.com/metacubex/mihomo/component/trie"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/constant/sniffer"
"github.com/metacubex/mihomo/log"
)
var (

View File

@@ -7,9 +7,9 @@ import (
"net"
"strings"
"github.com/Dreamacro/clash/common/utils"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/constant/sniffer"
"github.com/metacubex/mihomo/common/utils"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/constant/sniffer"
)
var (

View File

@@ -8,9 +8,9 @@ import (
"errors"
"io"
"github.com/Dreamacro/clash/common/buf"
"github.com/Dreamacro/clash/common/utils"
C "github.com/Dreamacro/clash/constant"
"github.com/metacubex/mihomo/common/buf"
"github.com/metacubex/mihomo/common/utils"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/quic-go/quicvarint"
"golang.org/x/crypto/hkdf"

View File

@@ -5,9 +5,9 @@ import (
"errors"
"strings"
"github.com/Dreamacro/clash/common/utils"
C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/constant/sniffer"
"github.com/metacubex/mihomo/common/utils"
C "github.com/metacubex/mihomo/constant"
"github.com/metacubex/mihomo/constant/sniffer"
)
var (

View File

@@ -20,9 +20,9 @@ import (
"time"
"unsafe"
"github.com/Dreamacro/clash/common/utils"
"github.com/Dreamacro/clash/log"
"github.com/Dreamacro/clash/ntp"
"github.com/metacubex/mihomo/common/utils"
"github.com/metacubex/mihomo/log"
"github.com/metacubex/mihomo/ntp"
utls "github.com/sagernet/utls"
"github.com/zhangyunhao116/fastrand"

View File

@@ -4,7 +4,7 @@ import (
"crypto/tls"
"net"
"github.com/Dreamacro/clash/log"
"github.com/metacubex/mihomo/log"
"github.com/mroth/weightedrand/v2"
utls "github.com/sagernet/utls"

View File

@@ -7,7 +7,7 @@ import (
"sort"
"strings"
"github.com/Dreamacro/clash/common/utils"
"github.com/metacubex/mihomo/common/utils"
"github.com/openacid/low/bitmap"
)

View File

@@ -3,7 +3,7 @@ package trie_test
import (
"testing"
"github.com/Dreamacro/clash/component/trie"
"github.com/metacubex/mihomo/component/trie"
"github.com/stretchr/testify/assert"
)

View File

@@ -4,7 +4,7 @@ import (
"net/netip"
"testing"
"github.com/Dreamacro/clash/component/trie"
"github.com/metacubex/mihomo/component/trie"
"github.com/stretchr/testify/assert"
)

View File

@@ -3,7 +3,7 @@ package trie
import (
"net"
"github.com/Dreamacro/clash/log"
"github.com/metacubex/mihomo/log"
)
type IPV6 bool