From 499e23cb932b8e3f7041457c33a4d4d5547cb80e Mon Sep 17 00:00:00 2001 From: Micooz Date: Mon, 28 Aug 2017 17:38:50 +0800 Subject: [PATCH] docs: update --- docs/benchmark/README.md | 43 +++++++++++++++---------------- docs/presets/README.md | 45 ++++++++++++++++++++++++++++++--- src/presets/ss-stream-cipher.js | 1 - src/presets/tracker.js | 16 +++++++++--- 4 files changed, 76 insertions(+), 29 deletions(-) diff --git a/docs/benchmark/README.md b/docs/benchmark/README.md index 3d16fc4..c314c3e 100644 --- a/docs/benchmark/README.md +++ b/docs/benchmark/README.md @@ -1,6 +1,6 @@ # benchmark -We use [iperf](https://en.wikipedia.org/wiki/Iperf) as network bandwidth measurement tool to measure **transfer/bandwidth** among different preset combinations during a period of time. +We use [iperf](https://en.wikipedia.org/wiki/Iperf) as network bandwidth measurement tool to measure **transfer/bitrate** among different preset combinations during a period of time. ## Prerequisites @@ -52,16 +52,17 @@ memory 16722907136 type Linux platform linux arch x64 -release 4.4.0-89-generic +release 4.4.0-92-generic Node.js Versions: http_parser 2.7.0 -node 8.2.1 -v8 5.8.283.41 +node 8.4.0 +v8 6.0.286.52 uv 1.13.1 zlib 1.2.11 ares 1.10.1-DEV modules 57 +nghttp2 1.22.0 openssl 1.0.2l icu 59.1 unicode 9.0 @@ -72,35 +73,32 @@ running tests... ------------ Test Case 0 ---------------- [{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"aes-256-ctr"}}] -Interval Transfer Bandwidth -0.0- 3.0 sec 1.63 GBytes 4.66 Gbits/sec -0.0- 2.7 sec 1.63 GBytes 5.26 Gbits/sec +Interval Transfer Bitrate +0.00-5.00 sec 3.36 GBytes 5.77 Gbits/sec sender +0.00-5.11 sec 3.25 GBytes 5.46 Gbits/sec receiver ----------------------------------------- ------------ Test Case 1 ---------------- [{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"aes-256-cfb"}}] -Interval Transfer Bandwidth -0.0- 3.0 sec 776 MBytes 2.17 Gbits/sec -0.0- 2.8 sec 776 MBytes 2.35 Gbits/sec +Interval Transfer Bitrate +0.00-5.00 sec 1.53 GBytes 2.64 Gbits/sec sender +0.00-5.26 sec 1.43 GBytes 2.33 Gbits/sec receiver ----------------------------------------- ------------ Test Case 2 ---------------- [{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"camellia-256-cfb"}}] -Interval Transfer Bandwidth -0.0- 3.0 sec 296 MBytes 825 Mbits/sec -0.0- 2.7 sec 296 MBytes 912 Mbits/sec +Interval Transfer Bitrate +0.00-5.00 sec 734 MBytes 1.23 Gbits/sec sender +0.00-5.78 sec 632 MBytes 917 Mbits/sec receiver ----------------------------------------- -(best): +(ranking): ------------- Test Case 0 ---------------- -[{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"aes-256-ctr"}}] -Interval Transfer Bandwidth -0.0- 3.0 sec 1.63 GBytes 4.66 Gbits/sec -0.0- 2.7 sec 1.63 GBytes 5.26 Gbits/sec ------------------------------------------ + 1: Test Case 0, Transfer=[3.36 GBytes, 3.25 GBytes], [{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"aes-256-ctr"}}] + 2: Test Case 1, Transfer=[1.53 GBytes, 1.43 GBytes], [{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"aes-256-cfb"}}] + 3: Test Case 2, Transfer=[734 MBytes, 632 MBytes], [{"name":"ss-base"},{"name":"ss-stream-cipher","params":{"method":"camellia-256-cfb"}}] -Done in 18.47s. +Done in 50.86s. ``` As you can see, the program first lists **Operating System** and **Node.js Versions** parameters of the current platform. @@ -116,13 +114,14 @@ The first line of results represents traffic from `iperf -c` to `bs-client` whil > You'd better check out [benchmark/iperf.sh] and figure out how it works. -**In my environment**, `aes-256-ctr` has the maximum transfer and bandwidth among these 3 test cases. +**In my environment**, `aes-256-ctr` has the maximum transfer and bitrate among these 3 test cases. ## History Reports * [2017-8-11.txt](../../benchmark/reports/2017-8-11.txt) * [2017-8-13.txt](../../benchmark/reports/2017-8-13.txt) * [2017-8-14.txt](../../benchmark/reports/2017-8-14.txt) +* [2017-8-28.txt](../../benchmark/reports/2017-8-28.txt) [benchmark/cases.js]: ./cases.js [benchmark/iperf.sh]: ./iperf.sh diff --git a/docs/presets/README.md b/docs/presets/README.md index ad051e8..91fa2ad 100644 --- a/docs/presets/README.md +++ b/docs/presets/README.md @@ -151,14 +151,51 @@ This preset perform statistics among traffic via this preset, you can put it any } ``` +## [tracker] + +Track data send/receive events via this preset, and print a part of them after connection closed. + +``` +"presets": [ + ... + {"name": "tracker"}, + ... +] +``` + +And you can get the track message in your terminal and log files: + +``` +[tracker] summary(out/in = 14/9, 5191b/3431b) abstract(127.0.0.1:55566 play.google.com:443 u 555 d 394 u 616 d 165 u 221 156 934 795 d 74 u 43 d 1201 u 51 174 531 d 51 573 u 51 172 841 d 51 854 u 51 d 68) +``` + +## [exp-compress] + +An **experimental** to do stream compression/decompression. **Use with caution.** + +| PARAMS | DESCRIPTION | DEFAULT | +| :-------- | :----------------------------------- | :------ | +| method | compression and decompression method | - | + +`method` can be one of: + +gzip, deflate + +``` +"presets": [ + {"name": "ss-base"}, + {"name": "exp-compress", "params": {"method": "deflate"}} +] +``` + ## [ss-base] This is a very basic preset which delivers the real destination address from client to server. ``` -"presets": [{ - "name": "ss-base" -}] +"presets": [ + {"name": "ss-base"} +] ``` ## [exp-base-with-padding] @@ -469,6 +506,8 @@ Make some cheat: [proxy]: ../../src/presets/proxy.js [tunnel]: ../../src/presets/tunnel.js [stats]: ../../src/presets/stats.js +[tracker]: ../../src/presets/tracker.js +[exp-compress]: ../../src/presets/exp-compress.js [ss-base]: ../../src/presets/ss-base.js [exp-base-with-padding]: ../../src/presets/exp-base-with-padding.js [exp-base-auth-stream]: ../../src/presets/exp-base-auth-stream.js diff --git a/src/presets/ss-stream-cipher.js b/src/presets/ss-stream-cipher.js index 1bf211d..57b8254 100644 --- a/src/presets/ss-stream-cipher.js +++ b/src/presets/ss-stream-cipher.js @@ -6,7 +6,6 @@ const IV_LEN = 16; // available ciphers const ciphers = [ - // both supported 'aes-128-ctr', 'aes-192-ctr', 'aes-256-ctr', 'aes-128-cfb', 'aes-192-cfb', 'aes-256-cfb', 'camellia-128-cfb', 'camellia-192-cfb', 'camellia-256-cfb' diff --git a/src/presets/tracker.js b/src/presets/tracker.js index 83ce2f9..25120e6 100644 --- a/src/presets/tracker.js +++ b/src/presets/tracker.js @@ -5,9 +5,19 @@ const TRACK_CHAR_UPLOAD = 'u'; const TRACK_CHAR_DOWNLOAD = 'd'; const TRACK_MAX_SIZE = 40; -// +---+-----------------------+---+ -// | C | d <--> u u <--> d | S | -// +---+-----------------------+---+ +/** + * @description + * Track data send/receive events via this preset, and print a part of them after connection closed. + * + * +---+-----------------------+---+ + * | C | d <--> u u <--> d | S | + * +---+-----------------------+---+ + * + * @examples + * { + * "name": "tracker" + * } + */ export default class TrackerPreset extends IPreset { // ['source', 'target', 'u', '20', 'u', '20', 'd', '10', ...]