support regex domain type in dns

pull/1289/head
Darien Raymond 2018-09-19 16:10:42 +02:00
parent 94b880d060
commit 5649c7ba2d
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
3 changed files with 43 additions and 34 deletions

View File

@ -24,18 +24,21 @@ const (
DomainMatchingType_Full DomainMatchingType = 0
DomainMatchingType_Subdomain DomainMatchingType = 1
DomainMatchingType_Keyword DomainMatchingType = 2
DomainMatchingType_Regex DomainMatchingType = 3
)
var DomainMatchingType_name = map[int32]string{
0: "Full",
1: "Subdomain",
2: "Keyword",
3: "Regex",
}
var DomainMatchingType_value = map[string]int32{
"Full": 0,
"Subdomain": 1,
"Keyword": 2,
"Regex": 3,
}
func (x DomainMatchingType) String() string {
@ -60,6 +63,7 @@ func (*NameServer) ProtoMessage() {}
func (*NameServer) Descriptor() ([]byte, []int) {
return fileDescriptor_ed5695198e3def8f, []int{0}
}
func (m *NameServer) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NameServer.Unmarshal(m, b)
}
@ -106,6 +110,7 @@ func (*NameServer_PriorityDomain) ProtoMessage() {}
func (*NameServer_PriorityDomain) Descriptor() ([]byte, []int) {
return fileDescriptor_ed5695198e3def8f, []int{0, 0}
}
func (m *NameServer_PriorityDomain) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_NameServer_PriorityDomain.Unmarshal(m, b)
}
@ -161,6 +166,7 @@ func (*Config) ProtoMessage() {}
func (*Config) Descriptor() ([]byte, []int) {
return fileDescriptor_ed5695198e3def8f, []int{1}
}
func (m *Config) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Config.Unmarshal(m, b)
}
@ -231,6 +237,7 @@ func (*Config_HostMapping) ProtoMessage() {}
func (*Config_HostMapping) Descriptor() ([]byte, []int) {
return fileDescriptor_ed5695198e3def8f, []int{1, 1}
}
func (m *Config_HostMapping) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Config_HostMapping.Unmarshal(m, b)
}
@ -284,38 +291,38 @@ func init() {
}
var fileDescriptor_ed5695198e3def8f = []byte{
// 516 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0xd1, 0x6e, 0xd3, 0x3e,
0x18, 0xc5, 0xff, 0x49, 0xda, 0x6e, 0xfd, 0xd2, 0x7f, 0x55, 0x7c, 0x31, 0x55, 0x45, 0x82, 0x32,
0xc4, 0xa8, 0x40, 0x38, 0x52, 0x40, 0x02, 0x7a, 0x33, 0xb1, 0xad, 0x88, 0x0a, 0x0d, 0xaa, 0x0c,
0x71, 0x01, 0x48, 0x95, 0x17, 0x9b, 0xce, 0xa2, 0xb1, 0x8d, 0xed, 0x16, 0x85, 0x37, 0x40, 0xbc,
0x09, 0x4f, 0x89, 0x6a, 0x77, 0xb4, 0xb0, 0x0e, 0xb8, 0xe1, 0xae, 0x76, 0xcf, 0xef, 0x3b, 0x27,
0xe7, 0x4b, 0xe0, 0xe6, 0x3c, 0xd5, 0xa4, 0xc4, 0xb9, 0x2c, 0x92, 0x5c, 0x6a, 0x96, 0x10, 0xa5,
0x12, 0x2a, 0x4c, 0x92, 0x4b, 0xf1, 0x9e, 0x4f, 0xb0, 0xd2, 0xd2, 0x4a, 0x84, 0xce, 0x45, 0x9a,
0x61, 0xa2, 0x14, 0xa6, 0xc2, 0x74, 0x6e, 0xff, 0x02, 0xe6, 0xb2, 0x28, 0xa4, 0x48, 0x04, 0xb3,
0x09, 0xa1, 0x54, 0x33, 0x63, 0x3c, 0xdc, 0xb9, 0x7b, 0xb9, 0x90, 0x32, 0x63, 0xb9, 0x20, 0x96,
0x4b, 0xe1, 0xc5, 0xbb, 0x5f, 0x43, 0x80, 0x17, 0xa4, 0x60, 0x27, 0x4c, 0xcf, 0x99, 0x46, 0x8f,
0x61, 0x6b, 0x39, 0xac, 0x1d, 0x74, 0x83, 0x5e, 0x9c, 0x5e, 0xc7, 0x6b, 0x51, 0xfc, 0x24, 0x2c,
0x98, 0xc5, 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c5, 0x99, 0xec, 0xfd, 0xc1, 0xe4, 0x98, 0x28,
0xc5, 0xc5, 0x24, 0x8b, 0x3d, 0xeb, 0x7c, 0x3a, 0x6f, 0x01, 0x56, 0x01, 0x50, 0x0b, 0xa2, 0x0f,
0xac, 0x74, 0xcb, 0xa9, 0x67, 0x8b, 0x9f, 0xe8, 0x21, 0x54, 0xe7, 0x64, 0x3a, 0x63, 0xae, 0xf2,
0x38, 0xbd, 0x71, 0x49, 0x95, 0xc3, 0xd1, 0x4b, 0xbd, 0x7c, 0x0d, 0xbc, 0xbe, 0x1f, 0x3e, 0x0a,
0x3a, 0x1f, 0x21, 0x5e, 0x33, 0xfe, 0x17, 0xbb, 0x47, 0x4d, 0x08, 0x5d, 0x41, 0x51, 0xaf, 0x91,
0x85, 0x5c, 0xdd, 0xe9, 0x03, 0xba, 0x38, 0x03, 0x6d, 0x43, 0xe5, 0xe9, 0x6c, 0x3a, 0x6d, 0xfd,
0x87, 0xfe, 0x87, 0xfa, 0xc9, 0xec, 0xd4, 0xc3, 0xad, 0x00, 0xc5, 0xb0, 0xf5, 0x9c, 0x95, 0x9f,
0xa4, 0xa6, 0xad, 0xf0, 0xe0, 0x01, 0xec, 0xe4, 0xb2, 0xd8, 0x10, 0x6b, 0x14, 0xbc, 0x89, 0xa8,
0x30, 0xdf, 0x42, 0xf4, 0x3a, 0xcd, 0x48, 0x89, 0x0f, 0x17, 0xff, 0x3d, 0x51, 0x0a, 0x1f, 0x09,
0x73, 0x5a, 0x73, 0x9f, 0xe4, 0xfd, 0xef, 0x01, 0x00, 0x00, 0xff, 0xff, 0x78, 0xfa, 0x21, 0x21,
0x23, 0x04, 0x00, 0x00,
// 523 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0xd1, 0x6e, 0xd3, 0x30,
0x18, 0x85, 0x49, 0xd2, 0x76, 0xeb, 0x9f, 0x52, 0x15, 0x5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4e, 0xa6, 0xcc, 0x55, 0x1e, 0xa7,
0x37, 0x2e, 0xa8, 0x72, 0x30, 0x7c, 0xa9, 0x17, 0xaf, 0x81, 0xd7, 0xef, 0x86, 0x8f, 0x82, 0xce,
0x47, 0x88, 0x57, 0x8c, 0xff, 0xc7, 0xee, 0x51, 0x13, 0x42, 0x57, 0x50, 0xd4, 0x6b, 0x90, 0x90,
0xab, 0x3b, 0x7d, 0x40, 0xe7, 0x67, 0xa0, 0x4d, 0xa8, 0x3c, 0x9d, 0x4e, 0x26, 0xad, 0x4b, 0xe8,
0x32, 0xd4, 0x8f, 0xa7, 0x27, 0x1e, 0x6e, 0x05, 0x28, 0x86, 0x8d, 0xe7, 0xac, 0xfc, 0x24, 0x75,
0xde, 0x0a, 0x51, 0x1d, 0xaa, 0x84, 0x8d, 0xd9, 0xe7, 0x56, 0xb4, 0xff, 0x00, 0xb6, 0x32, 0x59,
0xac, 0x49, 0x38, 0x0c, 0xde, 0x44, 0xb9, 0x30, 0xdf, 0x43, 0xf4, 0x3a, 0x25, 0xb4, 0xc4, 0x07,
0xf3, 0xff, 0x9e, 0x28, 0x85, 0x0f, 0x85, 0x39, 0xa9, 0xb9, 0xaf, 0xf3, 0xfe, 0x8f, 0x00, 0x00,
0x00, 0xff, 0xff, 0x32, 0xd5, 0xea, 0x6d, 0x2e, 0x04, 0x00, 0x00,
}

View File

@ -24,6 +24,7 @@ enum DomainMatchingType {
Full = 0;
Subdomain = 1;
Keyword = 2;
Regex = 3;
}
message Config {

View File

@ -15,6 +15,7 @@ var typeMap = map[DomainMatchingType]strmatcher.Type{
DomainMatchingType_Full: strmatcher.Full,
DomainMatchingType_Subdomain: strmatcher.Domain,
DomainMatchingType_Keyword: strmatcher.Substr,
DomainMatchingType_Regex: strmatcher.Regex,
}
func toStrMatcher(t DomainMatchingType, domain string) (strmatcher.Matcher, error) {