mirror of
https://github.com/daeuniverse/dae.git
synced 2025-07-20 04:38:40 +07:00
fix: cannot route for sniffed domain with port (#542)
Co-authored-by: Sumire (菫) <151038614+sumire88@users.noreply.github.com>
This commit is contained in:
@ -100,11 +100,12 @@ func (n *AhocorasickSlimtrie) MatchDomainBitmap(domain string) (bitmap []uint32)
|
||||
bitmap = make([]uint32, N)
|
||||
domain = strings.ToLower(strings.TrimSuffix(domain, "."))
|
||||
// Domain should consist of 'a'-'z' and '.' and '-'
|
||||
for _, b := range []byte(domain) {
|
||||
if !ahocorasick.IsValidChar(b) {
|
||||
return bitmap
|
||||
}
|
||||
}
|
||||
// NOTE: DO NOT VERIFY THE DOMAIN TO MATCH: https://github.com/daeuniverse/dae/issues/528
|
||||
// for _, b := range []byte(domain) {
|
||||
// if !ahocorasick.IsValidChar(b) {
|
||||
// return bitmap
|
||||
// }
|
||||
// }
|
||||
// Suffix matching.
|
||||
suffixTrieDomain := ToSuffixTrieString("^" + domain)
|
||||
for _, i := range n.validTrieIndexes {
|
||||
|
@ -6,11 +6,12 @@
|
||||
package domain_matcher
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/daeuniverse/dae/common/consts"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/exp/slices"
|
||||
"math/rand"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAhocorasickSlimtrie(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user