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

@@ -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"