浏览代码

Add files via upload

wangyu- 8 年之前
父节点
当前提交
fc3ae13c3a
共有 7 个文件被更改,包括 126 次插入15 次删除
  1. 33 7
      README.md
  2. 93 8
      doc/README.zh-cn.md
  3. 二进制
      images/FEC.PNG
  4. 二进制
      images/peformance.PNG
  5. 二进制
      images/performance2.PNG
  6. 二进制
      images/restriction.PNG
  7. 二进制
      images/tinyFecVPNcn.PNG

+ 33 - 7
README.md

@@ -22,14 +22,40 @@ Linux host (including desktop Linux,Android phone/tablet, OpenWRT router, or Ras
 
 For Windows and MacOS You can run TinyFecVPN inside [this](https://github.com/wangyu-/udp2raw-tunnel/releases/download/20170918.0/lede-17.01.2-x86_virtual_machine_image_with_udp2raw_pre_installed.zip) 7.5mb virtual machine image.
 
-# How does it work
+
+
+
+# How doest it work
 
 TinyFecVPN uses FEC(Forward Error Correction) to reduce packet loss rate, at the cost of addtional bandwidth. The algorithm for FEC is called Reed-Solomon.
 
-Check UDPspeeder repo for details:
+![](/images/FEC.PNG)
+
+For more details,check:
 
 https://github.com/wangyu-/UDPspeeder/
 
+# Performance Test(throughput)
+
+Server is Vulr VPS in japan,CPU: single core 2.4GHz,ram: 512mb. Client is Bandwagonhost VPS in USA,CPU: single core 2.0GHZ,ram: 96mb。
+
+### Test command
+
+```
+Server side:
+./tinyvpn_amd64 -s -l 0.0.0.0:5533 --mode 0
+iperf3 -s
+
+Client side:
+./tinyvpn_amd64 -c -r 45.76.100.53:5533 --mode 0
+iperf3 -c 10.22.22.1 -P10
+```
+
+### Test result
+
+![image](/images/performance2.PNG)
+
+
 # Getting Started
 
 ### Installing
@@ -38,17 +64,17 @@ Download binary release from https://github.com/wangyu-/tinyFecVPN/releases
 
 ### Running
 
-Assume your server ip is 44.55.66.77, you have a service listening on udp/tcp port 0.0.0.0:7777.
+Assume your server ip is 44.55.66.77, you have a service listening on udp/tcp port 0.0.0.0:7777. 
 
 ```
 # Run at server side:
-./tinyvpn -s -l0.0.0.0:4096 -f20:10 -k "passwd"
+./tinyvpn -s -l0.0.0.0:4096 -f20:10 -k "passwd" --sub-net 10.22.22.0
 
 # Run at client side
-./tinyvpn -c r44.55.66.77:4096 -f20:10 -k "passwd"
+./tinyvpn -c r44.55.66.77:4096 -f20:10 -k "passwd" --sub-net 10.22.22.0
 ```
 
-Now,use 10.0.0.1:7777 to connect to your service,all traffic is speeded-up by FEC.
+Now,use 10.22.22.1:7777 to connect to your service,all traffic is speeded-up by FEC. If you ping 10.22.22.1, you will get ping reply.
 
 ##### Note
 
@@ -71,7 +97,7 @@ usage:
 common options, must be same on both sides:
     -k,--key              <string>        key for simple xor encryption. if not set, xor is disabled
 main options:
-    --sub-net             <number>        specify sub-net, for example: 192.168.1.0 , default: 10.112.0.0
+    --sub-net             <number>        specify sub-net, for example: 192.168.1.0 , default: 10.22.22.0
     --tun-dev             <number>        sepcify tun device name, for example: tun10, default: a random name such as tun987
     -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

+ 93 - 8
doc/README.zh-cn.md

@@ -2,7 +2,7 @@
 
 集成了加速器功能的轻量级VPN,可以加速全流量(TCP/UDP/ICMP)。
 
-![image](/images/tinyFecVPN.PNG)
+![image](/images/tinyFecVPNcn.PNG)
 
 TinyFecVPN使用了和UDPSpeeder相同的lib,用FEC来对抗网络的丢包,改善你的网络在高延迟高丢包环境下的表现。TinyFecVPN和UDPspeeder功能类似,只不过TinyFecVPN工作方式是VPN,UDPspeeder工作方式是UDP tunnel. 
 
@@ -13,10 +13,14 @@ TinyFecVPN使用了和UDPSpeeder相同的lib,用FEC来对抗网络的丢包,
 
 ![](/images/en/scp_compare.PNG)
 
-#### 原理简介
+# 原理简介
 
 主要原理是通过冗余数据来对抗网络的丢包,发送冗余数据的方式支持FEC(Forward Error Correction)和多倍发包,其中FEC算法是Reed-Solomon。
 
+原理图:
+
+![](/images/FEC.PNG)
+
 细节请看UDPspeeder的repo,这里不再重复:
 
 https://github.com/wangyu-/UDPspeeder/
@@ -50,14 +54,14 @@ https://github.com/wangyu-/tinyFecVPN/releases
 
 ```
 # 在server端运行:
-./tinyvpn -s -l0.0.0.0:4096 -f20:10 -k "passwd"
+./tinyvpn -s -l0.0.0.0:4096 -f20:10 -k "passwd" --sub-net 10.22.22.0
 
 # 在client端运行:
-./tinyvpn -c r44.55.66.77:4096 -f20:10 -k "passwd"
+./tinyvpn -c -r44.55.66.77:4096 -f20:10 -k "passwd" --sub-net 10.22.22.0
 
 ```
 
-现在,只要在客户端使用10.0.0.1:7777就可以连上你的服务了,来回的流量都会被加速。
+现在,只要在客户端使用10.22.22.1:7777就可以连上你的服务了,来回的流量都会被加速。去ping 10.22.22.1也会得到回复。
 
 ###### 备注:
 
@@ -65,6 +69,8 @@ https://github.com/wangyu-/tinyFecVPN/releases
 
 `-k` 指定一个字符串,server/client间所有收发的包都会被异或,改变协议特征,防止UDPspeeder的协议被运营商针对。
 
+如果需要更省流量,或者更高吞吐率,请加上`--mode 0`。默认参数是`--mode 1`,倾向于更低的延迟。
+
 # 进阶操作说明
 
 ### 命令选项
@@ -80,7 +86,7 @@ usage:
 common options, must be same on both sides:
     -k,--key              <string>        key for simple xor encryption. if not set, xor is disabled
 main options:
-    --sub-net             <number>        specify sub-net, for example: 192.168.1.0 , default: 10.112.0.0
+    --sub-net             <number>        specify sub-net, for example: 192.168.1.0 , default: 10.22.22.0
     --tun-dev             <number>        sepcify tun device name, for example: tun10, default: a random name such as tun987
     -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
@@ -135,9 +141,88 @@ https://github.com/wangyu-/UDPspeeder
 
 子网中的最后一个数字应该是0, 比如10.10.10.123是不符合规范的, 会被程序自动纠正成10.10.10.0.
 
-### 限制
+# 性能测试(侧重吞吐量)
+
+server 在 vulr 日本,CPU2.4GHz,内存 512mb。client 在搬瓦工美国,CPU 2.0GHZ,内存 96mb。在网路间额外模拟了10%的丢包,用于加重FEC的负担。
+
+### 测试命令
+
+```
+在server端:
+./tinyvpn_amd64 -s -l 0.0.0.0:5533 --mode 0
+iperf3 -s
+在client端:
+./tinyvpn_amd64 -c -r 45.76.100.53:5533 --mode 0
+iperf3 -c 10.22.22.1 -P10
+```
+
+### 测试结果
+
+![image](/images/performance2.PNG)
+
+# 使用经验
+### 不能正常连通
+
+绝大多数情况,都是因为配置了不规范的iptables造成的。不能正常连通,请清空两端的iptables后重试。清空后记得用iptable-save检查,确保确实是清空了的。
+
+还有一部分情况是因为你要访问的服务没有bind在0.0.0.0,请用netstat -nlp检查服务器的bind情况。
+
+### 透过tinyFecVPN免改iptables加速网络
+
+因为iptables很多人都不会配,即使是对熟练的人也容易出错。这里推荐一种免iptables的方法,基本上可以应对任何情况,推荐给新手用。如果你可以熟练配置iptables和路由规则,可以跳过这节。
+
+##### 假设tinyFecVPN client 运行在本地的linux上,现在VPS上有个服务监听在TCP和UDP的0.0.0.0:443,我怎么在本地linux上访问到这个服务?(假设tinyFecVPN server分配的ip是 10.22.22.1)
+
+直接访问10.22.22.1:443即可。
+
+##### 假设tinyFecVPN client运行在路由器/虚拟机里,假设tinyFecVPN Server运行在VPS上,现在VPS上有个服务监听在TCP和UDP的0.0.0.0:443,我怎么在本地windows上访问到这个服务?
+
+假设tinyFecVPN server分配的ip是 10.22.22.1,路由器/虚拟机的ip是192.168.1.105
+
+在路由器/虚拟机中运行如下命令(socat在我提供的虚拟机里已经安装好了):
+
+```
+socat UDP-LISTEN:443,fork,reuseaddr UDP:10.22.22.1:443
+socat TCP-LISTEN:443,fork,reuseaddr TCP:10.22.22.1:443
+```
+
+然后你只需要在本地windows访问192.168.1.105:443就相当于访问VPS上的443端口了。
+
+##### 假设tinyFecVPN client 运行在本地的linux上,假设 tinyFecVPN Server运行在VPS A上。现在另一台VPS B(假设ip是123.123.123.123)上面有个服务监听在123.123.123.123:443,我怎么在本地的linux上,透过tinyFecVPN访问到这个服务?
+
+在VPS A上运行:
+
+```
+socat UDP-LISTEN:443,fork,reuseaddr UDP:123.123.123.123:443
+socat TCP-LISTEN:443,fork,reuseaddr TCP:123.123.123.123:443
+```
+
+然后,VPS B上的443端口就被映射到10.22.22.1:443了。这样,在linux上访问10.22.22.1:443就相当于访问123.123.123.123:443了。
+
+##### 假设tinyFecVPN client运行在路由器/虚拟机里,假设 tinyFecVPN Server运行在VPS A上。现在另一台VPS B(假设ip是123.123.123.123)上面有个服务监听在123.123.123.123:443,我怎么在本地的windows上,透过tinyFecVPN访问到这个服务?
+
+结合前两种情况,就可以了。既在路由器/虚拟机中运行socat,又在VPS中运行socat,就可以把这个端口映射到本地了。
+
+### 重启client或server后不断线
+用下面这个命令,建立一个持久型的tun设备,叫tun100
+```
+ip tuntap add tun100 mode tun
+```
+
+然后在tinyFecVPN里用`--dev-tun tun100`使用这个持久型tun设备。
+
+
+### 其他使用经验
+
+请看UDPspeeder的使用经验一节。UDPspeeder的几乎所有经验在这里都是适用的。
+
+https://github.com/wangyu-/UDPspeeder/blob/master/doc/README.zh-cn.md#使用经验
+
+# 限制
+
+目前,server端的代码里有一个人为限制,作为一个加速器,tinyFecVPN只允许(直接)访问server上的服务,不能(直接)用来科学上网。即使你开启了ipforward和 MASQUERADE也不行,代码里有额外处理,直接透过tinyFecVPN访问第三方服务器的包会被丢掉,效果如图:
 
-目前,server端的代码里有一个人为限制,作为一个加速器,tinyFecVPN只允许访问server上的服务,不能直接用来科学上网。即使你开启了ipforward和 MASQUERADE也不行,代码里有额外处理,直接透过tinyFecVPN访问第三方服务器的包会被丢掉。
+![image](/images/restriction.PNG)
 
 绕过这个限制的方法有:1. 在server搭个代理,比如socks5,透过tinyFecVPN访问这个代理,用代理访问第三方服务器。  2. 自己找到相关限制的代码,修改代码,编译一个自用的无限制版(不要传播)。
 

二进制
images/FEC.PNG


二进制
images/peformance.PNG


二进制
images/performance2.PNG


二进制
images/restriction.PNG


二进制
images/tinyFecVPNcn.PNG