Debian Codegraph @

third-party/libhv-v1.3.3/examples/kcptun/README.md

raw
1 # Intro
2
3 <img src="kcptun.png" alt="kcptun" height="300px"/>
4
5 > *Disclaimer: The picture comes from [github.com/xtaci/kcptun](https://github.com/xtaci/kcptun). Thanks so much.*
6
7 # Build
8
9 ```shell
10 ./configure --with-kcp
11 make clean
12 make examples
13 make kcptun
14 ```
15
16 # Usage
17
18 ```shell
19 $ bin/kcptun_server -h
20
21 Usage: kcptun_server [hvdl:t:m:]
22 Options:
23
24 -h|--help Print this information
25 -v|--version Print version
26 -d|--daemon Daemonize
27 -l|--listen value kcp server listen address (default: ":4000")
28 -t|--target value target server address (default: "127.0.0.1:8080")
29 -m|--mode value profiles: fast3, fast2, fast, normal (default: "fast")
30 --mtu value set maximum transmission unit for UDP packets (default: 1350)
31 --sndwnd value set send window size(num of packets) (default: 1024)
32 --rcvwnd value set receive window size(num of packets) (default: 1024)
33 ```
34
35 ```shell
36 $ bin/kcptun_client -h
37
38 Usage: kcptun_client [hvdl:r:m:]
39 Options:
40
41 -h|--help Print this information
42 -v|--version Print version
43 -d|--daemon Daemonize
44 -l|--localaddr value local listen address (default: ":8388")
45 -r|--remoteaddr value kcp server address (default: "127.0.0.1:4000")
46 -m|--mode value profiles: fast3, fast2, fast, normal (default: "fast")
47 --mtu value set maximum transmission unit for UDP packets (default: 1350)
48 --sndwnd value set send window size(num of packets) (default: 128)
49 --rcvwnd value set receive window size(num of packets) (default: 512)
50 ```
51
52 # Test
53 `tcp_client -> kcptun_client -> kcptun_server -> tcp_server`
54 ```shell
55 tcp_server: bin/tcp_echo_server 1234
56 kcptun_server: bin/kcptun_server -l :4000 -t 127.0.0.1:1234 --mode fast3
57 kcptun_client: bin/kcptun_client -l :8388 -r 127.0.0.1:4000 --mode fast3
58 tcp_client: bin/nc 127.0.0.1 8388
59 > hello
60 < hello
61 ```
62
63 This kcptun examples does not implement encryption, compression, and fec.<br>
64 if you want to use [github.com/xtaci/kcptun](https://github.com/xtaci/kcptun), please add `--crypt null --nocomp --ds 0 --ps 0`.<br>
65 For example:
66 ```shell
67 golang_kcptun_server -l :4000 -t 127.0.0.1:1234 --mode fast3 --crypt null --nocomp --ds 0 --ps 0
68 ```