1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-07-26 11:44:22 -04:00

Fix: Charset of ACAutomationMatcherGroup should accept all ASCII characters (#1988)

This commit is contained in:
Vigilans 2022-11-29 10:35:49 +08:00 committed by GitHub
parent 1a01f2ca4d
commit 291b5466de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,7 @@ import (
) )
const ( const (
acValidCharCount = 38 // aA-zZ (26), 0-9 (10), - (1), . (1) acValidCharCount = 39 // aA-zZ (26), 0-9 (10), - (1), . (1), invalid(1)
acMatchTypeCount = 3 // Full, Domain and Substr acMatchTypeCount = 3 // Full, Domain and Substr
) )
@ -214,69 +214,69 @@ func (ac *ACAutomatonMatcherGroup) MatchAny(input string) bool {
// //
// If for future the strmatcher are used for other scenarios than domain, // If for future the strmatcher are used for other scenarios than domain,
// we could add a new Charset interface to represent variable charsets. // we could add a new Charset interface to represent variable charsets.
var acCharset = []int{ var acCharset = [256]int{
'A': 0, 'A': 1,
'a': 0, 'a': 1,
'B': 1, 'B': 2,
'b': 1, 'b': 2,
'C': 2, 'C': 3,
'c': 2, 'c': 3,
'D': 3, 'D': 4,
'd': 3, 'd': 4,
'E': 4, 'E': 5,
'e': 4, 'e': 5,
'F': 5, 'F': 6,
'f': 5, 'f': 6,
'G': 6, 'G': 7,
'g': 6, 'g': 7,
'H': 7, 'H': 8,
'h': 7, 'h': 8,
'I': 8, 'I': 9,
'i': 8, 'i': 9,
'J': 9, 'J': 10,
'j': 9, 'j': 10,
'K': 10, 'K': 11,
'k': 10, 'k': 11,
'L': 11, 'L': 12,
'l': 11, 'l': 12,
'M': 12, 'M': 13,
'm': 12, 'm': 13,
'N': 13, 'N': 14,
'n': 13, 'n': 14,
'O': 14, 'O': 15,
'o': 14, 'o': 15,
'P': 15, 'P': 16,
'p': 15, 'p': 16,
'Q': 16, 'Q': 17,
'q': 16, 'q': 17,
'R': 17, 'R': 18,
'r': 17, 'r': 18,
'S': 18, 'S': 19,
's': 18, 's': 19,
'T': 19, 'T': 20,
't': 19, 't': 20,
'U': 20, 'U': 21,
'u': 20, 'u': 21,
'V': 21, 'V': 22,
'v': 21, 'v': 22,
'W': 22, 'W': 23,
'w': 22, 'w': 23,
'X': 23, 'X': 24,
'x': 23, 'x': 24,
'Y': 24, 'Y': 25,
'y': 24, 'y': 25,
'Z': 25, 'Z': 26,
'z': 25, 'z': 26,
'-': 26, '-': 27,
'.': 27, '.': 28,
'0': 28, '0': 29,
'1': 29, '1': 30,
'2': 30, '2': 31,
'3': 31, '3': 32,
'4': 32, '4': 33,
'5': 33, '5': 34,
'6': 34, '6': 35,
'7': 35, '7': 36,
'8': 36, '8': 37,
'9': 37, '9': 38,
} }