mirror of
https://github.com/wangyu-/UDPspeeder.git
synced 2025-09-17 20:54:33 +08:00
Compare commits
45 Commits
v2@2017111
...
place_hold
Author | SHA1 | Date | |
---|---|---|---|
|
abe55c02d5 | ||
|
f96e8c9a94 | ||
|
4d3b713b05 | ||
|
5f0a16cd1f | ||
|
a8ed6c8b5e | ||
|
eaa0e2b54f | ||
|
6a069f7dc2 | ||
|
0348fcedf6 | ||
|
4a4b3dc693 | ||
|
9336246f00 | ||
|
a1d5a3805a | ||
|
baebad1e93 | ||
|
9a23775dfa | ||
|
daab328cf2 | ||
|
0e3dee9920 | ||
|
53e580b876 | ||
|
fd076e0a2e | ||
|
057d5262a4 | ||
|
214d3afa98 | ||
|
cb2e337c94 | ||
|
cf24f76bf8 | ||
|
ec63c61e09 | ||
|
d83ae88716 | ||
|
e5548693df | ||
|
feeb0f1e45 | ||
|
5e6890a52c | ||
|
db7b726987 | ||
|
b0614beffa | ||
|
2dbb26e394 | ||
|
d166432f37 | ||
|
bcdb08691b | ||
|
f6dba6da1f | ||
|
2419801654 | ||
|
5672891485 | ||
|
7f18ccee94 | ||
|
2f0cfe41b1 | ||
|
7081c02171 | ||
|
1c03463a82 | ||
|
b0476f5a3a | ||
|
96fd058985 | ||
|
12c65a4564 | ||
|
36c8a36976 | ||
|
7de806f57a | ||
|
a3b5187b1f | ||
|
ba81aa14d4 |
6
ISSUE_TEMPLATE.md
Normal file
6
ISSUE_TEMPLATE.md
Normal file
@@ -0,0 +1,6 @@
|
||||
For English speaking user:
|
||||
https://github.com/wangyu-/UDPspeeder/wiki/Issue-Guide
|
||||
|
||||
中文用户请看:
|
||||
https://github.com/wangyu-/UDPspeeder/wiki/发Issue前请看
|
||||
(否则Issue可能被忽略,或被直接关掉)
|
22
README.md
22
README.md
@@ -78,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"
|
||||
```
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
##### Note
|
||||
|
||||
@@ -86,43 +86,43 @@ Now connecting to UDP port 3333 at the client side is equivalent to connecting t
|
||||
|
||||
`-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.
|
||||
|
||||
# Advanced Topic
|
||||
### Full Options
|
||||
```
|
||||
UDPspeeder V2
|
||||
git version:8e7a8aed92 build date:Oct 25 2017 02:00:54
|
||||
git version: 6f55b8a2fc build date: Nov 19 2017 06:11:23
|
||||
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:
|
||||
common options, 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
|
||||
--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)
|
||||
--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.
|
||||
--mode <number> fec-mode,available values: 0,1; mode 0(default) costs less bandwidth,no mtu problem.
|
||||
mode 1 usually introduces less latency, but you have to care about mtu.
|
||||
--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.
|
||||
default value:1250
|
||||
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.
|
||||
-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
|
||||
--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:
|
||||
--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.
|
||||
-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
|
||||
--decode-buf <number> size of buffer of fec decoder,u nit: packet, default: 2000
|
||||
--fix-latency <number> try to stabilize latency, only for mode 0
|
||||
--delay-capacity <number> max number of delayed packets
|
||||
|
@@ -52,7 +52,7 @@ u64_t get_current_time()//ms
|
||||
{
|
||||
timespec tmp_time;
|
||||
clock_gettime(CLOCK_MONOTONIC, &tmp_time);
|
||||
return tmp_time.tv_sec*1000+tmp_time.tv_nsec/(1000*1000l);
|
||||
return ((u64_t)tmp_time.tv_sec)*1000llu+((u64_t)tmp_time.tv_nsec)/(1000*1000llu);
|
||||
}
|
||||
|
||||
u64_t get_current_time_us()
|
||||
|
@@ -51,7 +51,7 @@ client支持多个udp连接,server也支持多个client
|
||||
# 简明操作说明
|
||||
|
||||
### 环境要求
|
||||
Linux主机,可以是桌面版,可以是android手机/平板,可以是openwrt路由器,也可以是树莓派。
|
||||
Linux主机,可以是桌面版,可以是android手机/平板,可以是openwrt路由器,也可以是树莓派。Release中提供了`amd64`、`x86`、`arm`、`mips_be`、`mips_le`的预编译binary.
|
||||
|
||||
对于windows和mac用户,在虚拟机中可以稳定使用(speeder跑在Linux里,其他应用照常跑在window里,桥接模式测试可用)。可以使用[这个](https://github.com/wangyu-/udp2raw-tunnel/releases/download/20171108.0/lede-17.01.2-x86_virtual_machine_image.zip)虚拟机镜像,大小只有7.5mb,免去在虚拟机里装系统的麻烦;虚拟机自带ssh server,可以scp拷贝文件,可以ssh进去,可以复制粘贴,root密码123456。
|
||||
|
||||
@@ -94,37 +94,39 @@ https://github.com/wangyu-/UDPspeeder/releases
|
||||
### 命令选项
|
||||
```
|
||||
UDPspeeder V2
|
||||
git version:8e7a8aed92 build date:Oct 25 2017 02:00:54
|
||||
git version: 6f55b8a2fc build date: Nov 19 2017 06:11:23
|
||||
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:
|
||||
common options, 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
|
||||
--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)
|
||||
--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.
|
||||
--mode <number> fec-mode,available values: 0,1; mode 0(default) costs less bandwidth,no mtu problem.
|
||||
mode 1 usually introduces less latency, but you have to care about mtu.
|
||||
--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.
|
||||
default value:1250
|
||||
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.
|
||||
-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
|
||||
--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:
|
||||
--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.
|
||||
-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
|
||||
--decode-buf <number> size of buffer of fec decoder,u nit: packet, default: 2000
|
||||
--fix-latency <number> try to stabilize latency, only for mode 0
|
||||
--delay-capacity <number> max number of delayed packets
|
||||
@@ -137,6 +139,8 @@ log and help options:
|
||||
--disable-color disable log color
|
||||
-h,--help print this help message
|
||||
|
||||
|
||||
|
||||
```
|
||||
### 包发送选项,两端设置可以不同。 只影响本地包发送。
|
||||
##### `-f` 选项
|
||||
@@ -236,7 +240,9 @@ run at client side:
|
||||
|
||||
如果只需要加速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加速。
|
||||
如果你没有kcptun只有BBR/锐速的话,也可以把kcptun换成ncat/socat/ssh tunnel/iptables/[tinyPortMapper](https://github.com/wangyu-/tinyPortMapper/releases)。这样,TCP流量由锐速/BBR加速,UDP由UDPspeeder加速。
|
||||
|
||||
另外,即使你不想使用$\*\*\*的TCP功能,你也必须把$\*\*\*的TCP端口转发过来,否则无法使用UDP功能,这是socks5协议的工作方式决定的。($\*\*\*-redir方式不受此限制)
|
||||
|
||||
#### UDPspeeder + openvpn + $*** 混合方案,也适用于其他VPN
|
||||
也是我正在用的方案。优点是可以随时在vpn和$\*\*\*方案间快速切换。
|
||||
@@ -257,12 +263,23 @@ run at client side:
|
||||
https://github.com/wangyu-/UDPspeeder/wiki/win10系统UDPspeeder-OpenVPN的完整设置
|
||||
|
||||
|
||||
#### UDPspeeder+OpenVPN运行在linux上,透明加速linux本机的网络
|
||||
|
||||
https://github.com/wangyu-/tinyFecVPN/wiki/tinyFecVPN运行在linux上,透明加速linux本机的网络
|
||||
|
||||
|
||||
#### UDPspeeder+OpenVPN运行在虚拟机中,加速windows和局域网内其他主机的网络
|
||||
|
||||
https://github.com/wangyu-/tinyFecVPN/wiki/tinyFecVPN运行在虚拟机中,加速windows和局域网内其他主机的网络
|
||||
|
||||
|
||||
|
||||
#### 用树莓派做路由器,搭建透明代理,加速游戏主机的网络
|
||||
|
||||
https://github.com/wangyu-/UDPspeeder/wiki/用树莓派做路由器,搭建透明代理,加速游戏主机的网络
|
||||
|
||||
|
||||
# 编译教程
|
||||
暂时先参考udp2raw的这篇教程,几乎一样的过程。
|
||||
|
||||
https://github.com/wangyu-/udp2raw-tunnel/blob/master/doc/build_guide.zh-cn.md
|
||||
|
||||
|
@@ -16,7 +16,7 @@ int g_fec_redundant_num=10;
|
||||
int g_fec_mtu=1250;
|
||||
int g_fec_queue_len=200;
|
||||
int g_fec_timeout=8*1000; //8ms
|
||||
int g_fec_mode=1;
|
||||
int g_fec_mode=0;
|
||||
|
||||
int dynamic_update_fec=1;
|
||||
|
||||
|
14
main.cpp
14
main.cpp
@@ -34,19 +34,22 @@ static void print_help()
|
||||
printf("main options:\n");
|
||||
printf(" -f,--fec x:y forward error correction, send y redundant packets for every x packets\n");
|
||||
printf(" --timeout <number> how long could a packet be held in queue before doing fec, unit: ms, default: 8ms\n");
|
||||
printf(" --mode <number> fec-mode,available values: 0, 1; 0 cost less bandwidth, 1 cost less latency(default)\n");
|
||||
printf(" --report <number> turn on send/recv report, and set a period for reporting, unit: s\n");
|
||||
|
||||
printf("advanced options:\n");
|
||||
printf(" --mtu <number> mtu. for mode 0, the program will split packet to segment smaller than mtu_value.\n");
|
||||
printf(" --mode <number> fec-mode,available values: 0,1; mode 0(default) costs less bandwidth,no mtu problem.\n");
|
||||
printf(" mode 1 usually introduces less latency, but you have to care about mtu.\n");
|
||||
printf(" --mtu <number> mtu. for mode 0, the program will split packet to segment smaller than mtu value.\n");
|
||||
printf(" for mode 1, no packet will be split, the program just check if the mtu is exceed.\n");
|
||||
printf(" default value: 1250\n");
|
||||
printf(" default value: 1250. you typically shouldnt change this value.\n");
|
||||
printf(" -q,--queue-len <number> fec queue len, only for mode 0, fec will be performed immediately after queue is full.\n");
|
||||
printf(" default value: 200. \n");
|
||||
printf(" -j,--jitter <number> simulated jitter. randomly delay first packet for 0~<number> ms, default value: 0.\n");
|
||||
printf(" do not use if you dont know what it means.\n");
|
||||
printf(" -i,--interval <number> scatter each fec group to a interval of <number> ms, to protect burst packet loss.\n");
|
||||
printf(" default value: 0. do not use if you dont know what it means.\n");
|
||||
printf(" --random-drop <number> simulate packet loss, unit: 0.01%%. default value: 0\n");
|
||||
printf(" --disable-obscure <number> disable obscure, to save a bit bandwidth and cpu\n");
|
||||
printf(" --random-drop <number> simulate packet loss, unit: 0.01%%. default value: 0.\n");
|
||||
printf(" --disable-obscure <number> disable obscure, to save a bit bandwidth and cpu.\n");
|
||||
// printf(" --disable-xor <number> disable xor\n");
|
||||
|
||||
printf("developer options:\n");
|
||||
@@ -55,7 +58,6 @@ static void print_help()
|
||||
printf(" supported commands.\n");
|
||||
printf(" -j ,--jitter jmin:jmax similiar to -j above, but create jitter randomly between jmin and jmax\n");
|
||||
printf(" -i,--interval imin:imax similiar to -i above, but scatter randomly between imin and imax\n");
|
||||
printf(" -q,--queue-len <number> max fec queue len, only for mode 0\n");
|
||||
printf(" --decode-buf <number> size of buffer of fec decoder,u nit: packet, default: 2000\n");
|
||||
printf(" --fix-latency <number> try to stabilize latency, only for mode 0\n");
|
||||
printf(" --delay-capacity <number> max number of delayed packets\n");
|
||||
|
7
misc.cpp
7
misc.cpp
@@ -15,6 +15,7 @@ int mtu_warn=1350;
|
||||
|
||||
int disable_mtu_warn=1;
|
||||
int disable_fec=0;
|
||||
int disable_checksum=0;
|
||||
|
||||
int debug_force_flush_fec=0;
|
||||
|
||||
@@ -558,6 +559,7 @@ void process_arg(int argc, char *argv[])
|
||||
{"disable-fec", no_argument, 0, 1},
|
||||
{"disable-obscure", no_argument, 0, 1},
|
||||
{"disable-xor", no_argument, 0, 1},
|
||||
{"disable-checksum", no_argument, 0, 1},
|
||||
{"fix-latency", no_argument, 0, 1},
|
||||
{"sock-buf", required_argument, 0, 1},
|
||||
{"random-drop", required_argument, 0, 1},
|
||||
@@ -778,6 +780,11 @@ void process_arg(int argc, char *argv[])
|
||||
mylog(log_info,"xor disabled\n");
|
||||
disable_xor=1;
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"disable-checksum")==0)
|
||||
{
|
||||
disable_checksum=1;
|
||||
mylog(log_warn,"checksum disabled\n");
|
||||
}
|
||||
else if(strcmp(long_options[option_index].name,"fix-latency")==0)
|
||||
{
|
||||
mylog(log_info,"fix-latency enabled\n");
|
||||
|
1
misc.h
1
misc.h
@@ -22,6 +22,7 @@ extern int mtu_warn;
|
||||
|
||||
extern int disable_mtu_warn;
|
||||
extern int disable_fec;
|
||||
extern int disable_checksum;
|
||||
|
||||
extern int debug_force_flush_fec;
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
#include "packet.h"
|
||||
#include "misc.h"
|
||||
|
||||
int iv_min=4;
|
||||
int iv_max=32;//< 256;
|
||||
@@ -315,6 +316,7 @@ int get_conv0(u32_t &conv,const char *input,int len_in,char *&output,int &len_ou
|
||||
}
|
||||
int put_crc32(char * s,int &len)
|
||||
{
|
||||
if(disable_checksum)return 0;
|
||||
assert(len>=0);
|
||||
//if(len<0) return -1;
|
||||
u32_t crc32=crc32h((unsigned char *)s,len);
|
||||
@@ -355,8 +357,8 @@ int de_cook(char * s,int &len)
|
||||
}
|
||||
int rm_crc32(char * s,int &len)
|
||||
{
|
||||
if(disable_checksum)return 0;
|
||||
assert(len>=0);
|
||||
|
||||
len-=sizeof(u32_t);
|
||||
if(len<0) return -1;
|
||||
u32_t crc32_in=read_u32(s+len);
|
||||
|
12
tunnel.cpp
12
tunnel.cpp
@@ -113,12 +113,12 @@ int tunnel_client_event_loop()
|
||||
if (nfds < 0) { //allow zero
|
||||
if(errno==EINTR )
|
||||
{
|
||||
mylog(log_info,"epoll interrupted by signal\n");
|
||||
myexit(0);
|
||||
mylog(log_info,"epoll interrupted by signal continue\n");
|
||||
//myexit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
mylog(log_fatal,"epoll_wait return %d\n", nfds);
|
||||
mylog(log_fatal,"epoll_wait return %d,%s\n", nfds,strerror(errno));
|
||||
myexit(-1);
|
||||
}
|
||||
}
|
||||
@@ -417,12 +417,12 @@ int tunnel_server_event_loop()
|
||||
if (nfds < 0) { //allow zero
|
||||
if(errno==EINTR )
|
||||
{
|
||||
mylog(log_info,"epoll interrupted by signal\n");
|
||||
myexit(0);
|
||||
mylog(log_info,"epoll interrupted by signal,continue\n");
|
||||
//myexit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
mylog(log_fatal,"epoll_wait return %d\n", nfds);
|
||||
mylog(log_fatal,"epoll_wait return %d,%s\n", nfds,strerror(errno));
|
||||
myexit(-1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user