Skip to content

Commit 4acdf2b

Browse files
author
uoosef
committed
added rtt threshold for scan
1 parent 9f90b73 commit 4acdf2b

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

app/app.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
"time"
1616
)
1717

18-
func RunWarp(psiphonEnabled, gool, scan, verbose bool, country, bindAddress, endpoint, license string, ctx context.Context) error {
18+
func RunWarp(psiphonEnabled, gool, scan, verbose bool, country, bindAddress, endpoint, license string, ctx context.Context, rtThreshold int) error {
1919
// check if user input is not correct
2020
if (psiphonEnabled && gool) || (!psiphonEnabled && country != "") {
2121
log.Println("Wrong combination of flags!")
@@ -51,12 +51,10 @@ func RunWarp(psiphonEnabled, gool, scan, verbose bool, country, bindAddress, end
5151

5252
if scan {
5353
var err error
54-
endpoints, err = wiresocks.RunScan(&ctx)
54+
endpoints, err = wiresocks.RunScan(&ctx, rtThreshold)
5555
if err != nil {
5656
return err
5757
}
58-
log.Println("Cooling down please wait 5 seconds...")
59-
time.Sleep(5 * time.Second)
6058
}
6159

6260
if !psiphonEnabled && !gool {

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func main() {
2525
psiphonEnabled = flag.Bool("cfon", false, "enable psiphonEnabled over warp")
2626
gool = flag.Bool("gool", false, "enable warp gooling")
2727
scan = flag.Bool("scan", false, "enable warp scanner(experimental)")
28+
rtt = flag.Int("rtt", 1000, "scanner rtt threshold, default 1000")
2829
)
2930

3031
flag.Usage = usage
@@ -35,7 +36,7 @@ func main() {
3536
ctx, cancel := context.WithCancel(context.Background())
3637

3738
go func() {
38-
err := app.RunWarp(*psiphonEnabled, *gool, *scan, *verbose, *country, *bindAddress, *endpoint, *license, ctx)
39+
err := app.RunWarp(*psiphonEnabled, *gool, *scan, *verbose, *country, *bindAddress, *endpoint, *license, ctx, *rtt)
3940
if err != nil {
4041
log.Fatal(err)
4142
}

wiresocks/scanner.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func canConnectIPv6(remoteAddr string) bool {
2525
return true
2626
}
2727

28-
func RunScan(ctx *context.Context) (result []string, err error) {
28+
func RunScan(ctx *context.Context, rtt int) (result []string, err error) {
2929
cfg, err := ini.Load("./primary/wgcf-profile.ini")
3030
if err != nil {
3131
log.Printf("Failed to read file: %v", err)
@@ -45,7 +45,7 @@ func RunScan(ctx *context.Context) (result []string, err error) {
4545
ipscanner.WithWarpPeerPublicKey(publicKey),
4646
ipscanner.WithUseIPv6(canConnectIPv6("[2001:4860:4860::8888]:80")),
4747
ipscanner.WithUseIPv4(true),
48-
ipscanner.WithMaxDesirableRTT(500),
48+
ipscanner.WithMaxDesirableRTT(rtt),
4949
ipscanner.WithCidrList([]string{
5050
"162.159.192.0/24",
5151
"162.159.193.0/24",

0 commit comments

Comments
 (0)