Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Dec 12, 2023
1 parent 7d51b7f commit e44a320
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 35 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
if: steps.build.outputs.skip != 'true'
run: |
sha256sum geosite.db > geosite.db.sha256sum
sha256sum geosite-cn.db > geosite-cn.db.sha256sum
- uses: dev-drprasad/[email protected]
if: steps.build.outputs.skip != 'true'
with:
Expand All @@ -46,4 +47,6 @@ jobs:
tag_name: ${{ steps.build.outputs.tag }}
files: |
geosite.db
sha256sum
geosite.db.sha256sum
geosite-cn.db
geosite-cn.db.sha256sum
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ go 1.18

require (
github.com/google/go-github/v45 v45.2.0
github.com/sagernet/sing v0.2.18-0.20231129075305-eb56a60214be
github.com/sagernet/sing-box v1.6.8-0.20231129123339-5a56487cf544
github.com/v2fly/v2ray-core/v5 v5.12.1
github.com/sagernet/sing v0.2.20-0.20231211084415-35e7014b0898
github.com/sagernet/sing-box v1.8.0-beta.2
github.com/v2fly/v2ray-core/v5 v5.13.0
google.golang.org/protobuf v1.31.0
)

Expand All @@ -17,10 +17,10 @@ require (
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/miekg/dns v1.1.57 // indirect
github.com/sagernet/sing-dns v0.1.11 // indirect
go4.org/netipx v0.0.0-20230824141953-6213f710f925 // indirect
golang.org/x/crypto v0.15.0 // indirect
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.14.0 // indirect
golang.org/x/tools v0.15.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/tools v0.16.0 // indirect
)
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM=
github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk=
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.2.18-0.20231129075305-eb56a60214be h1:FigAM9kq7RRXmHvgn8w2a8tqCY5CMV5GIk0id84dI0o=
github.com/sagernet/sing v0.2.18-0.20231129075305-eb56a60214be/go.mod h1:OL6k2F0vHmEzXz2KW19qQzu172FDgSbUSODylighuVo=
github.com/sagernet/sing-box v1.6.8-0.20231129123339-5a56487cf544 h1:kHe9kQpKMEmGJbTdDntXA0rl1BdQWQZtkDaxmZkAPC4=
github.com/sagernet/sing-box v1.6.8-0.20231129123339-5a56487cf544/go.mod h1:C5Gcyr9BsHs1Iq7eAY53hAlh/j+5fjJVsLA18z/7ZL4=
github.com/sagernet/sing v0.2.20-0.20231211084415-35e7014b0898 h1:ZR0wpw4/0NCICOX10SIUW8jpPVV7+D98nGA6p4zWICo=
github.com/sagernet/sing v0.2.20-0.20231211084415-35e7014b0898/go.mod h1:Ce5LNojQOgOiWhiD8pPD6E9H7e2KgtOe3Zxx4Ou5u80=
github.com/sagernet/sing-box v1.8.0-beta.2 h1:PV3gKkCPp0NukunOBV1Mfk96Q4tdOmdQOm4ClfxykfE=
github.com/sagernet/sing-box v1.8.0-beta.2/go.mod h1:h12nw76KkB1A2JT1HUNN9fyTUFPZT3zG3EqTuTCLbmU=
github.com/sagernet/sing-dns v0.1.11 h1:PPrMCVVrAeR3f5X23I+cmvacXJ+kzuyAsBiWyUKhGSE=
github.com/sagernet/sing-dns v0.1.11/go.mod h1:zJ/YjnYB61SYE+ubMcMqVdpaSvsyQ2iShQGO3vuLvvE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/v2fly/v2ray-core/v5 v5.12.1 h1:y7xdWEjQcjcNRjBbvFqWx9fdM/uMAp5kvy7xg45GQWk=
github.com/v2fly/v2ray-core/v5 v5.12.1/go.mod h1:97vMnLdw9DdKPR+ZmHL1Qd7By5jMzE5vW5936et9nI0=
go4.org/netipx v0.0.0-20230824141953-6213f710f925 h1:eeQDDVKFkx0g4Hyy8pHgmZaK0EqB4SD6rvKbUdN3ziQ=
go4.org/netipx v0.0.0-20230824141953-6213f710f925/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
github.com/v2fly/v2ray-core/v5 v5.13.0 h1:BDJfi3Ftx1NpQlZZPpeWJe3RDqRNyIVBs+YGG4RRMDU=
github.com/v2fly/v2ray-core/v5 v5.13.0/go.mod h1:Bc3gmQWLr8UR7xBSCYI9FbfKuVvqA9lbkeBTWNRRAS4=
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M=
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q=
golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/tools v0.16.0 h1:GO788SKMRunPIBCXiQyo2AaexLstOrVhuAL5YwsckQM=
golang.org/x/tools v0.16.0/go.mod h1:kYVVN6I1mBNoB1OX+noeBjbRk4IUEPa7JJ+TJMEooJ0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
Expand Down
44 changes: 34 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import (
"github.com/sagernet/sing-box/common/geosite"
"github.com/sagernet/sing-box/common/srs"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
"github.com/sagernet/sing/common"
E "github.com/sagernet/sing/common/exceptions"

"github.com/google/go-github/v45/github"
"github.com/sagernet/sing-box/log"
"github.com/v2fly/v2ray-core/v5/app/router/routercommon"
"google.golang.org/protobuf/proto"
)
Expand Down Expand Up @@ -169,12 +169,7 @@ func parse(vGeositeData []byte) (map[string][]geosite.Item, error) {
return domainMap, nil
}

