From 3bbbfa69ad7998f1f5317967b28e014f3224aacb Mon Sep 17 00:00:00 2001 From: DarkCat09 Date: Tue, 19 Nov 2024 13:26:43 +0400 Subject: [PATCH] refactor: move manual to bottom --- README.md | 94 +++++++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 1576c7e..747b3dd 100644 --- a/README.md +++ b/README.md @@ -18,53 +18,6 @@ SB supports many protocols and platforms, even can setup a TUN interface (like a On the other hand, Xray provides more "stealth" features to hide proxy traffic, that is important, I guess (?), in China and Iran. -## To reproduce - -- Get [sing-box](https://github.com/SagerNet/sing-box/releases/latest) - and [xray](github.com/XTLS/Xray-core/releases/latest) binaries - by downloading from "Releases" or compiling by yourself - -Benchmark 1: -- Install [hyperfine](https://github.com/sharkdp/hyperfine) -- Run `./sing-box run --config direct.json` and `./xray run -c direct_xray.json` on client - (use different terminal tabs/windows, or put one proxy to background with `&`) -- Find some binary file with size about 1.5M and upload it to your server - (because I can not guarantee that I won't delete `Marisa.m4a` used in tests; - it's an audio stream of some video downloaded from YT) -- Run - `hyperfine -m 50 'curl https://...link to the file...' 'curl --proxy socks5://127.0.0.1:2080 https://link' 'curl --proxy socks5://127.0.0.1:2081 https://link'` -- Choose some web site with a small load and no ratelimits that gives an https-redirect - with a small HTML response when accessing it by plain http, like `http://dc09.ru`, - repeat the test replacing the link -- Choose some web site with a heavy load and relatively small HTML landing, like `https://github.com`, - repeat the test replacing the link - -Benchmark 2: -- Compile [iperf3 fork with socks5 support](https://github.com/davidBar-On/iperf/tree/issue-1095-socks5-support) - by cloning git repo (don't forget that you need branch `issue-1095-socks5-support`, not master!) - and running `./configure && make` -- you'll get a built iperf in `./src/iperf3` -- Generate your own TLS cert (`cert.pem` and `key.pem` included in the repo are for `dc09.ru` domain name) - with `sing-box generate tls-keypair ` OR `xray tls cert --domain=` -- Replace `dc09.ru` in all configs to match your domain name instead of mine -- Upload sing-box and xray to your server, install iperf3 from a package manager - or upload compiled previously (on a server, you won't need socks support), - upload `server.json`, `server_xray.json`, `cert.pem` and `key.pem` -- Run `./sing-box run --config server.json &` on your server, then launch `iperf3 -s` -- In `config.json` edit the line `"final": "vless-out"` to default to `socks-out`, - the same for `config_xray.json`: edit `"outboundTag": "vless-out"` in the 2nd routing rule. -- Run `./sing-box run --config config.json` and `./xray run -c config_xray.json` on client, - sing-box will open port 2080 for a SOCKSv5 inbound, xray will open port 2081 for its inbound. -- Make tests with iperf3: - `repo_with_iperf_fork/src/iperf3 -c
--bidir --socks5 127.0.0.1:2080` - for sing-box client and `... --socks5 127.0.0.1:2081` for xray client. -- Change `"final": "socks-out"` and `"outboundTag": "socks-out"` to `trojan-out` to test with Trojan, - restart sing-box and xray on client, peform iperf3 tests, - then change default outbound back to `vless-out`, restart proxy clients again, peform tests -- Stop iperf3 server by hitting Ctrl-C, stop sing-box server proxy by bringing the task to foreground with `fg` command and hitting Ctrl-C -- Run `./xray run -c server_xray.json &` on the server, then launch `iperf3 -s` -- Repeat the tests -- Stop iperf3 with Ctrl-C, stop xray with `fg` and Ctrl-C - ## Software versions used sing-box built from dev-next branch, [26f092d](https://github.com/SagerNet/sing-box/commit/26f092da6fb0801b11c91fd5c8468e9949312e02) @@ -173,3 +126,50 @@ File: `bench_xray_*.txt` |SOCKSv5|101.5 (91.3)|103.0 (91.4)| |Trojan|100.1 (90.0)|100.5 (90.6)| |VLESS|99.6 (91.1)|102.0 (91.1)| + +## To reproduce + +- Get [sing-box](https://github.com/SagerNet/sing-box/releases/latest) + and [xray](github.com/XTLS/Xray-core/releases/latest) binaries + by downloading from "Releases" or compiling by yourself + +Benchmark 1: +- Install [hyperfine](https://github.com/sharkdp/hyperfine) +- Run `./sing-box run --config direct.json` and `./xray run -c direct_xray.json` on client + (use different terminal tabs/windows, or put one proxy to background with `&`) +- Find some binary file with size about 1.5M and upload it to your server + (because I can not guarantee that I won't delete `Marisa.m4a` used in tests; + it's an audio stream of some video downloaded from YT) +- Run + `hyperfine -m 50 'curl https://...link to the file...' 'curl --proxy socks5://127.0.0.1:2080 https://link' 'curl --proxy socks5://127.0.0.1:2081 https://link'` +- Choose some web site with a small load and no ratelimits that gives an https-redirect + with a small HTML response when accessing it by plain http, like `http://dc09.ru`, + repeat the test replacing the link +- Choose some web site with a heavy load and relatively small HTML landing, like `https://github.com`, + repeat the test replacing the link + +Benchmark 2: +- Compile [iperf3 fork with socks5 support](https://github.com/davidBar-On/iperf/tree/issue-1095-socks5-support) + by cloning git repo (don't forget that you need branch `issue-1095-socks5-support`, not master!) + and running `./configure && make` -- you'll get a built iperf in `./src/iperf3` +- Generate your own TLS cert (`cert.pem` and `key.pem` included in the repo are for `dc09.ru` domain name) + with `sing-box generate tls-keypair ` OR `xray tls cert --domain=` +- Replace `dc09.ru` in all configs to match your domain name instead of mine +- Upload sing-box and xray to your server, install iperf3 from a package manager + or upload compiled previously (on a server, you won't need socks support), + upload `server.json`, `server_xray.json`, `cert.pem` and `key.pem` +- Run `./sing-box run --config server.json &` on your server, then launch `iperf3 -s` +- In `config.json` edit the line `"final": "vless-out"` to default to `socks-out`, + the same for `config_xray.json`: edit `"outboundTag": "vless-out"` in the 2nd routing rule. +- Run `./sing-box run --config config.json` and `./xray run -c config_xray.json` on client, + sing-box will open port 2080 for a SOCKSv5 inbound, xray will open port 2081 for its inbound. +- Make tests with iperf3: + `repo_with_iperf_fork/src/iperf3 -c
--bidir --socks5 127.0.0.1:2080` + for sing-box client and `... --socks5 127.0.0.1:2081` for xray client. +- Change `"final": "socks-out"` and `"outboundTag": "socks-out"` to `trojan-out` to test with Trojan, + restart sing-box and xray on client, peform iperf3 tests, + then change default outbound back to `vless-out`, restart proxy clients again, peform tests +- Stop iperf3 server by hitting Ctrl-C, stop sing-box server proxy by bringing the task to foreground with `fg` command and hitting Ctrl-C +- Run `./xray run -c server_xray.json &` on the server, then launch `iperf3 -s` +- Repeat the tests +- Stop iperf3 with Ctrl-C, stop xray with `fg` and Ctrl-C