Skip to content

Commit

Permalink
debug and rollback sing-box version
Browse files Browse the repository at this point in the history
  • Loading branch information
uussoop committed Sep 8, 2023
1 parent 6670a51 commit c1df157
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
3 changes: 1 addition & 2 deletions core/singbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func RunByLink(wg *sync.WaitGroup, config *[]byte, ctx context.Context, kills *c
select {
case <-ctx.Done():
// exit gracefully
fmt.Println("Context is done3")

// closeCtx, closed := context.WithCancel(ctx)
// go closeMonitor(closeCtx)
Expand All @@ -88,7 +87,7 @@ func RunByLink(wg *sync.WaitGroup, config *[]byte, ctx context.Context, kills *c
case k := <-*kills:

if k {
fmt.Println("kill")

// closeCtx, closed := context.WithCancel(ctx)
// go closeMonitor(closeCtx)

Expand Down
2 changes: 1 addition & 1 deletion foreignusage/api/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func testHandler(c *gin.Context) {

select {
case <-done:
fmt.Println("test done")

cancel()
return

Expand Down
6 changes: 5 additions & 1 deletion foreignusage/api/testInterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"context"
"fmt"
"sync"

"github.com/Kawaii-Konnections-KK-Limited/Hayasashiken/run"
Expand All @@ -22,7 +23,7 @@ func getTestResultsAsService(links *[]link, timeout *int32, upperBoundPingLimit
go func(link *string, port int, i int) {
defer wg.Done()

r, _ := run.SingByLink(link, TestUrl, &port, timeout, &baseBroadcast, *ctx, &kills)
r, err := run.SingByLink(link, TestUrl, &port, timeout, &baseBroadcast, *ctx, &kills)
if r > 10 && r < *upperBoundPingLimit {
pairs = append(pairs, responseLink{
Ping: r,
Expand All @@ -33,6 +34,9 @@ func getTestResultsAsService(links *[]link, timeout *int32, upperBoundPingLimit
kills <- true

}
if err != nil {
fmt.Println(err)
}

}(&link, port, id)
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require (
github.com/gin-contrib/cors v1.4.0
github.com/gin-gonic/gin v1.9.1
github.com/sagernet/sing v0.2.10-0.20230830132630-30bf19f2833c
github.com/sagernet/sing-box v1.4.1
github.com/sagernet/sing-box v1.4.0
gorm.io/gorm v1.25.2
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2
github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk=
github.com/sagernet/sing v0.2.10-0.20230830132630-30bf19f2833c h1:J2ptRncTNy+ZHfcFYSBfTmpvmgNlSEUZz6sDjh1np/Y=
github.com/sagernet/sing v0.2.10-0.20230830132630-30bf19f2833c/go.mod h1:9uOZwWkhT2Z2WldolLxX34s+1svAX4i4vvz5hy8u1MA=
github.com/sagernet/sing-box v1.4.1 h1:t1BRLw3eeD/o7ljTeMKiOPq0tF05wAmpxDD3cEDwM9M=
github.com/sagernet/sing-box v1.4.1/go.mod h1:UYH0rmnh3HCrwuSKs4fsUpaA/X2Nc7xYTLjjiwAlXOo=
github.com/sagernet/sing-box v1.4.0 h1:2JyykriE5Ve/En6CWKcFG0WfF3djDVZqquzbJ1dMIpM=
github.com/sagernet/sing-box v1.4.0/go.mod h1:8514tWFN5VhuwSkJ6fB9KC2i7Ys7XXnstE4zSU91XXA=
github.com/sagernet/sing-dns v0.1.9-0.20230824120133-4d5cbceb40c1 h1:5w+jXz8y/8UQAxO74TjftN5okYkpg5mGvVxXunlKdqI=
github.com/sagernet/sing-dns v0.1.9-0.20230824120133-4d5cbceb40c1/go.mod h1:Kg98PBJEg/08jsNFtmZWmPomhskn9Ausn50ecNm4M+8=
github.com/sagernet/sing-mux v0.1.3-0.20230830095209-2a10ebd53ba8 h1:UyUkEUEGqfIGqzOJ7OuJry4slgcT/qb0etDJ+89LTAs=
Expand Down
5 changes: 2 additions & 3 deletions raytest/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ func GetTest(InPort *int, Destination *string, TimeOut *int32) (int32, error) {
}},
}

// link := Destination
link := "http://youtube.com"
link := Destination
// timeout := int32(5000) // timeout in milliseconds
rtt, testerr := urlTest(client, &link, TimeOut)
rtt, testerr := urlTest(client, link, TimeOut)
if testerr != nil {
// fmt.Println("Error:", testerr)
return 0, testerr
Expand Down
2 changes: 1 addition & 1 deletion run/bylink.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func SingByLink(Rawurl *string, Testurl *string, InputPort *int, TimeOut *int32,
res, err := raytest.GetTest(InputPort, Testurl, TimeOut)

if err != nil {
fmt.Println(err)

return 0, err
}
return res, nil
Expand Down

0 comments on commit c1df157

Please sign in to comment.