wangyu-UDPspeeder/README.md

151 lines
7.5 KiB
Markdown
Raw Normal View History

2017-10-19 00:55:25 -07:00
# UDPspeeder
2017-10-19 10:31:48 -07:00
Network Speed-Up Tool. Boost your Connection on a High Lantency High Packet-Loss Link by using Forward Error Correction.
2017-10-19 05:53:38 -07:00
2017-10-26 21:59:47 +08:00
When used alone, UDPspeeder speeds-up only UDP connection. Nevertheless, if you used UDPspeeder + any UDP-based VPN together,
you can speed-up any traffic(include TCP/UDP/ICMP), currently OpenVPN/L2TP/ShadowVPN are confirmed to be supported。
2017-10-19 10:34:37 -07:00
2017-10-19 10:36:24 -07:00
![](/images/en/udpspeeder.PNG)
2017-10-19 10:22:17 -07:00
2017-10-19 10:36:51 -07:00
or
2017-10-19 11:48:12 -07:00
![image_vpn](/images/en/udpspeeder+openvpn3.PNG)
2017-10-19 00:55:25 -07:00
2017-11-06 18:53:00 -08:00
Assume your local network to your server is lossy. Just establish a VPN connection to your server with UDPspeeder + any UDP-based VPN, access your server via this VPN connection, then your connection quality will be significantly improved. With well-tuned parameters , you can easily reduce IP or UDP/ICMP packet-loss-rate to less than 0.01% . Besides reducing packet-loss-rate, UDPspeeder can also significantly improve your TCP latency and TCP single-thread download speed.
2017-10-23 22:02:39 -07:00
[简体中文](/doc/README.zh-cn.md)(内容更丰富)
2017-10-19 05:53:38 -07:00
2017-10-21 17:30:22 -07:00
###### Note
2017-10-29 03:41:28 -07:00
You can use udp2raw with UDPspeeder together to get better speed on some ISP with UDP QoS(UDP throttling).
udp2raw's repo
https://github.com/wangyu-/udp2raw-tunnel
You can also try tinyFecVPN, a lightweight high-performance VPN with build-in FEC support:
tinyFecVPN's repo:
https://github.com/wangyu-/tinyFecVPN
2017-10-21 17:30:22 -07:00
2017-10-19 10:27:00 -07:00
# Efficacy
2017-10-19 10:22:17 -07:00
tested on a link with 100ms latency and 10% packet loss at both direction
### Ping Packet Loss
2017-10-22 10:35:45 -07:00
![](/images/en/ping_compare_mode1.png)
2017-10-19 10:22:17 -07:00
2017-10-19 10:27:00 -07:00
### SCP Copy Speed
2017-10-19 10:43:21 -07:00
![](/images/en/scp_compare2.PNG)
2017-10-19 10:22:17 -07:00
2017-10-19 10:27:00 -07:00
# Supported Platforms
2017-10-26 21:59:47 +08:00
Linux host (including desktop Linux,Android phone/tablet, OpenWRT router, or Raspberry PI).
2017-10-19 05:53:38 -07:00
2017-11-08 15:49:59 -08:00
For Windows and MacOS You can run UDPspeeder inside [this](https://github.com/wangyu-/udp2raw-tunnel/releases/download/20171108.0/lede-17.01.2-x86_virtual_machine_image.zip) 7.5mb virtual machine image.
2017-10-19 05:53:38 -07:00
# How does it work
2017-10-26 21:59:47 +08:00
UDPspeeder uses FEC(Forward Error Correction) to reduce packet loss rate, at the cost of addtional bandwidth. The algorithm for FEC is called Reed-Solomon.
2017-10-19 10:51:15 -07:00
2017-10-20 21:47:26 -07:00
![image0](/images/en/fec.PNG)
2017-10-19 10:51:15 -07:00
### Reed-Solomon
`
In coding theory, the ReedSolomon code belongs to the class of non-binary cyclic error-correcting codes. The ReedSolomon code is based on univariate polynomials over finite fields.
2017-10-19 10:52:17 -07:00
`
`
2017-10-19 10:51:15 -07:00
It is able to detect and correct multiple symbol errors. By adding t check symbols to the data, a ReedSolomon code can detect any combination of up to t erroneous symbols, or correct up to ⌊t/2⌋ symbols. As an erasure code, it can correct up to t known erasures, or it can detect and correct combinations of errors and erasures. ReedSolomon codes are also suitable as multiple-burst bit-error correcting codes, since a sequence of b + 1 consecutive bit errors can affect at most two symbols of size b. The choice of t is up to the designer of the code, and may be selected within wide limits.
`
![](/images/en/rs.png)
2017-10-19 11:09:00 -07:00
Check wikipedia for more info, https://en.wikipedia.org/wiki/ReedSolomon_error_correction
2017-10-19 05:53:38 -07:00
2017-10-19 10:22:17 -07:00
# Getting Started
### Installing
Download binary release from https://github.com/wangyu-/UDPspeeder/releases
2017-10-19 11:02:54 -07:00
### Running (speed-up UDP only)
2017-10-19 10:22:17 -07:00
Assume your server ip is 44.55.66.77, you have a service listening on udp port 7777.
2017-10-19 10:31:11 -07:00
2017-10-19 10:22:17 -07:00
```bash
# Run at server side:
2017-10-20 21:52:09 -07:00
./speederv2 -s -l0.0.0.0:4096 -r 127.0.0.1:7777 -f20:10 -k "passwd"
2017-10-19 10:22:17 -07:00
# Run at client side
2017-10-20 21:52:09 -07:00
./speederv2 -c -l0.0.0.0:3333 -r44.55.66.77:4096 -f20:10 -k "passwd"
2017-10-19 10:22:17 -07:00
```
2017-10-26 21:59:47 +08:00
Now connecting to UDP port 3333 at the client side is equivalent to connecting to port 7777 at the server side, and the connection is boosted by UDPspeeder.
2017-10-19 10:31:11 -07:00
2017-10-19 10:43:21 -07:00
##### Note
`-f20:10` means sending 10 redundant packets for every 20 original packets.
2017-10-19 10:22:17 -07:00
2017-10-29 03:41:28 -07:00
`-k` enables simple XOR encryption
2017-10-22 18:22:53 -07:00
2017-11-17 08:51:05 -08:00
To run stably, pay attention to MTU. You can also try `--mode 0`,there will be no MTU problem in this mode.
2017-10-22 18:22:53 -07:00
2017-10-19 10:22:17 -07:00
# Advanced Topic
2017-10-19 11:10:52 -07:00
### Full Options
2017-10-19 10:22:17 -07:00
```
UDPspeeder V2
2017-10-25 00:04:50 -07:00
git version:8e7a8aed92 build date:Oct 25 2017 02:00:54
2017-10-19 10:22:17 -07:00
repository: https://github.com/wangyu-/UDPspeeder
usage:
run as client : ./this_program -c -l local_listen_ip:local_port -r server_ip:server_port [options]
run as server : ./this_program -s -l server_listen_ip:server_port -r remote_ip:remote_port [options]
common option,must be same on both sides:
-k,--key <string> key for simple xor encryption. if not set,xor is disabled
main options:
-f,--fec x:y forward error correction,send y redundant packets for every x packets
2017-10-25 00:04:50 -07:00
--timeout <number> how long could a packet be held in queue before doing fec,unit: ms,default :8ms
--mode <number> fec-mode,available values: 0,1 ; 0 cost less bandwidth,1 cost less latency(default)
2017-10-19 10:22:17 -07:00
--report <number> turn on send/recv report,and set a period for reporting,unit:s
advanced options:
--mtu <number> mtu. for mode 0,the program will split packet to segment smaller than mtu_value.
for mode 1,no packet will be split,the program just check if the mtu is exceed.
2017-10-25 00:04:50 -07:00
default value:1250
2017-10-19 10:22:17 -07:00
-j,--jitter <number> simulated jitter.randomly delay first packet for 0~<number> ms,default value:0.
do not use if you dont know what it means.
-i,--interval <number> scatter each fec group to a interval of <number> ms,to protect burst packet loss.
default value:0.do not use if you dont know what it means.
--random-drop <number> simulate packet loss ,unit:0.01%. default value: 0
--disable-obscure <number> disable obscure,to save a bit bandwidth and cpu
developer options:
2017-10-25 00:04:50 -07:00
--fifo <string> use a fifo(named pipe) for sending commands to the running program,so that you
can change fec encode parameters dynamically,check readme.md in repository for
supported commands.
2017-10-19 10:22:17 -07:00
-j ,--jitter jmin:jmax similiar to -j above,but create jitter randomly between jmin and jmax
-i,--interval imin:imax similiar to -i above,but scatter randomly between imin and imax
-q,--queue-len <number> max fec queue len,only for mode 0
2017-10-19 10:27:00 -07:00
--decode-buf <number> size of buffer of fec decoder,unit:packet,default:2000
2017-10-19 10:22:17 -07:00
--fix-latency <number> try to stabilize latency,only for mode 0
--delay-capacity <number> max number of delayed packets
--disable-fec <number> completely disable fec,turn the program into a normal udp tunnel
--sock-buf <number> buf size for socket,>=10 and <=10240,unit:kbyte,default:1024
log and help options:
2017-10-25 00:04:50 -07:00
--log-level <number> 0:never 1:fatal 2:error 3:warn
2017-10-19 10:22:17 -07:00
4:info (default) 5:debug 6:trace
--log-position enable file name,function name,line number in log
--disable-color disable log color
-h,--help print this help message
2017-10-25 00:04:50 -07:00
```
#### `--fifo` option
2017-10-26 21:59:47 +08:00
Use a fifo(named pipe) for sending commands to the running program. For example `--fifo fifo.file`, you can use following commands to change parameters dynamically:
2017-10-25 00:04:50 -07:00
```
2017-10-26 21:59:47 +08:00
echo fec 19:9 > fifo.file
echo mtu 1100 > fifo.file
echo timeout 5 > fifo.file
echo queue-len 100 > fifo.file
echo mode 0 > fifo.file
2017-10-19 10:22:17 -07:00
```
2017-10-26 21:59:47 +08:00
### Speed-Up any traffic with OpenVPN + UDPspeeder
2017-10-19 10:22:17 -07:00
2017-10-19 11:09:00 -07:00
Check [UDPspeeder + openvpn config guide](/doc/udpspeeder_openvpn.md).