Skip to content

Commit

Permalink
♻️ Change the automatic brushing traffic policy
Browse files Browse the repository at this point in the history
  • Loading branch information
captain686 committed Apr 30, 2024
1 parent 4154ae3 commit 8dd8bce
Show file tree
Hide file tree
Showing 4 changed files with 482 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.idea
config/*
go-warp2wireguard*
out
out/*
2 changes: 1 addition & 1 deletion config/wireguard.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ MTU = 1280
[Peer]
PublicKey = bmXOC+F1FxEMF9dyiK2H5/1SUtzH0JuVo51h2wPfgyo=
AllowedIPs = 0.0.0.0/1, 128.0.0.0/1, ::/1, 8000::/1
Endpoint = 188.114.98.6:903
Endpoint = 162.159.204.71:2408
PersistentKeepalive = 15
29 changes: 15 additions & 14 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/charmbracelet/log"
"os"
"sync"
"time"
)

//go:embed template/clash_template
Expand Down Expand Up @@ -88,20 +89,16 @@ func regAndFlow(serviceType string) error {
id := account.ID
accountToken := account.Token

//if serviceType == "wireguard" {
task(id, accountToken)
//}

if serviceType == "clash" {
go func() {
cronFunc := services.CronFunction{
Function: task,
Id: id,
AccountToken: accountToken,
}
cronFunc.CronServe()
}()
}
//go func() {
cronFunc := services.CronFunction{
Function: task,
Id: id,
AccountToken: accountToken,
}
cronFunc.CronServe()
//}()
return nil
}

Expand All @@ -121,6 +118,7 @@ func speedTest(speedSort []util.Speed) []util.Speed {
}

func main() {

flag.Parse()
if serviceType != "wireguard" && serviceType != "clash" {
flag.Usage()
Expand Down Expand Up @@ -159,12 +157,15 @@ func main() {
log.Error(err)
return
}

log.Info(fmt.Sprintf("[+] Speed test results are saved in %s", util.OutFilePath))
err = services.GenerateConf(speedSort[0].Server, publicKey)
if err != nil {
log.Error(err)
return
}


for {
time.Sleep(10 * time.Minute)
}
}
}
Loading

0 comments on commit 8dd8bce

Please sign in to comment.