github.com/xxf098/lite-proxy@v0.15.1-0.20230422081941-12c69f323218/README.md (about) 1 # LiteSpeedTest 2 3 LiteSpeedTest is a simple tool for batch test ss/ssr/v2ray/trojan/clash servers. 4 Feature 5 - 支持ss/ssr/v2ray/trojan/clash订阅链接 6 - 支持ss/ssr/v2ray/trojan/clash节点链接 7 - 支持ss/ssr/v2ray/trojan/clash订阅或节点文件 8 - support ss/ssr/v2ray/trojan/clash subscription url, 9 - support ss/ssr/v2ray/trojan/clash profile links 10 - support ss/ssr/v2ray/trojan/clash subscription or profile file, 11 12 13 ![build](https://github.com/xxf098/LiteSpeedTest/actions/workflows/test.yaml/badge.svg?branch=master&event=push) 14 15 ### Usage 16 ``` 17 Run as a speed test tool: 18 # run this command then open http://127.0.0.1:10888/ in your browser to start speed test 19 ./lite 20 # start with another port 21 ./lite -p 10889 22 23 # test in command line only mode 24 ./lite --test https://raw.githubusercontent.com/freefq/free/master/v2 25 # test in command line only mode with custom config. 26 ./lite --config config.json --test https://raw.githubusercontent.com/freefq/free/master/v2 27 # details can find here https://github.com/xxf098/LiteSpeedTest/blob/master/config.json 28 # all config options: 29 # "group":"job", // group name 30 # "speedtestMode":"pingonly", // speedonly pingonly all 31 # "pingMethod":"googleping", // googleping tcpping 32 # "sortMethod":"rspeed", // speed rspeed ping rping 33 # "concurrency":1, // concurrency number 34 # "testMode":2, // 2: ALLTEST 3: RETEST 35 # "subscription":"subscription url", 36 # "timeout":16, // timeout in seconds 37 # "language":"en", // en cn 38 # "fontSize":24, 39 # "unique": true, // remove duplicated value 40 # "theme":"rainbow", 41 # "outputMode": 1 // 0: base64 1: pic path 2: no pic 3: json 4: txt 42 43 44 Run as a grpc server: 45 # start the grpc server 46 ./lite -grpc -p 10999 47 # grpc go client example in ./api/rpc/liteclient/client.go 48 # grpc python client example in ./api/rpc/liteclientpy/client.py 49 50 Run as a http/socks5 proxy: 51 # use default port 8090 52 ./lite vmess://aHR0cHM6Ly9naXRodWIuY29tL3h4ZjA5OC9MaXRlU3BlZWRUZXN0 53 ./lite ssr://aHR0cHM6Ly9naXRodWIuY29tL3h4ZjA5OC9MaXRlU3BlZWRUZXN0 54 # use another port 55 ./lite -p 8091 vmess://aHR0cHM6Ly9naXRodWIuY29tL3h4ZjA5OC9MaXRlU3BlZWRUZXN0 56 ``` 57 58 ### Build 59 ```bash 60 # require go>=1.18.1, nodejs >= 14 61 # build frontend 62 cp $(go env GOROOT)/misc/wasm/wasm_exec.js ./web/gui/wasm_exec.js 63 npm install --prefix web/gui build 64 npm run --prefix web/gui build 65 GOOS=js GOARCH=wasm go get -u ./... 66 GOOS=js GOARCH=wasm go build -o ./web/gui/dist/main.wasm ./wasm 67 go build -o lite 68 ``` 69 70 ### Docker 71 ```bash 72 docker build --network=host -t lite:$(git describe --tags --abbrev=0) -f ./docker/Dockerfile ./ 73 docker run -p 10888:10888/tcp lite:$(git describe --tags --abbrev=0) 74 ``` 75 76 ## Credits 77 78 - [clash](https://github.com/Dreamacro/clash) 79 - [stairspeedtest-reborn](https://github.com/tindy2013/stairspeedtest-reborn) 80 - [gg](https://github.com/fogleman/gg) 81 82 ## Developer 83 ```golang 84 import ( 85 "context" 86 "fmt" 87 "time" 88 "github.com/xxf098/lite-proxy/web" 89 ) 90 // see more details in ./examples 91 func testPing() error { 92 ctx := context.Background() 93 link := "https://www.example.com/subscription/link" 94 opts := web.ProfileTestOptions{ 95 GroupName: "Default", 96 SpeedTestMode: "pingonly", // pingonly speedonly all 97 PingMethod: "googleping", // googleping 98 SortMethod: "rspeed", // speed rspeed ping rping 99 Concurrency: 2, 100 TestMode: 2, 101 Subscription: link, 102 Language: "en", // en cn 103 FontSize: 24, 104 Theme: "rainbow", 105 Unique: true, 106 Timeout: 10 * time.Second, 107 OutputMode: 0, 108 } 109 nodes, err := web.TestContext(ctx, opts, &web.EmptyMessageWriter{}) 110 if err != nil { 111 return err 112 } 113 // get all ok profile 114 for _, node := range nodes { 115 if node.IsOk { 116 fmt.Println(node.Remarks) 117 } 118 } 119 return nil 120 } 121 ```