Fix convert root domain

This commit is contained in:
世界 2022-07-07 23:38:22 +08:00
parent d80854f857
commit 9058c3c775
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4
5 changed files with 21 additions and 13 deletions

6
.github/update_dependencies.sh vendored Executable file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
PROJECTS=$(dirname "$0")/../..
go get -x github.com/sagernet/sing-box@$(git -C $PROJECTS/sing-box rev-parse HEAD)
go mod tidy

View File

@ -2,7 +2,7 @@ name: Release
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 1"
- cron: "0 0 * * *"
jobs:
build:
name: Build

4
go.mod
View File

@ -4,8 +4,8 @@ go 1.18
require (
github.com/google/go-github/v45 v45.2.0
github.com/sagernet/sing v0.0.0-20220705005401-57d12d875b7a
github.com/sagernet/sing-box v0.0.0-20220705010535-8392567962ac
github.com/sagernet/sing v0.0.0-20220707133944-6a0987c52ae4
github.com/sagernet/sing-box v0.0.0-20220708030046-d45007b50105
github.com/sirupsen/logrus v1.8.1
github.com/v2fly/v2ray-core/v5 v5.0.7
google.golang.org/protobuf v1.28.0

12
go.sum
View File

@ -17,16 +17,16 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sagernet/sing v0.0.0-20220705005401-57d12d875b7a h1:FhrHCkox9scuTzcT5DDh6flVLFuqU+QSk3VONd41I+o=
github.com/sagernet/sing v0.0.0-20220705005401-57d12d875b7a/go.mod h1:3ZmoGNg/nNJTyHAZFNRSPaXpNIwpDvyIiAUd0KIWV5c=
github.com/sagernet/sing-box v0.0.0-20220705010535-8392567962ac h1:oGv23zqrGbSENOPCnUlT6s1L0ZGnksAZz6mNgJb7WOc=
github.com/sagernet/sing-box v0.0.0-20220705010535-8392567962ac/go.mod h1:Y+TVnQmBOShqlXwZ5bQIByfV4CRERky24YWWy91XSe0=
github.com/sagernet/sing v0.0.0-20220707133944-6a0987c52ae4 h1:nV/DyNi+O1VxNoChD5E9M6Y0VoFdVr0UEW9h9JnqxNs=
github.com/sagernet/sing v0.0.0-20220707133944-6a0987c52ae4/go.mod h1:3ZmoGNg/nNJTyHAZFNRSPaXpNIwpDvyIiAUd0KIWV5c=
github.com/sagernet/sing-box v0.0.0-20220708030046-d45007b50105 h1:MC20nFhcQaJjQiMahWidatu1fzVdGl69koGRo9f5HHE=
github.com/sagernet/sing-box v0.0.0-20220708030046-d45007b50105/go.mod h1:K04trGDX9XELM/8iqkTxq4DCj1RxrgqfMOJg7m8yoHA=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/v2fly/v2ray-core/v5 v5.0.7 h1:wR8x5KyYpe0W35tcJz/dlkpCClDhc/xe+36BQjVV3EM=
github.com/v2fly/v2ray-core/v5 v5.0.7/go.mod h1:whgevEWmA6LrAfnPoM97IGMYhUF8837sAZ4U6MNJfzk=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
@ -42,4 +42,4 @@ google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscL
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@ -102,10 +102,12 @@ func parse(vGeositeData []byte) (map[string][]geosite.Item, error) {
Value: domain.Value,
})
case routercommon.Domain_RootDomain:
if strings.Contains(domain.Value, ".") {
domains = append(domains, geosite.Item{
Type: geosite.RuleTypeDomain,
Value: domain.Value,
})
}
domains = append(domains, geosite.Item{
Type: geosite.RuleTypeDomainSuffix,
Value: "." + domain.Value,