forked from bepass-org/warp-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
47 lines (40 loc) · 1.28 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"context"
"flag"
"github.com/bepass-org/wireguard-go/app"
"log"
"os"
"os/signal"
"syscall"
)
func usage() {
log.Println("Usage: wiresocks [-v] [-b addr:port] [-l license] <config file path>")
flag.PrintDefaults()
}
func main() {
var (
verbose = flag.Bool("v", false, "verbose")
bindAddress = flag.String("b", "127.0.0.1:8086", "socks bind address")
endpoint = flag.String("e", "notset", "warp clean ip")
license = flag.String("k", "notset", "license key")
country = flag.String("country", "", "psiphon country code in ISO 3166-1 alpha-2 format")
psiphonEnabled = flag.Bool("cfon", false, "enable psiphonEnabled over warp")
gool = flag.Bool("gool", false, "enable warp gooling")
scan = flag.Bool("scan", false, "enable warp scanner(experimental)")
rtt = flag.Int("rtt", 1000, "scanner rtt threshold, default 1000")
)
flag.Usage = usage
flag.Parse()
sigchan := make(chan os.Signal)
signal.Notify(sigchan, os.Interrupt, syscall.SIGTERM)
ctx, cancel := context.WithCancel(context.Background())
go func() {
err := app.RunWarp(*psiphonEnabled, *gool, *scan, *verbose, *country, *bindAddress, *endpoint, *license, ctx, *rtt)
if err != nil {
log.Fatal(err)
}
}()
<-sigchan
cancel()
}