From 4dcb8294ca6ac4b4d727e6fbb2e4eb82041a4fd4 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Fri, 29 Oct 2021 00:52:44 +0800 Subject: [PATCH] Chore: move "geodata" to package "component" --- {rule => component}/geodata/attr.go | 2 +- {rule => component}/geodata/geodata.go | 2 +- {rule => component}/geodata/geodataproto.go | 4 +- .../geodata/memconservative/cache.go | 2 +- .../geodata/memconservative/decode.go | 10 +- .../geodata/memconservative/memc.go | 4 +- {rule => component}/geodata/package_info.go | 0 .../geodata/router/condition.go | 3 +- .../geodata/router/config.pb.go | 264 +++++++++--------- .../geodata/router/config.proto | 8 +- .../geodata/standard/standard.go | 8 +- .../strmatcher/ac_automaton_matcher.go | 0 .../geodata/strmatcher/domain_matcher.go | 0 .../geodata/strmatcher/full_matcher.go | 0 .../geodata/strmatcher/matchers.go | 0 .../geodata/strmatcher/mph_matcher.go | 0 .../geodata/strmatcher/package_info.go | 0 .../geodata/strmatcher/strmatcher.go | 0 component/script/clash_module.go | 4 +- main.go | 2 +- rule/geosite.go | 8 +- 21 files changed, 166 insertions(+), 155 deletions(-) rename {rule => component}/geodata/attr.go (94%) rename {rule => component}/geodata/geodata.go (97%) rename {rule => component}/geodata/geodataproto.go (86%) rename {rule => component}/geodata/memconservative/cache.go (98%) rename {rule => component}/geodata/memconservative/decode.go (90%) rename {rule => component}/geodata/memconservative/memc.go (91%) rename {rule => component}/geodata/package_info.go (100%) rename {rule => component}/geodata/router/condition.go (93%) rename {rule => component}/geodata/router/config.pb.go (53%) rename {rule => component}/geodata/router/config.proto (83%) rename {rule => component}/geodata/standard/standard.go (91%) rename {rule => component}/geodata/strmatcher/ac_automaton_matcher.go (100%) rename {rule => component}/geodata/strmatcher/domain_matcher.go (100%) rename {rule => component}/geodata/strmatcher/full_matcher.go (100%) rename {rule => component}/geodata/strmatcher/matchers.go (100%) rename {rule => component}/geodata/strmatcher/mph_matcher.go (100%) rename {rule => component}/geodata/strmatcher/package_info.go (100%) rename {rule => component}/geodata/strmatcher/strmatcher.go (100%) diff --git a/rule/geodata/attr.go b/component/geodata/attr.go similarity index 94% rename from rule/geodata/attr.go rename to component/geodata/attr.go index a171c7d8..e35a25ca 100644 --- a/rule/geodata/attr.go +++ b/component/geodata/attr.go @@ -3,7 +3,7 @@ package geodata import ( "strings" - "github.com/Dreamacro/clash/rule/geodata/router" + "github.com/Dreamacro/clash/component/geodata/router" ) type AttributeList struct { diff --git a/rule/geodata/geodata.go b/component/geodata/geodata.go similarity index 97% rename from rule/geodata/geodata.go rename to component/geodata/geodata.go index 07eac40c..cdd141fb 100644 --- a/rule/geodata/geodata.go +++ b/component/geodata/geodata.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" + "github.com/Dreamacro/clash/component/geodata/router" "github.com/Dreamacro/clash/log" - "github.com/Dreamacro/clash/rule/geodata/router" ) type loader struct { diff --git a/rule/geodata/geodataproto.go b/component/geodata/geodataproto.go similarity index 86% rename from rule/geodata/geodataproto.go rename to component/geodata/geodataproto.go index 20745a71..a63b25bc 100644 --- a/rule/geodata/geodataproto.go +++ b/component/geodata/geodataproto.go @@ -1,6 +1,8 @@ package geodata -import "github.com/Dreamacro/clash/rule/geodata/router" +import ( + "github.com/Dreamacro/clash/component/geodata/router" +) type LoaderImplementation interface { LoadSite(filename, list string) ([]*router.Domain, error) diff --git a/rule/geodata/memconservative/cache.go b/component/geodata/memconservative/cache.go similarity index 98% rename from rule/geodata/memconservative/cache.go rename to component/geodata/memconservative/cache.go index d66438b4..28c2c238 100644 --- a/rule/geodata/memconservative/cache.go +++ b/component/geodata/memconservative/cache.go @@ -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/Dreamacro/clash/rule/geodata/router" "google.golang.org/protobuf/proto" ) diff --git a/rule/geodata/memconservative/decode.go b/component/geodata/memconservative/decode.go similarity index 90% rename from rule/geodata/memconservative/decode.go rename to component/geodata/memconservative/decode.go index 321043e8..7eb86400 100644 --- a/rule/geodata/memconservative/decode.go +++ b/component/geodata/memconservative/decode.go @@ -74,13 +74,13 @@ Loop: if strings.EqualFold(string(container), code) { count++ offset := -(1 + int64(varintLenByteLen) + int64(codeVarintLength)) - f.Seek(offset, 1) // back to the start of GeoIP or GeoSite varint + _, _ = f.Seek(offset, 1) // back to the start of GeoIP or GeoSite varint advancedN = geoDataVarintLength // the number of bytes to be read in next round } else { count = 1 offset := int64(geoDataVarintLength) - int64(codeVarintLength) - int64(varintLenByteLen) - 1 - f.Seek(offset, 1) // skip the unmatched GeoIP or GeoSite varint - advancedN = 1 // the next round will be the start of another GeoIPList or GeoSiteList + _, _ = f.Seek(offset, 1) // skip the unmatched GeoIP or GeoSite varint + advancedN = 1 // the next round will be the start of another GeoIPList or GeoSiteList } case 6: // matched GeoIP or GeoSite varint result = container @@ -95,7 +95,9 @@ func Decode(filename, code string) ([]byte, error) { if err != nil { return nil, fmt.Errorf("failed to open file: %s, base error: %s", filename, err.Error()) } - defer f.Close() + defer func(f *os.File) { + _ = f.Close() + }(f) geoBytes, err := emitBytes(f, code) if err != nil { diff --git a/rule/geodata/memconservative/memc.go b/component/geodata/memconservative/memc.go similarity index 91% rename from rule/geodata/memconservative/memc.go rename to component/geodata/memconservative/memc.go index d0cbfa7f..2961f6eb 100644 --- a/rule/geodata/memconservative/memc.go +++ b/component/geodata/memconservative/memc.go @@ -4,8 +4,8 @@ import ( "fmt" "runtime" - "github.com/Dreamacro/clash/rule/geodata" - "github.com/Dreamacro/clash/rule/geodata/router" + "github.com/Dreamacro/clash/component/geodata" + "github.com/Dreamacro/clash/component/geodata/router" ) type memConservativeLoader struct { diff --git a/rule/geodata/package_info.go b/component/geodata/package_info.go similarity index 100% rename from rule/geodata/package_info.go rename to component/geodata/package_info.go diff --git a/rule/geodata/router/condition.go b/component/geodata/router/condition.go similarity index 93% rename from rule/geodata/router/condition.go rename to component/geodata/router/condition.go index 26be8237..4b63ddfc 100644 --- a/rule/geodata/router/condition.go +++ b/component/geodata/router/condition.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/Dreamacro/clash/rule/geodata/strmatcher" + "github.com/Dreamacro/clash/component/geodata/strmatcher" ) var matcherTypeMap = map[Domain_Type]strmatcher.Type{ @@ -50,6 +50,7 @@ func NewMphMatcherGroup(domains []*Domain) (*DomainMatcher, error) { }, nil } +// NewDomainMatcher new domain matcher. func NewDomainMatcher(domains []*Domain) (*DomainMatcher, error) { g := new(strmatcher.MatcherGroup) for _, d := range domains { diff --git a/rule/geodata/router/config.pb.go b/component/geodata/router/config.pb.go similarity index 53% rename from rule/geodata/router/config.pb.go rename to component/geodata/router/config.pb.go index 96762c12..b0e8f20f 100644 --- a/rule/geodata/router/config.pb.go +++ b/component/geodata/router/config.pb.go @@ -2,7 +2,7 @@ // versions: // protoc-gen-go v1.27.1 // protoc v3.17.3 -// source: rule/geodata/router/config.proto +// source: component/geodata/router/config.proto package router @@ -61,11 +61,11 @@ func (x Domain_Type) String() string { } func (Domain_Type) Descriptor() protoreflect.EnumDescriptor { - return file_rule_geodata_router_config_proto_enumTypes[0].Descriptor() + return file_component_geodata_router_config_proto_enumTypes[0].Descriptor() } func (Domain_Type) Type() protoreflect.EnumType { - return &file_rule_geodata_router_config_proto_enumTypes[0] + return &file_component_geodata_router_config_proto_enumTypes[0] } func (x Domain_Type) Number() protoreflect.EnumNumber { @@ -74,7 +74,7 @@ func (x Domain_Type) Number() protoreflect.EnumNumber { // Deprecated: Use Domain_Type.Descriptor instead. func (Domain_Type) EnumDescriptor() ([]byte, []int) { - return file_rule_geodata_router_config_proto_rawDescGZIP(), []int{0, 0} + return file_component_geodata_router_config_proto_rawDescGZIP(), []int{0, 0} } // Domain for routing decision. @@ -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.rule.geodata.router.Domain_Type" json:"type,omitempty"` + Type Domain_Type `protobuf:"varint,1,opt,name=type,proto3,enum=clash.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. @@ -94,7 +94,7 @@ type Domain struct { func (x *Domain) Reset() { *x = Domain{} if protoimpl.UnsafeEnabled { - mi := &file_rule_geodata_router_config_proto_msgTypes[0] + mi := &file_component_geodata_router_config_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -107,7 +107,7 @@ func (x *Domain) String() string { func (*Domain) ProtoMessage() {} func (x *Domain) ProtoReflect() protoreflect.Message { - mi := &file_rule_geodata_router_config_proto_msgTypes[0] + mi := &file_component_geodata_router_config_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -120,7 +120,7 @@ func (x *Domain) ProtoReflect() protoreflect.Message { // Deprecated: Use Domain.ProtoReflect.Descriptor instead. func (*Domain) Descriptor() ([]byte, []int) { - return file_rule_geodata_router_config_proto_rawDescGZIP(), []int{0} + return file_component_geodata_router_config_proto_rawDescGZIP(), []int{0} } func (x *Domain) GetType() Domain_Type { @@ -159,7 +159,7 @@ type CIDR struct { func (x *CIDR) Reset() { *x = CIDR{} if protoimpl.UnsafeEnabled { - mi := &file_rule_geodata_router_config_proto_msgTypes[1] + mi := &file_component_geodata_router_config_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -172,7 +172,7 @@ func (x *CIDR) String() string { func (*CIDR) ProtoMessage() {} func (x *CIDR) ProtoReflect() protoreflect.Message { - mi := &file_rule_geodata_router_config_proto_msgTypes[1] + mi := &file_component_geodata_router_config_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -185,7 +185,7 @@ func (x *CIDR) ProtoReflect() protoreflect.Message { // Deprecated: Use CIDR.ProtoReflect.Descriptor instead. func (*CIDR) Descriptor() ([]byte, []int) { - return file_rule_geodata_router_config_proto_rawDescGZIP(), []int{1} + return file_component_geodata_router_config_proto_rawDescGZIP(), []int{1} } func (x *CIDR) GetIp() []byte { @@ -215,7 +215,7 @@ type GeoIP struct { func (x *GeoIP) Reset() { *x = GeoIP{} if protoimpl.UnsafeEnabled { - mi := &file_rule_geodata_router_config_proto_msgTypes[2] + mi := &file_component_geodata_router_config_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -228,7 +228,7 @@ func (x *GeoIP) String() string { func (*GeoIP) ProtoMessage() {} func (x *GeoIP) ProtoReflect() protoreflect.Message { - mi := &file_rule_geodata_router_config_proto_msgTypes[2] + mi := &file_component_geodata_router_config_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -241,7 +241,7 @@ func (x *GeoIP) ProtoReflect() protoreflect.Message { // Deprecated: Use GeoIP.ProtoReflect.Descriptor instead. func (*GeoIP) Descriptor() ([]byte, []int) { - return file_rule_geodata_router_config_proto_rawDescGZIP(), []int{2} + return file_component_geodata_router_config_proto_rawDescGZIP(), []int{2} } func (x *GeoIP) GetCountryCode() string { @@ -276,7 +276,7 @@ type GeoIPList struct { func (x *GeoIPList) Reset() { *x = GeoIPList{} if protoimpl.UnsafeEnabled { - mi := &file_rule_geodata_router_config_proto_msgTypes[3] + mi := &file_component_geodata_router_config_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -289,7 +289,7 @@ func (x *GeoIPList) String() string { func (*GeoIPList) ProtoMessage() {} func (x *GeoIPList) ProtoReflect() protoreflect.Message { - mi := &file_rule_geodata_router_config_proto_msgTypes[3] + mi := &file_component_geodata_router_config_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -302,7 +302,7 @@ func (x *GeoIPList) ProtoReflect() protoreflect.Message { // Deprecated: Use GeoIPList.ProtoReflect.Descriptor instead. func (*GeoIPList) Descriptor() ([]byte, []int) { - return file_rule_geodata_router_config_proto_rawDescGZIP(), []int{3} + return file_component_geodata_router_config_proto_rawDescGZIP(), []int{3} } func (x *GeoIPList) GetEntry() []*GeoIP { @@ -324,7 +324,7 @@ type GeoSite struct { func (x *GeoSite) Reset() { *x = GeoSite{} if protoimpl.UnsafeEnabled { - mi := &file_rule_geodata_router_config_proto_msgTypes[4] + mi := &file_component_geodata_router_config_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -337,7 +337,7 @@ func (x *GeoSite) String() string { func (*GeoSite) ProtoMessage() {} func (x *GeoSite) ProtoReflect() protoreflect.Message { - mi := &file_rule_geodata_router_config_proto_msgTypes[4] + mi := &file_component_geodata_router_config_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -350,7 +350,7 @@ func (x *GeoSite) ProtoReflect() protoreflect.Message { // Deprecated: Use GeoSite.ProtoReflect.Descriptor instead. func (*GeoSite) Descriptor() ([]byte, []int) { - return file_rule_geodata_router_config_proto_rawDescGZIP(), []int{4} + return file_component_geodata_router_config_proto_rawDescGZIP(), []int{4} } func (x *GeoSite) GetCountryCode() string { @@ -378,7 +378,7 @@ type GeoSiteList struct { func (x *GeoSiteList) Reset() { *x = GeoSiteList{} if protoimpl.UnsafeEnabled { - mi := &file_rule_geodata_router_config_proto_msgTypes[5] + mi := &file_component_geodata_router_config_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -391,7 +391,7 @@ func (x *GeoSiteList) String() string { func (*GeoSiteList) ProtoMessage() {} func (x *GeoSiteList) ProtoReflect() protoreflect.Message { - mi := &file_rule_geodata_router_config_proto_msgTypes[5] + mi := &file_component_geodata_router_config_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -404,7 +404,7 @@ func (x *GeoSiteList) ProtoReflect() protoreflect.Message { // Deprecated: Use GeoSiteList.ProtoReflect.Descriptor instead. func (*GeoSiteList) Descriptor() ([]byte, []int) { - return file_rule_geodata_router_config_proto_rawDescGZIP(), []int{5} + return file_component_geodata_router_config_proto_rawDescGZIP(), []int{5} } func (x *GeoSiteList) GetEntry() []*GeoSite { @@ -429,7 +429,7 @@ type Domain_Attribute struct { func (x *Domain_Attribute) Reset() { *x = Domain_Attribute{} if protoimpl.UnsafeEnabled { - mi := &file_rule_geodata_router_config_proto_msgTypes[6] + mi := &file_component_geodata_router_config_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -442,7 +442,7 @@ func (x *Domain_Attribute) String() string { func (*Domain_Attribute) ProtoMessage() {} func (x *Domain_Attribute) ProtoReflect() protoreflect.Message { - mi := &file_rule_geodata_router_config_proto_msgTypes[6] + mi := &file_component_geodata_router_config_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -455,7 +455,7 @@ func (x *Domain_Attribute) ProtoReflect() protoreflect.Message { // Deprecated: Use Domain_Attribute.ProtoReflect.Descriptor instead. func (*Domain_Attribute) Descriptor() ([]byte, []int) { - return file_rule_geodata_router_config_proto_rawDescGZIP(), []int{0, 0} + return file_component_geodata_router_config_proto_rawDescGZIP(), []int{0, 0} } func (x *Domain_Attribute) GetKey() string { @@ -502,101 +502,105 @@ func (*Domain_Attribute_BoolValue) isDomain_Attribute_TypedValue() {} func (*Domain_Attribute_IntValue) isDomain_Attribute_TypedValue() {} -var File_rule_geodata_router_config_proto protoreflect.FileDescriptor +var File_component_geodata_router_config_proto protoreflect.FileDescriptor -var file_rule_geodata_router_config_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x72, 0x75, 0x6c, 0x65, 0x2f, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x72, - 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x19, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x72, 0x75, 0x6c, 0x65, 0x2e, 0x67, - 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x22, 0xc7, 0x02, - 0x0a, 0x06, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x12, 0x3a, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x72, - 0x75, 0x6c, 0x65, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x49, 0x0a, 0x09, 0x61, 0x74, - 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, - 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x72, 0x75, 0x6c, 0x65, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, - 0x74, 0x61, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, - 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x09, 0x61, 0x74, 0x74, 0x72, - 0x69, 0x62, 0x75, 0x74, 0x65, 0x1a, 0x6c, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, - 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f, 0x6f, 0x6c, - 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x5f, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x56, - 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0d, 0x0a, 0x0b, 0x74, 0x79, 0x70, 0x65, 0x64, 0x5f, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x09, 0x0a, 0x05, 0x50, - 0x6c, 0x61, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x65, 0x67, 0x65, 0x78, 0x10, - 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x10, 0x02, 0x12, 0x08, 0x0a, - 0x04, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0x03, 0x22, 0x2e, 0x0a, 0x04, 0x43, 0x49, 0x44, 0x52, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x69, 0x70, 0x12, - 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0x84, 0x01, 0x0a, 0x05, 0x47, 0x65, 0x6f, 0x49, - 0x50, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, - 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, - 0x43, 0x6f, 0x64, 0x65, 0x12, 0x33, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x72, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x72, 0x75, 0x6c, 0x65, 0x2e, - 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x43, - 0x49, 0x44, 0x52, 0x52, 0x04, 0x63, 0x69, 0x64, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x76, - 0x65, 0x72, 0x73, 0x65, 0x5f, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0c, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x22, 0x43, - 0x0a, 0x09, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x05, 0x65, - 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x6c, 0x61, - 0x73, 0x68, 0x2e, 0x72, 0x75, 0x6c, 0x65, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x05, 0x65, 0x6e, - 0x74, 0x72, 0x79, 0x22, 0x67, 0x0a, 0x07, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x12, 0x21, - 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x64, - 0x65, 0x12, 0x39, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x72, 0x75, 0x6c, 0x65, 0x2e, 0x67, +var file_component_geodata_router_config_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x65, 0x6f, 0x64, + 0x61, 0x74, 0x61, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1e, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x63, + 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, + 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x22, 0xd1, 0x02, 0x0a, 0x06, 0x44, 0x6f, 0x6d, 0x61, + 0x69, 0x6e, 0x12, 0x3f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x2b, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, + 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, + 0x72, 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x4e, 0x0a, 0x09, 0x61, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x63, + 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x44, 0x6f, - 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x22, 0x47, 0x0a, 0x0b, - 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x05, 0x65, - 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x63, 0x6c, 0x61, - 0x73, 0x68, 0x2e, 0x72, 0x75, 0x6c, 0x65, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x52, 0x05, - 0x65, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x6d, 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6c, 0x61, - 0x73, 0x68, 0x2e, 0x72, 0x75, 0x6c, 0x65, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, - 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x2e, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, - 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x61, 0x63, 0x72, 0x6f, 0x2f, 0x63, - 0x6c, 0x61, 0x73, 0x68, 0x2f, 0x72, 0x75, 0x6c, 0x65, 0x2f, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, - 0x61, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0xaa, 0x02, 0x19, 0x43, 0x6c, 0x61, 0x73, 0x68, - 0x2e, 0x52, 0x75, 0x6c, 0x65, 0x2e, 0x47, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x6f, - 0x75, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x09, + 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x1a, 0x6c, 0x0a, 0x09, 0x41, 0x74, 0x74, + 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0a, 0x62, 0x6f, 0x6f, 0x6c, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, + 0x62, 0x6f, 0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x09, 0x69, 0x6e, 0x74, + 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x08, + 0x69, 0x6e, 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x0d, 0x0a, 0x0b, 0x74, 0x79, 0x70, 0x65, + 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x32, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, + 0x09, 0x0a, 0x05, 0x50, 0x6c, 0x61, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x65, + 0x67, 0x65, 0x78, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x10, + 0x02, 0x12, 0x08, 0x0a, 0x04, 0x46, 0x75, 0x6c, 0x6c, 0x10, 0x03, 0x22, 0x2e, 0x0a, 0x04, 0x43, + 0x49, 0x44, 0x52, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x02, 0x69, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0d, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x22, 0x89, 0x01, 0x0a, 0x05, + 0x47, 0x65, 0x6f, 0x49, 0x50, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, + 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x63, 0x69, 0x64, 0x72, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x63, + 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, + 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x43, 0x49, 0x44, 0x52, 0x52, 0x04, 0x63, 0x69, + 0x64, 0x72, 0x12, 0x23, 0x0a, 0x0d, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x6d, 0x61, + 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x72, 0x65, 0x76, 0x65, 0x72, + 0x73, 0x65, 0x4d, 0x61, 0x74, 0x63, 0x68, 0x22, 0x48, 0x0a, 0x09, 0x47, 0x65, 0x6f, 0x49, 0x50, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3b, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x70, + 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72, 0x6f, + 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, 0x65, 0x6f, 0x49, 0x50, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, + 0x79, 0x22, 0x6c, 0x0a, 0x07, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x12, 0x21, 0x0a, 0x0c, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x72, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x3e, 0x0a, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, + 0x74, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, + 0x2e, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x52, 0x06, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x22, + 0x4c, 0x0a, 0x0b, 0x47, 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x3d, + 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, + 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, + 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x2e, 0x47, + 0x65, 0x6f, 0x53, 0x69, 0x74, 0x65, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x7c, 0x0a, + 0x22, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x6f, + 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x6f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x72, 0x6f, 0x75, + 0x74, 0x65, 0x72, 0x50, 0x01, 0x5a, 0x33, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x44, 0x72, 0x65, 0x61, 0x6d, 0x61, 0x63, 0x72, 0x6f, 0x2f, 0x63, 0x6c, 0x61, 0x73, + 0x68, 0x2f, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2f, 0x67, 0x65, 0x6f, 0x64, + 0x61, 0x74, 0x61, 0x2f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0xaa, 0x02, 0x1e, 0x43, 0x6c, 0x61, + 0x73, 0x68, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x2e, 0x47, 0x65, 0x6f, + 0x64, 0x61, 0x74, 0x61, 0x2e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( - file_rule_geodata_router_config_proto_rawDescOnce sync.Once - file_rule_geodata_router_config_proto_rawDescData = file_rule_geodata_router_config_proto_rawDesc + file_component_geodata_router_config_proto_rawDescOnce sync.Once + file_component_geodata_router_config_proto_rawDescData = file_component_geodata_router_config_proto_rawDesc ) -func file_rule_geodata_router_config_proto_rawDescGZIP() []byte { - file_rule_geodata_router_config_proto_rawDescOnce.Do(func() { - file_rule_geodata_router_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_rule_geodata_router_config_proto_rawDescData) +func file_component_geodata_router_config_proto_rawDescGZIP() []byte { + file_component_geodata_router_config_proto_rawDescOnce.Do(func() { + file_component_geodata_router_config_proto_rawDescData = protoimpl.X.CompressGZIP(file_component_geodata_router_config_proto_rawDescData) }) - return file_rule_geodata_router_config_proto_rawDescData + return file_component_geodata_router_config_proto_rawDescData } -var file_rule_geodata_router_config_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_rule_geodata_router_config_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_rule_geodata_router_config_proto_goTypes = []interface{}{ - (Domain_Type)(0), // 0: clash.rule.geodata.router.Domain.Type - (*Domain)(nil), // 1: clash.rule.geodata.router.Domain - (*CIDR)(nil), // 2: clash.rule.geodata.router.CIDR - (*GeoIP)(nil), // 3: clash.rule.geodata.router.GeoIP - (*GeoIPList)(nil), // 4: clash.rule.geodata.router.GeoIPList - (*GeoSite)(nil), // 5: clash.rule.geodata.router.GeoSite - (*GeoSiteList)(nil), // 6: clash.rule.geodata.router.GeoSiteList - (*Domain_Attribute)(nil), // 7: clash.rule.geodata.router.Domain.Attribute +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 } -var file_rule_geodata_router_config_proto_depIdxs = []int32{ - 0, // 0: clash.rule.geodata.router.Domain.type:type_name -> clash.rule.geodata.router.Domain.Type - 7, // 1: clash.rule.geodata.router.Domain.attribute:type_name -> clash.rule.geodata.router.Domain.Attribute - 2, // 2: clash.rule.geodata.router.GeoIP.cidr:type_name -> clash.rule.geodata.router.CIDR - 3, // 3: clash.rule.geodata.router.GeoIPList.entry:type_name -> clash.rule.geodata.router.GeoIP - 1, // 4: clash.rule.geodata.router.GeoSite.domain:type_name -> clash.rule.geodata.router.Domain - 5, // 5: clash.rule.geodata.router.GeoSiteList.entry:type_name -> clash.rule.geodata.router.GeoSite +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 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 @@ -604,13 +608,13 @@ var file_rule_geodata_router_config_proto_depIdxs = []int32{ 0, // [0:6] is the sub-list for field type_name } -func init() { file_rule_geodata_router_config_proto_init() } -func file_rule_geodata_router_config_proto_init() { - if File_rule_geodata_router_config_proto != nil { +func init() { file_component_geodata_router_config_proto_init() } +func file_component_geodata_router_config_proto_init() { + if File_component_geodata_router_config_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_rule_geodata_router_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_component_geodata_router_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Domain); i { case 0: return &v.state @@ -622,7 +626,7 @@ func file_rule_geodata_router_config_proto_init() { return nil } } - file_rule_geodata_router_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_component_geodata_router_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*CIDR); i { case 0: return &v.state @@ -634,7 +638,7 @@ func file_rule_geodata_router_config_proto_init() { return nil } } - file_rule_geodata_router_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_component_geodata_router_config_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GeoIP); i { case 0: return &v.state @@ -646,7 +650,7 @@ func file_rule_geodata_router_config_proto_init() { return nil } } - file_rule_geodata_router_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_component_geodata_router_config_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GeoIPList); i { case 0: return &v.state @@ -658,7 +662,7 @@ func file_rule_geodata_router_config_proto_init() { return nil } } - file_rule_geodata_router_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_component_geodata_router_config_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GeoSite); i { case 0: return &v.state @@ -670,7 +674,7 @@ func file_rule_geodata_router_config_proto_init() { return nil } } - file_rule_geodata_router_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_component_geodata_router_config_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GeoSiteList); i { case 0: return &v.state @@ -682,7 +686,7 @@ func file_rule_geodata_router_config_proto_init() { return nil } } - file_rule_geodata_router_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_component_geodata_router_config_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Domain_Attribute); i { case 0: return &v.state @@ -695,7 +699,7 @@ func file_rule_geodata_router_config_proto_init() { } } } - file_rule_geodata_router_config_proto_msgTypes[6].OneofWrappers = []interface{}{ + file_component_geodata_router_config_proto_msgTypes[6].OneofWrappers = []interface{}{ (*Domain_Attribute_BoolValue)(nil), (*Domain_Attribute_IntValue)(nil), } @@ -703,19 +707,19 @@ func file_rule_geodata_router_config_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_rule_geodata_router_config_proto_rawDesc, + RawDescriptor: file_component_geodata_router_config_proto_rawDesc, NumEnums: 1, NumMessages: 7, NumExtensions: 0, NumServices: 0, }, - GoTypes: file_rule_geodata_router_config_proto_goTypes, - DependencyIndexes: file_rule_geodata_router_config_proto_depIdxs, - EnumInfos: file_rule_geodata_router_config_proto_enumTypes, - MessageInfos: file_rule_geodata_router_config_proto_msgTypes, + GoTypes: file_component_geodata_router_config_proto_goTypes, + DependencyIndexes: file_component_geodata_router_config_proto_depIdxs, + EnumInfos: file_component_geodata_router_config_proto_enumTypes, + MessageInfos: file_component_geodata_router_config_proto_msgTypes, }.Build() - File_rule_geodata_router_config_proto = out.File - file_rule_geodata_router_config_proto_rawDesc = nil - file_rule_geodata_router_config_proto_goTypes = nil - file_rule_geodata_router_config_proto_depIdxs = nil + File_component_geodata_router_config_proto = out.File + file_component_geodata_router_config_proto_rawDesc = nil + file_component_geodata_router_config_proto_goTypes = nil + file_component_geodata_router_config_proto_depIdxs = nil } diff --git a/rule/geodata/router/config.proto b/component/geodata/router/config.proto similarity index 83% rename from rule/geodata/router/config.proto rename to component/geodata/router/config.proto index 9e327d1a..245faadf 100644 --- a/rule/geodata/router/config.proto +++ b/component/geodata/router/config.proto @@ -1,9 +1,9 @@ syntax = "proto3"; -package clash.rule.geodata.router; -option csharp_namespace = "Clash.Rule.Geodata.Router"; -option go_package = "github.com/Dreamacro/clash/rule/geodata/router"; -option java_package = "com.clash.rule.geodata.router"; +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"; option java_multiple_files = true; // Domain for routing decision. diff --git a/rule/geodata/standard/standard.go b/component/geodata/standard/standard.go similarity index 91% rename from rule/geodata/standard/standard.go rename to component/geodata/standard/standard.go index 190b5bdc..d65dd68c 100644 --- a/rule/geodata/standard/standard.go +++ b/component/geodata/standard/standard.go @@ -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/Dreamacro/clash/rule/geodata" - "github.com/Dreamacro/clash/rule/geodata/router" "google.golang.org/protobuf/proto" ) @@ -17,7 +17,9 @@ func ReadFile(path string) ([]byte, error) { if err != nil { return nil, err } - defer reader.Close() + defer func(reader *os.File) { + _ = reader.Close() + }(reader) return io.ReadAll(reader) } diff --git a/rule/geodata/strmatcher/ac_automaton_matcher.go b/component/geodata/strmatcher/ac_automaton_matcher.go similarity index 100% rename from rule/geodata/strmatcher/ac_automaton_matcher.go rename to component/geodata/strmatcher/ac_automaton_matcher.go diff --git a/rule/geodata/strmatcher/domain_matcher.go b/component/geodata/strmatcher/domain_matcher.go similarity index 100% rename from rule/geodata/strmatcher/domain_matcher.go rename to component/geodata/strmatcher/domain_matcher.go diff --git a/rule/geodata/strmatcher/full_matcher.go b/component/geodata/strmatcher/full_matcher.go similarity index 100% rename from rule/geodata/strmatcher/full_matcher.go rename to component/geodata/strmatcher/full_matcher.go diff --git a/rule/geodata/strmatcher/matchers.go b/component/geodata/strmatcher/matchers.go similarity index 100% rename from rule/geodata/strmatcher/matchers.go rename to component/geodata/strmatcher/matchers.go diff --git a/rule/geodata/strmatcher/mph_matcher.go b/component/geodata/strmatcher/mph_matcher.go similarity index 100% rename from rule/geodata/strmatcher/mph_matcher.go rename to component/geodata/strmatcher/mph_matcher.go diff --git a/rule/geodata/strmatcher/package_info.go b/component/geodata/strmatcher/package_info.go similarity index 100% rename from rule/geodata/strmatcher/package_info.go rename to component/geodata/strmatcher/package_info.go diff --git a/rule/geodata/strmatcher/strmatcher.go b/component/geodata/strmatcher/strmatcher.go similarity index 100% rename from rule/geodata/strmatcher/strmatcher.go rename to component/geodata/strmatcher/strmatcher.go diff --git a/component/script/clash_module.go b/component/script/clash_module.go index 21ed551e..5fccb4c1 100644 --- a/component/script/clash_module.go +++ b/component/script/clash_module.go @@ -315,9 +315,9 @@ func NewClashPyContext(ruleProvidersName []string) error { cArrPointer = unsafe.Pointer(&cStringArr[0]) } - rs := int(C.new_clash_py_context((**C.char)(cArrPointer), C.int(length))) + rs := C.new_clash_py_context((**C.char)(cArrPointer), C.int(length)) - if rs == 0 { + if int(rs) == 0 { err := PyLastError() return fmt.Errorf("new script module context failure: %s", err.Error()) } diff --git a/main.go b/main.go index d17e0246..d1376b8b 100644 --- a/main.go +++ b/main.go @@ -46,7 +46,7 @@ func init() { } func main() { - maxprocs.Set(maxprocs.Logger(func(string, ...interface{}) {})) + _, _ = maxprocs.Set(maxprocs.Logger(func(string, ...interface{}) {})) if version { fmt.Printf("Clash Plus Pro %s %s %s with %s %s\n", C.Version, runtime.GOOS, runtime.GOARCH, runtime.Version(), C.BuildTime) return diff --git a/rule/geosite.go b/rule/geosite.go index 8729138e..9849549d 100644 --- a/rule/geosite.go +++ b/rule/geosite.go @@ -3,12 +3,12 @@ package rules import ( "fmt" + "github.com/Dreamacro/clash/component/geodata" + "github.com/Dreamacro/clash/component/geodata/router" C "github.com/Dreamacro/clash/constant" "github.com/Dreamacro/clash/log" - "github.com/Dreamacro/clash/rule/geodata" - //_ "github.com/Dreamacro/clash/rule/geodata/memconservative" - "github.com/Dreamacro/clash/rule/geodata/router" - _ "github.com/Dreamacro/clash/rule/geodata/standard" + + _ "github.com/Dreamacro/clash/component/geodata/standard" ) type GEOSITE struct {