浏览代码

Update README.md

wangyu- 8 年之前
父节点
当前提交
127803e34b
共有 2 个文件被更改,包括 212 次插入4 次删除
  1. 69 4
      README.md
  2. 143 0
      doc/README.zh-cn.md

+ 69 - 4
README.md

@@ -4,11 +4,12 @@ A tiny VPN with Build-in FEC Support.
 
 ![image](/images/tinyFecVPN.PNG)
 
-TinyFecVPN use UDPSpeeder as lib.Supports all FEC features of UDPspeeder. It can improve quality of all network traffic(TCP/UDP/ICMP) as a single program.
+TinyFecVPN use same lib as UDPspeeder. Supports all FEC features of UDPspeeder. It can improve quality of all network traffic(TCP/UDP/ICMP) as a single program. TinyFecVPN works at VPN mode,while UDPspeeder works at UDP tunnel mode.
 
+[简体中文](/doc/README.zh-cn.md)(内容更丰富)
 
 # Efficacy
-Tested on a link with 100ms latency and 10% packet loss at both direction(borrowed UDPspeeder's result)
+Tested on a link with 100ms roundtrip and 10% packet loss at both direction(borrowed UDPspeeder's result)
 
 ### Ping Packet Loss
 ![](/images/en/ping_compare.PNG)
@@ -21,6 +22,14 @@ 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
+
+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:
+
+https://github.com/wangyu-/UDPspeeder/
+
 # Getting Started
 
 ### Installing
@@ -49,6 +58,54 @@ Now,use 10.0.0.1:7777 to connect to your service,all traffic is speeded-up by FE
 
 # Advanced Topic
 
+### Usage
+```
+tinyFecVPN
+git version: becd952db3    build date: Oct 28 2017 07:36:09
+repository: https://github.com/wangyu-/tinyFecVPN/
+
+usage:
+    run as client: ./this_program -c -r server_ip:server_port  [options]
+    run as server: ./this_program -s -l server_listen_ip:server_port  [options]
+
+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
+    --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
+    --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.
+                                          for mode 1, no packet will be split, the program just check if the mtu is exceed.
+                                          default value: 1250
+    -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:
+    --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
+    --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:
+    --log-level           <number>        0: never    1: fatal   2: error   3: warn
+                                          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
+```
 ### FEC Options
 
 The program supports all options of UDPspeeder,check UDPspeeder repo for details:
@@ -69,8 +126,16 @@ Specify the sub-net of VPN. Example: --sub-net 10.10.10.0, in this way,server IP
 
 The last number of option should be zero, for exmaple 10.10.10.123 is invalild, and will be corrected automatically to 10.10.10.0.
 
-##### Restriction
+##### `--keep-reconnect`
+
+Only works at client side.
+
+TinyFecVPN only handles one client at same time,the connection of a new client will kick old client,after being kicked,old client will just exit by default.
+
+If `--keep-reconnect` is enabled , the client will try to get connection back after being kicked.
+
+### Restriction
 
-There is currently an intended restriction at client side.You cant use tinyFecVPN to access a third server directly.So,as a connection speed-up tool,when used alone,it only allows you to speed-up your connection to your server.You cant use it to bypass network firewalls directly.
+There is currently an intended restriction at server side.You cant use tinyFecVPN to access a third server directly. So,as a connection speed-up tool,when used alone,it only allows you to speed-up your connection to your server.You cant use it to bypass network firewalls directly.
 
 To bypass this restriction,you have to disable it by modifying source code,and re-compile by yourself.

+ 143 - 0
doc/README.zh-cn.md

@@ -0,0 +1,143 @@
+# tinyFecVPN
+
+集成了加速器功能的轻量级VPN,可以加速全流量(TCP/UDP/ICMP)。
+
+![image](/images/tinyFecVPN.PNG)
+
+TinyFecVPN使用了和UDPSpeeder相同的lib,用FEC来对抗网络的丢包,改善你的网络在高延迟高丢包环境下的表现。TinyFecVPN和UDPspeeder功能类似,只不过TinyFecVPN工作方式是VPN,UDPspeeder工作方式是UDP tunnel. 
+
+#### 效果
+测试环境是一个有100ms RTT 和10%丢包的网络(借用了UDPspeeder的测试结果)。
+
+![](/images/en/ping_compare.PNG)
+
+![](/images/en/scp_compare.PNG)
+
+#### 原理简介
+
+主要原理是通过冗余数据来对抗网络的丢包,发送冗余数据的方式支持FEC(Forward Error Correction)和多倍发包,其中FEC算法是Reed-Solomon。
+
+细节请看UDPspeeder的repo,这里不再重复:
+
+https://github.com/wangyu-/UDPspeeder/
+
+# 简明操作说明
+
+### 环境要求
+
+Linux主机,可以是桌面版,可以是android手机/平板,可以是openwrt路由器,也可以是树莓派。
+
+在windows和mac上配合虚拟机可以稳定使用(tinyFecVPN跑在Linux里,其他应用照常跑在window里,桥接模式测试可用),可以使用[这个](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,免去在虚拟机里装系统的麻烦;虚拟机自带ssh server,可以scp拷贝文件,可以ssh进去,可以复制粘贴,root密码123456。
+
+android需要通过terminal运行。
+
+需要root或者cap_net_admin权限(因为需要创建tun设备)。
+
+###### 注意
+在使用虚拟机时,建议手动指定桥接到哪个网卡,不要设置成自动。否则可能会桥接到错误的网卡。
+
+# 简明操作说明
+
+### 安装
+
+下载编译好的二进制文件,解压到本地和服务器的任意目录。
+
+https://github.com/wangyu-/tinyFecVPN/releases
+
+### 运行
+
+假设你有一个server,ip为44.55.66.77,有一个服务监听tcp/udp 0.0.0.0:7777。
+
+```
+# 在server端运行:
+./tinyvpn -s -l0.0.0.0:4096 -f20:10 -k "passwd"
+
+# 在client端运行:
+./tinyvpn -c r44.55.66.77:4096 -f20:10 -k "passwd"
+
+```
+
+现在,只要在客户端使用10.0.0.1:7777就可以连上你的服务了,来回的流量都会被加速。
+
+###### 备注:
+
+`-f20:10` 表示对每20个原始数据发送10个冗余包。`-f20:10` 和`-f 20:10`都是可以的,空格可以省略,对于所有的单字节option都是如此。对于双字节option,例如`--mode 0`和`--mtu 1200`,空格不可以省略。
+
+`-k` 指定一个字符串,server/client间所有收发的包都会被异或,改变协议特征,防止UDPspeeder的协议被运营商针对。
+
+# 进阶操作说明
+
+### 命令选项
+```
+tinyFecVPN
+git version: becd952db3    build date: Oct 28 2017 07:36:09
+repository: https://github.com/wangyu-/tinyFecVPN/
+
+usage:
+    run as client: ./this_program -c -r server_ip:server_port  [options]
+    run as server: ./this_program -s -l server_listen_ip:server_port  [options]
+
+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
+    --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
+    --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.
+                                          for mode 1, no packet will be split, the program just check if the mtu is exceed.
+                                          default value: 1250
+    -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:
+    --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
+    --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:
+    --log-level           <number>        0: never    1: fatal   2: error   3: warn
+                                          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
+```
+### 跟UDPspeeder共用的选项
+
+TinyFecVPN支持UDPspeeder的所有选项,具体请看UDPspeeder的repo:
+
+https://github.com/wangyu-/UDPspeeder
+
+### tinyFecVPN的新增选项
+
+##### `--tun-dev`
+
+指定tun设备的名字. 例如: --tun-dev tun100.
+
+如果不指定,tinyFecVPN会创建一个随机名字的tun设备,比如tun987.
+
+##### `--sub-net`
+
+指定VPN的子网。 例如: 对于--sub-net 10.10.10.0, server的IP会被设置成10.10.10.1,client的IP会被设置成10.10.10.2 .
+
+子网中的最后一个数字应该是0, 比如10.10.10.123是不符合规范的, 会被程序自动纠正成10.10.10.0.
+
+### 限制
+
+目前,server端的代码里有一个人为限制,作为一个加速器,tinyFecVPN只允许访问server上的服务,不能直接用来科学上网。即使你开启了ipforward和 MASQUERADE也不行,代码里有额外处理,直接透过tinyFecVPN访问第三方服务器的包会被丢掉。
+
+绕过这个限制的方法有:1. 在server搭个代理,比如socks5,透过tinyFecVPN访问这个代理,用代理访问第三方服务器。  2. 自己找到相关限制的代码,修改代码,编译一个自用的无限制版(不要传播)。
+