mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-09-17 12:44:31 +08:00
Compare commits
109 Commits
20180620.0
...
v2@2017111
Author | SHA1 | Date | |
---|---|---|---|
|
6f55b8a2fc | ||
|
85122b7155 | ||
|
0cef4503be | ||
|
744c8f56ae | ||
|
8680b06882 | ||
|
57cce3a424 | ||
|
6ab4294bd9 | ||
|
ebdabb4598 | ||
|
c254545290 | ||
|
1301fdc96d | ||
|
f58dfe4fdd | ||
|
3fd198a1e2 | ||
|
017e851c2d | ||
|
2929eead0e | ||
|
e2c2f2dfec | ||
|
d0ebd67dbd | ||
|
211fcee8db | ||
|
6b4a2dfe21 | ||
|
65939eb9e7 | ||
|
9c00a2f3a6 | ||
|
4706e51fad | ||
|
c3786a91d8 | ||
|
680f127350 | ||
|
7713cf0c15 | ||
|
5024a02d20 | ||
|
f2d9deb2a3 | ||
|
c5c440245c | ||
|
c95e2db1af | ||
|
82a2b3cb9a | ||
|
8ecc696da5 | ||
|
6e6fc62fb8 | ||
|
ea03e5f8ec | ||
|
3be2642397 | ||
|
d05bcfc2f8 | ||
|
e50292bd4a | ||
|
363aec12d4 | ||
|
4364a7b789 | ||
|
17a42a1218 | ||
|
9152fef474 | ||
|
eb7406e6f3 | ||
|
296a84be3c | ||
|
69558ab16c | ||
|
37b7eb7282 | ||
|
4ca57cf656 | ||
|
1a744d69ea | ||
|
86b68697e1 | ||
|
63a2f923ab | ||
|
5774b478fc | ||
|
e91dcf6647 | ||
|
f6c97af854 | ||
|
2f097d720d | ||
|
c6de39acc8 | ||
|
0f425a3a98 | ||
|
2cc560088b | ||
|
b83b21f2eb | ||
|
f526046846 | ||
|
1be5fb5fc1 | ||
|
27874aa413 | ||
|
fde2329528 | ||
|
30b78c1339 | ||
|
17a3074b34 | ||
|
cce7d18163 | ||
|
90029e1ea7 | ||
|
c26a4708ee | ||
|
fdbf4ab205 | ||
|
7ee72ee84c | ||
|
cac5f8271c | ||
|
219e8e2592 | ||
|
02b4d59500 | ||
|
894bf7cd0d | ||
|
a8cab43139 | ||
|
369a9d8e1b | ||
|
0f7894f42f | ||
|
d7daae25bf | ||
|
d7271b74b4 | ||
|
1eeef14470 | ||
|
9d30caffc9 | ||
|
e50e383ede | ||
|
c73a197971 | ||
|
ba44617124 | ||
|
19e718f0a3 | ||
|
bd323be9c4 | ||
|
35a85e38ae | ||
|
4871983b8f | ||
|
fec3c39cad | ||
|
4d55348a4d | ||
|
36eef02d8a | ||
|
3fd48dd20e | ||
|
766aa274d9 | ||
|
d961537682 | ||
|
4dcfe87bd3 | ||
|
2aa0ece465 | ||
|
05fd84b675 | ||
|
1e00ff7c87 | ||
|
c76818c6a8 | ||
|
e3e2fe6d36 | ||
|
7cd87e7b59 | ||
|
c3aae9579b | ||
|
d9f80781a2 | ||
|
203604e1b5 | ||
|
5ac6e30c8e | ||
|
6728d5a561 | ||
|
f9eaae172f | ||
|
a0eeedb12a | ||
|
324d34c87a | ||
|
1fe64b5689 | ||
|
d5e900e91c | ||
|
8e00273db4 | ||
|
73d68a2baf |
@@ -1,6 +0,0 @@
|
|||||||
For English speaking user:
|
|
||||||
https://github.com/wangyu-/UDPspeeder/wiki/Issue-Guide
|
|
||||||
|
|
||||||
中文用户请看:
|
|
||||||
https://github.com/wangyu-/UDPspeeder/wiki/发Issue前请看
|
|
||||||
(否则Issue可能被忽略,或被直接关掉)
|
|
110
README.md
110
README.md
@@ -1,9 +1,8 @@
|
|||||||
# UDPspeeder
|
# UDPspeeder
|
||||||
|
Network Speed-Up Tool. Boost your Connection on a High Lantency High Packet-Loss Link by using Forward Error Correction.
|
||||||
|
|
||||||
A Tunnel which Improves your Network Quality on a High-latency Lossy Link by using Forward Error Correction.
|
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。
|
||||||
When used alone, UDPspeeder improves only UDP connection. Nevertheless, if you used UDPspeeder + any UDP-based VPN together,
|
|
||||||
you can improve any traffic(include TCP/UDP/ICMP), currently OpenVPN/L2TP/ShadowVPN are confirmed to be supported。
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -13,10 +12,22 @@ or
|
|||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
[UDPspeeder Wiki](https://github.com/wangyu-/UDPspeeder/wiki)
|
|
||||||
|
|
||||||
[简体中文](/doc/README.zh-cn.md)(内容更丰富)
|
[简体中文](/doc/README.zh-cn.md)(内容更丰富)
|
||||||
|
|
||||||
|
###### Note
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
# Efficacy
|
# Efficacy
|
||||||
tested on a link with 100ms latency and 10% packet loss at both direction
|
tested on a link with 100ms latency and 10% packet loss at both direction
|
||||||
|
|
||||||
@@ -56,7 +67,7 @@ Check wikipedia for more info, https://en.wikipedia.org/wiki/Reed–Solomon_erro
|
|||||||
### Installing
|
### Installing
|
||||||
Download binary release from https://github.com/wangyu-/UDPspeeder/releases
|
Download binary release from https://github.com/wangyu-/UDPspeeder/releases
|
||||||
|
|
||||||
### Running (improves UDP traffic only)
|
### Running (speed-up UDP only)
|
||||||
Assume your server ip is 44.55.66.77, you have a service listening on udp port 7777.
|
Assume your server ip is 44.55.66.77, you have a service listening on udp port 7777.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -67,7 +78,7 @@ Assume your server ip is 44.55.66.77, you have a service listening on udp port 7
|
|||||||
./speederv2 -c -l0.0.0.0:3333 -r44.55.66.77:4096 -f20:10 -k "passwd"
|
./speederv2 -c -l0.0.0.0:3333 -r44.55.66.77:4096 -f20:10 -k "passwd"
|
||||||
```
|
```
|
||||||
|
|
||||||
Now connecting to UDP port 3333 at the client side is equivalent to connecting to port 7777 at the server side, and the connection has been boosted by UDPspeeder.
|
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.
|
||||||
|
|
||||||
##### Note
|
##### Note
|
||||||
|
|
||||||
@@ -75,58 +86,52 @@ Now connecting to UDP port 3333 at the client side is equivalent to connecting t
|
|||||||
|
|
||||||
`-k` enables simple XOR encryption
|
`-k` enables simple XOR encryption
|
||||||
|
|
||||||
|
To run stably, pay attention to MTU. You can also try `--mode 0`,there will be no MTU problem in this mode.
|
||||||
# Improves all traffic with OpenVPN + UDPspeeder
|
|
||||||
|
|
||||||
See [UDPspeeder + openvpn config guide](https://github.com/wangyu-/UDPspeeder/wiki/UDPspeeder-openvpn-config-guide).
|
|
||||||
|
|
||||||
# Advanced Topic
|
# Advanced Topic
|
||||||
|
|
||||||
### Full Options
|
### Full Options
|
||||||
```
|
```
|
||||||
UDPspeeder V2
|
UDPspeeder V2
|
||||||
git version: 6f55b8a2fc build date: Nov 19 2017 06:11:23
|
git version:8e7a8aed92 build date:Oct 25 2017 02:00:54
|
||||||
repository: https://github.com/wangyu-/UDPspeeder
|
repository: https://github.com/wangyu-/UDPspeeder
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
run as client: ./this_program -c -l local_listen_ip:local_port -r server_ip:server_port [options]
|
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]
|
run as server : ./this_program -s -l server_listen_ip:server_port -r remote_ip:remote_port [options]
|
||||||
|
|
||||||
common options, must be same on both sides:
|
common option,must be same on both sides:
|
||||||
-k,--key <string> key for simple xor encryption. if not set, xor is disabled
|
-k,--key <string> key for simple xor encryption. if not set,xor is disabled
|
||||||
main options:
|
main options:
|
||||||
-f,--fec x:y forward error correction, send y redundant packets for every x packets
|
-f,--fec x:y forward error correction,send y redundant packets for every x packets
|
||||||
--timeout <number> how long could a packet be held in queue before doing fec, unit: ms, default: 8ms
|
--timeout <number> how long could a packet be held in queue before doing fec,unit: ms,default :8ms
|
||||||
--report <number> turn on send/recv report, and set a period for reporting, unit: s
|
--mode <number> fec-mode,available values: 0,1 ; 0 cost less bandwidth,1 cost less latency(default)
|
||||||
|
--report <number> turn on send/recv report,and set a period for reporting,unit:s
|
||||||
advanced options:
|
advanced options:
|
||||||
--mode <number> fec-mode,available values: 0,1; mode 0(default) costs less bandwidth,no mtu problem.
|
--mtu <number> mtu. for mode 0,the program will split packet to segment smaller than mtu_value.
|
||||||
mode 1 usually introduces less latency, but you have to care about mtu.
|
for mode 1,no packet will be split,the program just check if the mtu is exceed.
|
||||||
--mtu <number> mtu. for mode 0, the program will split packet to segment smaller than mtu value.
|
default value:1250
|
||||||
for mode 1, no packet will be split, the program just check if the mtu is exceed.
|
-j,--jitter <number> simulated jitter.randomly delay first packet for 0~<number> ms,default value:0.
|
||||||
default value: 1250. you typically shouldnt change this value.
|
|
||||||
-q,--queue-len <number> fec queue len, only for mode 0, fec will be performed immediately after queue is full.
|
|
||||||
default value: 200.
|
|
||||||
-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.
|
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.
|
-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.
|
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.
|
--random-drop <number> simulate packet loss ,unit:0.01%. default value: 0
|
||||||
--disable-obscure <number> disable obscure, to save a bit bandwidth and cpu.
|
--disable-obscure <number> disable obscure,to save a bit bandwidth and cpu
|
||||||
developer options:
|
developer options:
|
||||||
--fifo <string> use a fifo(named pipe) for sending commands to the running program, so that you
|
--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
|
can change fec encode parameters dynamically,check readme.md in repository for
|
||||||
supported commands.
|
supported commands.
|
||||||
-j ,--jitter jmin:jmax similiar to -j above, but create jitter randomly between jmin and jmax
|
-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
|
-i,--interval imin:imax similiar to -i above,but scatter randomly between imin and imax
|
||||||
--decode-buf <number> size of buffer of fec decoder,u nit: packet, default: 2000
|
-q,--queue-len <number> max fec queue len,only for mode 0
|
||||||
--fix-latency <number> try to stabilize latency, only for mode 0
|
--decode-buf <number> size of buffer of fec decoder,unit:packet,default:2000
|
||||||
|
--fix-latency <number> try to stabilize latency,only for mode 0
|
||||||
--delay-capacity <number> max number of delayed packets
|
--delay-capacity <number> max number of delayed packets
|
||||||
--disable-fec <number> completely disable fec, turn the program into a normal udp tunnel
|
--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
|
--sock-buf <number> buf size for socket,>=10 and <=10240,unit:kbyte,default:1024
|
||||||
log and help options:
|
log and help options:
|
||||||
--log-level <number> 0: never 1: fatal 2: error 3: warn
|
--log-level <number> 0:never 1:fatal 2:error 3:warn
|
||||||
4: info (default) 5: debug 6: trace
|
4:info (default) 5:debug 6:trace
|
||||||
--log-position enable file name, function name, line number in log
|
--log-position enable file name,function name,line number in log
|
||||||
--disable-color disable log color
|
--disable-color disable log color
|
||||||
-h,--help print this help message
|
-h,--help print this help message
|
||||||
|
|
||||||
@@ -140,19 +145,6 @@ echo timeout 5 > fifo.file
|
|||||||
echo queue-len 100 > fifo.file
|
echo queue-len 100 > fifo.file
|
||||||
echo mode 0 > fifo.file
|
echo mode 0 > fifo.file
|
||||||
```
|
```
|
||||||
|
### Speed-Up any traffic with OpenVPN + UDPspeeder
|
||||||
|
|
||||||
|
Check [UDPspeeder + openvpn config guide](/doc/udpspeeder_openvpn.md).
|
||||||
# wiki
|
|
||||||
Check wiki for more info:
|
|
||||||
|
|
||||||
https://github.com/wangyu-/UDPspeeder/wiki
|
|
||||||
|
|
||||||
# Related repo
|
|
||||||
|
|
||||||
You can also try tinyfecVPN, a lightweight high-performance VPN with UDPspeeder's function built-in, repo:
|
|
||||||
|
|
||||||
https://github.com/wangyu-/tinyfecVPN
|
|
||||||
|
|
||||||
You can use udp2raw with UDPspeeder together to get better speed on some ISP with UDP QoS(UDP throttling), repo:
|
|
||||||
|
|
||||||
https://github.com/wangyu-/udp2raw-tunnel
|
|
||||||
|
@@ -52,7 +52,7 @@ u64_t get_current_time()//ms
|
|||||||
{
|
{
|
||||||
timespec tmp_time;
|
timespec tmp_time;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &tmp_time);
|
clock_gettime(CLOCK_MONOTONIC, &tmp_time);
|
||||||
return ((u64_t)tmp_time.tv_sec)*1000llu+((u64_t)tmp_time.tv_nsec)/(1000*1000llu);
|
return tmp_time.tv_sec*1000+tmp_time.tv_nsec/(1000*1000l);
|
||||||
}
|
}
|
||||||
|
|
||||||
u64_t get_current_time_us()
|
u64_t get_current_time_us()
|
||||||
|
2
common.h
2
common.h
@@ -64,7 +64,7 @@ typedef short i16_t;
|
|||||||
|
|
||||||
typedef u64_t my_time_t;
|
typedef u64_t my_time_t;
|
||||||
|
|
||||||
const int max_data_len=3600;
|
const int max_data_len=2200;
|
||||||
const int buf_len=max_data_len+200;
|
const int buf_len=max_data_len+200;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -11,25 +11,23 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
[English](/README.md)
|
对于某些运营商,UDPspeeder跟udp2raw配合可以达到更好的速度,udp2raw负责把UDP伪装成TCP,来绕过运营商的UDP限速。
|
||||||
|
|
||||||
[UDPspeeder Wiki](https://github.com/wangyu-/UDPspeeder/wiki)
|
udp2raw的repo:
|
||||||
|
|
||||||
##### 提示
|
https://github.com/wangyu-/udp2raw-tunnel
|
||||||
|
|
||||||
如果你嫌UDPspeeder+OpenVPN麻烦,你可以尝试tinyfecVPN,一个集成了UDPspeeder功能的VPN:
|
如果你嫌UDPspeeder+OpenVPN麻烦,你可以尝试tinyFecVPN,一个集成了UDPspeeder功能的VPN:
|
||||||
|
|
||||||
tinyfecVPN的repo:
|
tinyFecVPN的repo:
|
||||||
|
|
||||||
https://github.com/wangyu-/tinyfecVPN
|
https://github.com/wangyu-/tinyFecVPN
|
||||||
|
|
||||||
|
|
||||||
#### 效果
|
#### 效果
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
#### 原理简介
|
#### 原理简介
|
||||||
主要原理是通过冗余数据来对抗网络的丢包,发送冗余数据的方式支持FEC(Forward Error Correction)和多倍发包,其中FEC算法是Reed-Solomon。
|
主要原理是通过冗余数据来对抗网络的丢包,发送冗余数据的方式支持FEC(Forward Error Correction)和多倍发包,其中FEC算法是Reed-Solomon。
|
||||||
|
|
||||||
@@ -50,10 +48,6 @@ FEC方式的原理图:
|
|||||||
|
|
||||||
client支持多个udp连接,server也支持多个client
|
client支持多个udp连接,server也支持多个client
|
||||||
|
|
||||||
#### 关键词
|
|
||||||
|
|
||||||
UDP加速器、双边UDP加速、全流量加速、开源加速器、游戏加速、网游加速器
|
|
||||||
|
|
||||||
# 简明操作说明
|
# 简明操作说明
|
||||||
|
|
||||||
### 环境要求
|
### 环境要求
|
||||||
@@ -83,7 +77,7 @@ https://github.com/wangyu-/UDPspeeder/releases
|
|||||||
|
|
||||||
现在client和server之间建立起了tunnel。想要连接44.55.66.77:7777,只需要连接 127.0.0.1:3333。来回的所有的udp流量会被加速。
|
现在client和server之间建立起了tunnel。想要连接44.55.66.77:7777,只需要连接 127.0.0.1:3333。来回的所有的udp流量会被加速。
|
||||||
|
|
||||||
##### 备注
|
##### 备注:
|
||||||
|
|
||||||
`-f20:10`表示对每20个原始数据发送10个冗余包。`-f20:10` 和`-f 20:10`都是可以的,空格可以省略,对于所有的单字节option都是如此。对于双字节option,例如后面会提到的`--mode 0`,空格不可以省略。
|
`-f20:10`表示对每20个原始数据发送10个冗余包。`-f20:10` 和`-f 20:10`都是可以的,空格可以省略,对于所有的单字节option都是如此。对于双字节option,例如后面会提到的`--mode 0`,空格不可以省略。
|
||||||
|
|
||||||
@@ -91,68 +85,58 @@ https://github.com/wangyu-/UDPspeeder/releases
|
|||||||
|
|
||||||
推荐使用`--mode 0`选项,否则你可能需要考虑MTU问题。
|
推荐使用`--mode 0`选项,否则你可能需要考虑MTU问题。
|
||||||
|
|
||||||
|
##### 注意
|
||||||
|
|
||||||
这里推荐的参数是给日常/非游戏情况下使用的;玩游戏请用 [使用经验](https://github.com/wangyu-/UDPspeeder/wiki/使用经验) 里推荐的参数。
|
这里推荐的参数是给日常/非游戏情况下使用的;玩游戏请用 [使用经验](https://github.com/wangyu-/UDPspeeder/wiki/使用经验) 里推荐的参数。
|
||||||
|
|
||||||
##### 提示
|
|
||||||
|
|
||||||
对于某些运营商,UDPspeeder跟udp2raw配合可以达到更好的速度,udp2raw负责把UDP伪装成TCP,来绕过运营商的UDP限速。
|
|
||||||
|
|
||||||
udp2raw的repo:
|
|
||||||
|
|
||||||
https://github.com/wangyu-/udp2raw-tunnel
|
|
||||||
|
|
||||||
# 进阶操作说明
|
# 进阶操作说明
|
||||||
|
|
||||||
### 命令选项
|
### 命令选项
|
||||||
```
|
```
|
||||||
UDPspeeder V2
|
UDPspeeder V2
|
||||||
git version: 6f55b8a2fc build date: Nov 19 2017 06:11:23
|
git version:8e7a8aed92 build date:Oct 25 2017 02:00:54
|
||||||
repository: https://github.com/wangyu-/UDPspeeder
|
repository: https://github.com/wangyu-/UDPspeeder
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
run as client: ./this_program -c -l local_listen_ip:local_port -r server_ip:server_port [options]
|
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]
|
run as server : ./this_program -s -l server_listen_ip:server_port -r remote_ip:remote_port [options]
|
||||||
|
|
||||||
common options, must be same on both sides:
|
common option,must be same on both sides:
|
||||||
-k,--key <string> key for simple xor encryption. if not set, xor is disabled
|
-k,--key <string> key for simple xor encryption. if not set,xor is disabled
|
||||||
main options:
|
main options:
|
||||||
-f,--fec x:y forward error correction, send y redundant packets for every x packets
|
-f,--fec x:y forward error correction,send y redundant packets for every x packets
|
||||||
--timeout <number> how long could a packet be held in queue before doing fec, unit: ms, default: 8ms
|
--timeout <number> how long could a packet be held in queue before doing fec,unit: ms,default :8ms
|
||||||
--report <number> turn on send/recv report, and set a period for reporting, unit: s
|
--mode <number> fec-mode,available values: 0,1 ; 0 cost less bandwidth,1 cost less latency(default)
|
||||||
|
--report <number> turn on send/recv report,and set a period for reporting,unit:s
|
||||||
advanced options:
|
advanced options:
|
||||||
--mode <number> fec-mode,available values: 0,1; mode 0(default) costs less bandwidth,no mtu problem.
|
--mtu <number> mtu. for mode 0,the program will split packet to segment smaller than mtu_value.
|
||||||
mode 1 usually introduces less latency, but you have to care about mtu.
|
for mode 1,no packet will be split,the program just check if the mtu is exceed.
|
||||||
--mtu <number> mtu. for mode 0, the program will split packet to segment smaller than mtu value.
|
default value:1250
|
||||||
for mode 1, no packet will be split, the program just check if the mtu is exceed.
|
-j,--jitter <number> simulated jitter.randomly delay first packet for 0~<number> ms,default value:0.
|
||||||
default value: 1250. you typically shouldnt change this value.
|
|
||||||
-q,--queue-len <number> fec queue len, only for mode 0, fec will be performed immediately after queue is full.
|
|
||||||
default value: 200.
|
|
||||||
-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.
|
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.
|
-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.
|
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.
|
--random-drop <number> simulate packet loss ,unit:0.01%. default value: 0
|
||||||
--disable-obscure <number> disable obscure, to save a bit bandwidth and cpu.
|
--disable-obscure <number> disable obscure,to save a bit bandwidth and cpu
|
||||||
developer options:
|
developer options:
|
||||||
--fifo <string> use a fifo(named pipe) for sending commands to the running program, so that you
|
--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
|
can change fec encode parameters dynamically,check readme.md in repository for
|
||||||
supported commands.
|
supported commands.
|
||||||
-j ,--jitter jmin:jmax similiar to -j above, but create jitter randomly between jmin and jmax
|
-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
|
-i,--interval imin:imax similiar to -i above,but scatter randomly between imin and imax
|
||||||
--decode-buf <number> size of buffer of fec decoder,u nit: packet, default: 2000
|
-q,--queue-len <number> max fec queue len,only for mode 0
|
||||||
--fix-latency <number> try to stabilize latency, only for mode 0
|
--decode-buf <number> size of buffer of fec decoder,unit:packet,default:2000
|
||||||
|
--fix-latency <number> try to stabilize latency,only for mode 0
|
||||||
--delay-capacity <number> max number of delayed packets
|
--delay-capacity <number> max number of delayed packets
|
||||||
--disable-fec <number> completely disable fec, turn the program into a normal udp tunnel
|
--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
|
--sock-buf <number> buf size for socket,>=10 and <=10240,unit:kbyte,default:1024
|
||||||
log and help options:
|
log and help options:
|
||||||
--log-level <number> 0: never 1: fatal 2: error 3: warn
|
--log-level <number> 0:never 1:fatal 2:error 3:warn
|
||||||
4: info (default) 5: debug 6: trace
|
4:info (default) 5:debug 6:trace
|
||||||
--log-position enable file name, function name, line number in log
|
--log-position enable file name,function name,line number in log
|
||||||
--disable-color disable log color
|
--disable-color disable log color
|
||||||
-h,--help print this help message
|
-h,--help print this help message
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
### 包发送选项,两端设置可以不同。 只影响本地包发送。
|
### 包发送选项,两端设置可以不同。 只影响本地包发送。
|
||||||
##### `-f` 选项
|
##### `-f` 选项
|
||||||
@@ -171,7 +155,7 @@ log and help options:
|
|||||||
数据发送和接受报告。开启后可以根据此数据推测出包速和丢包率等特征。`--report 10`表示每10秒生成一次报告。
|
数据发送和接受报告。开启后可以根据此数据推测出包速和丢包率等特征。`--report 10`表示每10秒生成一次报告。
|
||||||
|
|
||||||
##### `-i` 选项
|
##### `-i` 选项
|
||||||
指定一个时间窗口,长度为n毫秒。同一个fec分组的数据在发送时候会被均匀分散到这n毫秒中,可以对抗突发性的丢包,默认值是0(也就是不开启此功能)。 这个功能很有用,在推荐的参数效果不理想时可以尝试打开,比如用`-i 10`、`-i 20`。这个选项的跟通信原理上常说的`交错fec` `交织fec`的原理是差不多的。
|
指定一个时间窗口,长度为n毫秒。同一个fec分组的数据在发送时候会被均匀分散到这n毫秒中。可以对抗突发性的丢包。默认值是0,因为这个功能需要用到时钟,在某些虚拟机里时钟不稳定,可能会导致个别包出现非常大的延迟,所以默认关掉了。这个功能很有用,默认参数效果不理想时可以尝试打开,比如用`-i 10`。这个选项的跟通信原理上常说的`交错fec` `交织fec`的原理是差不多的。
|
||||||
|
|
||||||
##### `-j` 选项
|
##### `-j` 选项
|
||||||
为原始数据的发送,增加一个延迟抖动值。这样上层应用计算出来的RTT方差会更大,以等待后续冗余包的到达,不至于发生在冗余包到达之前就触发重传的尴尬。配合-t选项使用。正常情况下跨国网络本身的延迟抖动就很大,可以不用设-j。这个功能也需要时钟,默认关掉了,不过一般情况应该不需要这个功能。
|
为原始数据的发送,增加一个延迟抖动值。这样上层应用计算出来的RTT方差会更大,以等待后续冗余包的到达,不至于发生在冗余包到达之前就触发重传的尴尬。配合-t选项使用。正常情况下跨国网络本身的延迟抖动就很大,可以不用设-j。这个功能也需要时钟,默认关掉了,不过一般情况应该不需要这个功能。
|
||||||
@@ -209,22 +193,76 @@ echo mode 0 > fifo.file
|
|||||||
##### `--disable-obscure`
|
##### `--disable-obscure`
|
||||||
UDPspeeder默认情况下会对每个发出的数据包随机填充和异或一些字节(4~32字节),这样通过抓包难以发现你发了冗余数据,防止VPS被封。这个功能只是为了小心谨慎,即使你关掉这个功能,基本上也没问题,关掉可以省一些带宽和CPU。`--disable-obscure`可以关掉这个功能。
|
UDPspeeder默认情况下会对每个发出的数据包随机填充和异或一些字节(4~32字节),这样通过抓包难以发现你发了冗余数据,防止VPS被封。这个功能只是为了小心谨慎,即使你关掉这个功能,基本上也没问题,关掉可以省一些带宽和CPU。`--disable-obscure`可以关掉这个功能。
|
||||||
|
|
||||||
# 推荐参数
|
|
||||||
|
|
||||||
https://github.com/wangyu-/UDPspeeder/wiki/推荐设置
|
|
||||||
|
|
||||||
# 使用经验
|
# 使用经验
|
||||||
|
|
||||||
https://github.com/wangyu-/UDPspeeder/wiki/使用经验
|
https://github.com/wangyu-/UDPspeeder/wiki/使用经验
|
||||||
|
|
||||||
|
# 应用
|
||||||
|
|
||||||
|
#### UDPspeeder + OpenVPN加速任何流量,也适用于其他VPN
|
||||||
|

|
||||||
|
|
||||||
|
可以和BBR/锐速叠加,不过BBR/锐速部署在VPS上只对本地和VPS间的流量有效,对从本地和第三方服务器间的流量无效。
|
||||||
|
|
||||||
|
需要在服务端开启ipforward和NAT。在客户端改路由表(可以手动修改,也可以由OpenVPN的redirect-gateway选项自动加好)。
|
||||||
|
|
||||||
|
Linux具体配置: [UDPspeeder + openvpn config guide](/doc/udpspeeder_openvpn.md).
|
||||||
|
|
||||||
|
Windows具体配置: [win10系统UDPspeeder+OpenVPN的完整设置](https://github.com/wangyu-/UDPspeeder/wiki/win10系统UDPspeeder-OpenVPN的完整设置)
|
||||||
|
|
||||||
|
如果UDPspeeder + OpenVPN对你来说显得太麻烦了,你可以尝试一下tinyFecVPN,一个集成了UDPspeeder功能的VPN:
|
||||||
|
|
||||||
|
https://github.com/wangyu-/tinyFecVPN/
|
||||||
|
|
||||||
|
#### UDPspeeder + kcptun/finalspeed + $*** 同时加速tcp和udp流量
|
||||||
|
如果你需要用加速的tcp看视频和下载文件,这样效果可能比没有BBR的UDPspeeder+vpn方案更好。另外,如果你需要玩游戏,但是嫌配VPN麻烦,也可以用这种方案。
|
||||||
|

|
||||||
|
|
||||||
|
具体配置方法简介:
|
||||||
|
|
||||||
|
假设$\*\*\* server监听在在44.55.66.77的443端口(tcp和udp同时)。用kcptun把tcp 443映射到本地的tcp 1234;用UDPspeeder把udp 443的映射到本地的udp 1234。
|
||||||
|
然后让$\*\*\* client 去连127.0.0.1:1234就可以了,tcp和udp都被加速了。完整命令:
|
||||||
|
```
|
||||||
|
run at server side:
|
||||||
|
./kcp_server -l ":4000" -t "127.0.0.1:443" -mode fast2
|
||||||
|
./speederv2 -s -l0.0.0.0:4001 -r127.0.0.1:443 -f20:10 -k "passwd"
|
||||||
|
|
||||||
|
run at client side:
|
||||||
|
./kcp_client -l ":1234" -r "44.55.66.77:4000" -mode fast2
|
||||||
|
./speederv2 -c -l0.0.0.0:1234 -r44.55.66.77:4001 -f20:10 -k "passwd"
|
||||||
|
```
|
||||||
|
|
||||||
|
这就是全部的命令了。issue里有很多人困惑于怎么把tcp和udp流量"分开",其实很简单就可以做到。
|
||||||
|
|
||||||
|
如果只需要加速UDP,不需要加速TCP,可以把kcptun换成其他的任意端口转发方式,比如ncat/socat/ssh tunnel/iptables/[tinyPortMapper](https://github.com/wangyu-/tinyPortMapper/releases)。
|
||||||
|
|
||||||
|
另外,如果没有kcptun只有BBR/锐速的话,也可以把kcptun换成ncat/socat/ssh tunnel/iptables/[tinyPortMapper](https://github.com/wangyu-/tinyPortMapper/releases)。这样,TCP流量由锐速/BBR加速,UDP由UDPspeeder加速。
|
||||||
|
|
||||||
|
#### UDPspeeder + openvpn + $*** 混合方案,也适用于其他VPN
|
||||||
|
也是我正在用的方案。优点是可以随时在vpn和$\*\*\*方案间快速切换。
|
||||||
|
实际部署起来比图中看起来的还要简单。不需要改路由表,不需要写iptables规则和开启NAT,需要做的只是用openvpn分配的ip访问$*** server。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
(也可以把图中的$*** server换成其他的socks5 server,这样就不需要$*** client了)
|
||||||
|
|
||||||
|
可以和BBR/锐速叠加,BBR/锐速只要部署在VPS上就有效。
|
||||||
|
|
||||||
|
也可以用[tinyFecVPN](https://github.com/wangyu-/tinyFecVPN/) + $\*\*\* ,配置起来更简单。
|
||||||
|
|
||||||
|
# 应用实例
|
||||||
|
|
||||||
|
#### win10系统UDPspeeder+OpenVPN的完整设置
|
||||||
|
|
||||||
|
https://github.com/wangyu-/UDPspeeder/wiki/win10系统UDPspeeder-OpenVPN的完整设置
|
||||||
|
|
||||||
|
|
||||||
|
#### 用树莓派做路由器,搭建透明代理,加速游戏主机的网络
|
||||||
|
|
||||||
|
https://github.com/wangyu-/UDPspeeder/wiki/用树莓派做路由器,搭建透明代理,加速游戏主机的网络
|
||||||
|
|
||||||
|
|
||||||
# 编译教程
|
# 编译教程
|
||||||
暂时先参考udp2raw的这篇教程,几乎一样的过程。
|
暂时先参考udp2raw的这篇教程,几乎一样的过程。
|
||||||
|
|
||||||
https://github.com/wangyu-/udp2raw-tunnel/blob/master/doc/build_guide.zh-cn.md
|
https://github.com/wangyu-/udp2raw-tunnel/blob/master/doc/build_guide.zh-cn.md
|
||||||
|
|
||||||
# wiki
|
|
||||||
|
|
||||||
更多内容请看 wiki:
|
|
||||||
|
|
||||||
https://github.com/wangyu-/UDPspeeder/wiki
|
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 115 KiB |
Binary file not shown.
Before Width: | Height: | Size: 132 KiB |
Binary file not shown.
Before Width: | Height: | Size: 149 KiB |
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
30
misc.cpp
30
misc.cpp
@@ -140,27 +140,24 @@ int from_normal_to_fec(conn_info_t & conn_info,char *data,int len,int & out_n,ch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(out_n>0)
|
|
||||||
{
|
|
||||||
log_bare(log_trace,"seq= %u ",read_u32(out_arr[0]));
|
|
||||||
}
|
|
||||||
for(int i=0;i<out_n;i++)
|
|
||||||
{
|
|
||||||
inner_stat.output_packet_num++;
|
|
||||||
inner_stat.output_packet_size+=out_len[i];
|
|
||||||
|
|
||||||
log_bare(log_trace,"%d ",out_len[i]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
log_bare(log_trace,"\n");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mylog(log_trace,"from_normal_to_fec input_len=%d,output_n=%d\n",len,out_n);
|
mylog(log_trace,"from_normal_to_fec input_len=%d,output_n=%d\n",len,out_n);
|
||||||
|
|
||||||
|
if(out_n>0)
|
||||||
|
{
|
||||||
|
log_bare(log_trace,"seq= %u ",read_u32(out_arr[0]));
|
||||||
|
}
|
||||||
|
for(int i=0;i<out_n;i++)
|
||||||
|
{
|
||||||
|
inner_stat.output_packet_num++;
|
||||||
|
inner_stat.output_packet_size+=out_len[i];
|
||||||
|
|
||||||
|
log_bare(log_trace,"%d ",out_len[i]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
log_bare(log_trace,"\n");
|
||||||
//for(int i=0;i<n;i++)
|
//for(int i=0;i<n;i++)
|
||||||
//{
|
//{
|
||||||
//delay_send(0,dest,s_arr[i],s_len);
|
//delay_send(0,dest,s_arr[i],s_len);
|
||||||
@@ -579,7 +576,6 @@ void process_arg(int argc, char *argv[])
|
|||||||
{"tun-mtu", required_argument, 0, 1},
|
{"tun-mtu", required_argument, 0, 1},
|
||||||
{"disable-mssfix", no_argument, 0, 1},
|
{"disable-mssfix", no_argument, 0, 1},
|
||||||
{"keep-reconnect", no_argument, 0, 1},
|
{"keep-reconnect", no_argument, 0, 1},
|
||||||
{"interval", required_argument, 0,'i'},
|
|
||||||
{NULL, 0, 0, 0}
|
{NULL, 0, 0, 0}
|
||||||
};
|
};
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
|
12
tunnel.cpp
12
tunnel.cpp
@@ -113,12 +113,12 @@ int tunnel_client_event_loop()
|
|||||||
if (nfds < 0) { //allow zero
|
if (nfds < 0) { //allow zero
|
||||||
if(errno==EINTR )
|
if(errno==EINTR )
|
||||||
{
|
{
|
||||||
mylog(log_info,"epoll interrupted by signal continue\n");
|
mylog(log_info,"epoll interrupted by signal\n");
|
||||||
//myexit(0);
|
myexit(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mylog(log_fatal,"epoll_wait return %d,%s\n", nfds,strerror(errno));
|
mylog(log_fatal,"epoll_wait return %d\n", nfds);
|
||||||
myexit(-1);
|
myexit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -417,12 +417,12 @@ int tunnel_server_event_loop()
|
|||||||
if (nfds < 0) { //allow zero
|
if (nfds < 0) { //allow zero
|
||||||
if(errno==EINTR )
|
if(errno==EINTR )
|
||||||
{
|
{
|
||||||
mylog(log_info,"epoll interrupted by signal,continue\n");
|
mylog(log_info,"epoll interrupted by signal\n");
|
||||||
//myexit(0);
|
myexit(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mylog(log_fatal,"epoll_wait return %d,%s\n", nfds,strerror(errno));
|
mylog(log_fatal,"epoll_wait return %d\n", nfds);
|
||||||
myexit(-1);
|
myexit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user