func generate(release *github.RepositoryRelease, output string, ruleSetOutput string) error {
outputFile, err := os.Create(output)
if err != nil {
return err
}
defer outputFile.Close()
func generate(release *github.RepositoryRelease, output string, cnOutput string, ruleSetOutput string) error {
vData, err := download(release)
if err != nil {
return err
Expand All @@ -185,10 +180,33 @@ func generate(release *github.RepositoryRelease, output string, ruleSetOutput st
}
outputPath, _ := filepath.Abs(output)
os.Stderr.WriteString("write " + outputPath + "\n")
outputFile, err := os.Create(output)
if err != nil {
return err
}
defer outputFile.Close()
err = geosite.Write(outputFile, domainMap)
if err != nil {
return err
}
cnCodes := []string{
"cn",
"geolocation-!cn",
"category-companies@cn",
}
cnDomainMap := make(map[string][]geosite.Item)
for _, cnCode := range cnCodes {
cnDomainMap[cnCode] = domainMap[cnCode]
}
cnOutputFile, err := os.Create(cnOutput)
if err != nil {
return err
}
defer cnOutputFile.Close()
err = geosite.Write(cnOutputFile, cnDomainMap)
if err != nil {
return err
}
os.RemoveAll(ruleSetOutput)
err = os.MkdirAll(ruleSetOutput, 0o755)
if err != nil {
Expand Down Expand Up @@ -228,7 +246,7 @@ func setActionOutput(name string, content string) {
os.Stdout.WriteString("::set-output name=" + name + "::" + content + "\n")
}

func release(source string, destination string, output string, ruleSetOutput string) error {
func release(source string, destination string, output string, cnOutput string, ruleSetOutput string) error {
sourceRelease, err := fetch(source)
if err != nil {
return err
Expand All @@ -243,7 +261,7 @@ func release(source string, destination string, output string, ruleSetOutput str
return nil
}
}
err = generate(sourceRelease, output, ruleSetOutput)
err = generate(sourceRelease, output, cnOutput, ruleSetOutput)
if err != nil {
return err
}
Expand All @@ -252,7 +270,13 @@ func release(source string, destination string, output string, ruleSetOutput str
}

func main() {
err := release("v2fly/domain-list-community", "sagernet/sing-geosite", "geosite.db", "rule-set")
err := release(
"v2fly/domain-list-community",
"sagernet/sing-geosite",
"geosite.db",
"geosite-cn.db",
"rule-set",
)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit e44a320

Please sign in to comment.