fix: add _ into valid charset of ac machine (#388)

This commit is contained in:
mzz 2024-01-01 16:06:53 +08:00 committed by GitHub
parent 366fcb192a
commit d7ea7f6c1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -7,12 +7,13 @@ package domain_matcher
import (
"fmt"
"github.com/daeuniverse/dae/common/assets"
"hash/fnv"
"math/rand"
"reflect"
"testing"
"github.com/daeuniverse/dae/common/assets"
"github.com/daeuniverse/dae/common/consts"
"github.com/daeuniverse/dae/component/routing"
"github.com/daeuniverse/dae/config"
@ -93,6 +94,8 @@ var TestSample = []string{
"psbc.com",
"spdb.com.cn",
"whccb.com",
"_https._tcp.mirrors.ustc.edu.cn",
"ipv4.master.test-ipv6.com",
}
type RoutingMatcherBuilder struct {
@ -132,7 +135,9 @@ func getDomain() (simulatedDomainSet []routing.DomainSet, err error) {
var rules []*config_parser.RoutingRule
sections, err := config_parser.Parse(`
routing {
domain(suffix: test-ipv6.com)->direct
domain(geosite:bing)->us
domain(_https._tcp.mirrors.ustc.edu.cn)->us
domain(full:dns.google.com) -> direct
domain(geosite:category-ads-all) -> block
domain(geosite:cn) -> direct

2
go.mod
View File

@ -17,7 +17,7 @@ require (
github.com/safchain/ethtool v0.3.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/v2rayA/ahocorasick-domain v0.0.0-20230218160829-122a074c48c8
github.com/v2rayA/ahocorasick-domain v0.0.0-20231231085011-99ceb8ef3208
github.com/vishvananda/netlink v1.1.0
github.com/x-cray/logrus-prefixed-formatter v0.5.2
golang.org/x/crypto v0.11.0

4
go.sum
View File

@ -141,8 +141,8 @@ github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/twmb/murmur3 v1.1.6 h1:mqrRot1BRxm+Yct+vavLMou2/iJt0tNVTTC0QoIjaZg=
github.com/twmb/murmur3 v1.1.6/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ=
github.com/v2rayA/ahocorasick-domain v0.0.0-20230218160829-122a074c48c8 h1:2Liq3JvM/acVQZ7Gq9U5PpznMzlFRPYMPQxC2yXSi74=
github.com/v2rayA/ahocorasick-domain v0.0.0-20230218160829-122a074c48c8/go.mod h1:mWch8I826zic/bKaCyE9ZZbWtFgEW0ox3EQ0NGm5DGw=
github.com/v2rayA/ahocorasick-domain v0.0.0-20231231085011-99ceb8ef3208 h1:s/K1ome/+rTDictkqGhqLuAleUymyWnvgNWARjblS9U=
github.com/v2rayA/ahocorasick-domain v0.0.0-20231231085011-99ceb8ef3208/go.mod h1:mWch8I826zic/bKaCyE9ZZbWtFgEW0ox3EQ0NGm5DGw=
github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0=
github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=