Skip to content
xkcptun is kcp tunnel for OpenWRT&LEDE, implemented in c language
Branch: master
Clone or download
Latest commit fee5a56 Dec 13, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig Add files via upload Mar 29, 2017
.gitignore ignore CMake cache files Jun 9, 2017
.travis.yml Create .travis.yml Apr 17, 2017
CMakeLists.txt use json-parser instead of libjson-c Jun 9, 2017
CONTRIBUTING.md
CONTRIBUTING_CN.md Create CONTRIBUTING_CN.md Apr 24, 2017
LICENSE
README.md
bbr_http_server.png
bbr_http_server_clan.png add some test png Apr 25, 2017
client.json Update client.json Apr 25, 2017
commandline.c add --syslog option Jun 12, 2017
commandline.h
contributors.md add contributor qihongwei May 24, 2017
debug.c fix openlog first param. May 16, 2017
debug.h Update debug.h Apr 17, 2017
ikcp.c
ikcp.h Correcting the source code to remove warnings Jun 9, 2017
json.c
json.h
jwHash.c
jwHash.h
kcp_http_server.png
kcp_http_server_clan.png add some test png Apr 25, 2017
kcptun.png
logo-big.png
logo.png
server.json Update server.json Apr 25, 2017
tcp_client.c Added some parameters at the command line May 16, 2017
tcp_client.h Update tcp_client.h Apr 10, 2017
tcp_proxy.c Merge branch 'master' of https://github.com/liudf0716/xkcp_client Apr 24, 2017
tcp_proxy.h
version.h Fix compile errors, but can not use now Mar 30, 2017
xkcp_client.c
xkcp_client.h Update xkcp_client.h Apr 6, 2017
xkcp_config.c Invalid config format: show more detailed error message. Jun 12, 2017
xkcp_config.h
xkcp_mon.c
xkcp_mon.h
xkcp_server.c Correcting the source code to remove warnings Jun 9, 2017
xkcp_server.h Update xkcp_server.h Apr 21, 2017
xkcp_spy.c
xkcp_util.c
xkcp_util.h
xkcptun.service add systemd service xkcptun.service May 13, 2017

README.md

xkcptun

Build Status Powered license PRs Welcome Issue Welcome OpenWRT KunTeng

xkcptun 基于kcp和libevent2库,用c语言实现的kcptun

xkcptun主要应用于LEDE,openwrt中,其原理如图:

kcptun

Compile

xkcptun依赖libevent2

安装libevent2库后 (apt-get install libevent-dev)

git clone https://github.com/liudf0716/xkcptun.git

cd xkcptun

mkdir build && cd build

cmake .. (camke -DBUILD_STATIC_LINK=yes .. //静态链接)

make

生成xkcp_client, xkcp_server, xkcp_spy

参考文档

1, 安装libjson c的问题

2, bbr vs kcp 优化http下载性能对比报告

3, 如何在centos上部署xkcptun server

OpenWrt

编译及安装请参考 openwrt-xkcptun

QuickStart

为方便理解和使用,我们将使用场景放在同一台pc上,pc使用ubuntu系统,我们通过xkcptun来访问本机的http server

假设pc的 eth0 ip 为 192.168.199.18, http server的监听端口为80端口,xkcptun的server和client配置分别如下:

server.json 如下:

{
  "localinterface": "eth0",
  "localport": 9089,
  "remoteaddr": "192.168.199.18",
  "remoteport": 80,
  "key": "14789632a",
  "crypt": "none",
  "mode": "fast3",
  "mtu": 1350,
  "sndwnd": 1024,
  "rcvwnd": 1024,
  "datashard": 10,
  "parityshard": 3,
  "dscp": 0,
  "nocomp": true,
  "acknodelay": false,
  "nodelay": 0,
  "interval": 20,
  "resend": 2,
  "nc": 1,
  "sockbuf": 4194304,
  "keepalive": 10
}

client.json如下:

{
  "localinterface": "eth0",
  "localport": 9088,
  "remoteaddr": "192.168.199.18",
  "remoteport": 9089,
  "key": "14789632a",
  "crypt": "none",
  "mode": "fast3",
  "mtu": 1350,
  "sndwnd": 1024,
  "rcvwnd": 1024,
  "datashard": 10,
  "parityshard": 3,
  "dscp": 0,
  "nocomp": true,
  "acknodelay": false,
  "nodelay": 0,
  "interval": 20,
  "resend": 2,
  "nc": 1,
  "sockbuf": 4194304,
  "keepalive": 10
}

分别运行:

xkcp_server -c server.json -f -d 7

xkcp_client -c client.json -f -d 7

[注] 以上命令都是运行在debug和前台运行模式,正式部署的时候要把 -f 去掉, -d 0 如: xkcp_server -c server.json -d 0

curl http://192.168.199.18:9088

其执行效果与curl http://192.168.199.18 等同

xkcp_spy -h 192.168.199.18 -s -t status

查看服务器端的情况

xkcp_spy -h 192.168.199.18 -c -t status

查看客户端的情况

Todo

Compatible with kcptun kcptun

How to contribute our project(给本项目做贡献)

欢迎大家给本项目提供意见和贡献,提供意见的方法可以在本项目的Issues提,更加欢迎给项目提PULL REQUEST,具体提交PR的方法请参考CONTRIBUTING

Contact me

QQ群 : 331230369

Please support us and star our project

支付宝首页搜索 582806648 领红包支持本项目

You can’t perform that action at this time.