{"id":13825894,"url":"https://github.com/liudf0716/xkcptun","last_synced_at":"2025-04-04T17:09:08.409Z","repository":{"id":133604685,"uuid":"86565195","full_name":"liudf0716/xkcptun","owner":"liudf0716","description":"xkcptun is kcp tunnel for OpenWRT\u0026LEDE, implemented in c language","archived":false,"fork":false,"pushed_at":"2024-02-06T17:41:55.000Z","size":338,"stargazers_count":469,"open_issues_count":13,"forks_count":118,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-03-28T16:08:24.973Z","etag":null,"topics":["embedded","kcp","kcptun","lede","libevent","openwrt","shadowsocks"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liudf0716.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://paypal.me/liudf0716"}},"created_at":"2017-03-29T09:46:05.000Z","updated_at":"2025-03-12T14:57:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"21507e0d-8d3c-445d-8393-16034479fe05","html_url":"https://github.com/liudf0716/xkcptun","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liudf0716%2Fxkcptun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liudf0716%2Fxkcptun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liudf0716%2Fxkcptun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liudf0716%2Fxkcptun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liudf0716","download_url":"https://codeload.github.com/liudf0716/xkcptun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217210,"owners_count":20903009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embedded","kcp","kcptun","lede","libevent","openwrt","shadowsocks"],"created_at":"2024-08-04T09:01:28.714Z","updated_at":"2025-04-04T17:09:08.377Z","avatar_url":"https://github.com/liudf0716.png","language":"C","funding_links":["https://paypal.me/liudf0716"],"categories":["\u003ca id=\"01e6651181d405ecdcd92a452989e7e0\"\u003e\u003c/a\u003e工具","Library"],"sub_categories":["\u003ca id=\"9d6789f22a280f5bb6491d1353b02384\"\u003e\u003c/a\u003e隧道\u0026\u0026穿透","Low Level"],"readme":"![xkcptun](https://github.com/liudf0716/xkcptun/blob/master/logo-big.png)\n\n[![Build Status][1]][2] \n[![Powered][3]][4]\n[![license][5]][6]\n[![PRs Welcome][7]][8]\n[![Issue Welcome][9]][10]\n[![OpenWRT][11]][12]\n[![KunTeng][13]][14]\n\n[1]: https://img.shields.io/travis/liudf0716/xkcptun.svg?style=plastic\n[2]: https://travis-ci.org/liudf0716/xkcptun\n[3]: https://img.shields.io/badge/KCP-Powered-blue.svg?style=plastic\n[4]: https://github.com/skywind3000/kcp\n[5]: https://img.shields.io/badge/license-GPLV3-brightgreen.svg?style=plastic\n[6]: https://github.com/KunTengRom/xfrp/blob/master/LICENSE\n[7]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=plastic\n[8]: https://github.com/liudf0716/xkcptun/pulls\n[9]: https://img.shields.io/badge/Issues-welcome-brightgreen.svg?style=plastic\n[10]: https://github.com/liudf0716/xkcptung/issues/new\n[11]: https://img.shields.io/badge/Platform-%20OpenWRT%20%7CLEDE%20%7CCentOS%20-brightgreen.svg?style=plastic\n[12]: https://github.com/gigibox/openwrt-xkcptun\n[13]: https://img.shields.io/badge/KunTeng-Inside-blue.svg?style=plastic\n[14]: http://rom.kunteng.org\n\n# xkcptun 基于kcp和libevent2库，用c语言实现的kcptun\n\nxkcptun主要应用于LEDE，openwrt中，其原理如图：\n\n\u003cimg src=\"kcptun.png\" alt=\"kcptun\" height=\"300px\"/\u003e\n\n### Compile\n\nxkcptun依赖[libevent2](https://github.com/libevent/libevent)\n\n安装libevent2库后 (apt-get install libevent-dev)\n\ngit clone https://github.com/liudf0716/xkcptun.git\n\ncd xkcptun\n\nmkdir build \u0026\u0026 cd build\n\ncmake .. (camke -DBUILD_STATIC_LINK=yes .. //静态链接)\n\nmake\n\n\n生成xkcp_client, xkcp_server, xkcp_spy\n\n#### 参考文档\n\n1, [安装libjson c的问题](https://github.com/liudf0716/xkcptun/wiki/%E5%AE%89%E8%A3%85libjson-c%E7%9A%84%E9%97%AE%E9%A2%98)\n\n2, [bbr vs kcp  优化http下载性能对比报告](https://github.com/liudf0716/xkcptun/wiki/bbr-vs-kcp-%E4%BC%98%E5%8C%96http%E4%B8%8B%E8%BD%BD%E6%80%A7%E8%83%BD%E5%AF%B9%E6%AF%94%E6%8A%A5%E5%91%8A)\n\n3, [如何在centos上部署xkcptun server](https://github.com/liudf0716/xkcptun/pull/11)\n\n### OpenWrt\n编译及安装请参考 [openwrt-xkcptun](https://github.com/gigibox/openwrt-xkcptun)\n\n### QuickStart\n\n为方便理解和使用，我们将使用场景放在同一台pc上，pc使用ubuntu系统，我们通过xkcptun来访问本机的http server\n\n假设pc的 eth0 ip 为 192.168.199.18， http server的监听端口为80端口，xkcptun的server和client配置分别如下：\n\nserver.json 如下：\n```\n{\n  \"localinterface\": \"eth0\",\n  \"localport\": 9089,\n  \"remoteaddr\": \"192.168.199.18\",\n  \"remoteport\": 80,\n  \"key\": \"14789632a\",\n  \"crypt\": \"none\",\n  \"mode\": \"fast3\",\n  \"mtu\": 1350,\n  \"sndwnd\": 1024,\n  \"rcvwnd\": 1024,\n  \"datashard\": 10,\n  \"parityshard\": 3,\n  \"dscp\": 0,\n  \"nocomp\": true,\n  \"acknodelay\": false,\n  \"nodelay\": 0,\n  \"interval\": 20,\n  \"resend\": 2,\n  \"nc\": 1,\n  \"sockbuf\": 4194304,\n  \"keepalive\": 10\n}\n```\n\nclient.json如下：\n```\n{\n  \"localinterface\": \"eth0\",\n  \"localport\": 9088,\n  \"remoteaddr\": \"192.168.199.18\",\n  \"remoteport\": 9089,\n  \"key\": \"14789632a\",\n  \"crypt\": \"none\",\n  \"mode\": \"fast3\",\n  \"mtu\": 1350,\n  \"sndwnd\": 1024,\n  \"rcvwnd\": 1024,\n  \"datashard\": 10,\n  \"parityshard\": 3,\n  \"dscp\": 0,\n  \"nocomp\": true,\n  \"acknodelay\": false,\n  \"nodelay\": 0,\n  \"interval\": 20,\n  \"resend\": 2,\n  \"nc\": 1,\n  \"sockbuf\": 4194304,\n  \"keepalive\": 10\n}\n```\n\n分别运行：\n\nxkcp_server -c server.json -f -d 7\n\nxkcp_client -c client.json -f -d 7\n\n\n[注] 以上命令都是运行在debug和前台运行模式，正式部署的时候要把 -f 去掉， -d 0 如： xkcp_server -c server.json -d 0\n\ncurl http://192.168.199.18:9088\n\n其执行效果与curl http://192.168.199.18 等同\n\n\nxkcp_spy -h 192.168.199.18 -s -t status\n\n查看服务器端的情况\n\nxkcp_spy -h 192.168.199.18 -c -t status\n\n查看客户端的情况\n\n### Todo\n\nCompatible with [kcptun](https://github.com/xtaci/kcptun)  \u003cimg src=\"https://github.com/xtaci/kcptun/blob/master/logo-small.png\" alt=\"kcptun\" height=\"24px\" /\u003e \n\n\n\n### How to contribute our project(给本项目做贡献)\n\n\n欢迎大家给本项目提供意见和贡献，提供意见的方法可以在本项目的[Issues](https://github.com/liudf0716/xkcptun/issues/new)提，更加欢迎给项目提PULL REQUEST，具体提交PR的方法请参考[CONTRIBUTING](https://github.com/liudf0716/xkcptun/blob/master/CONTRIBUTING.md)\n\n\n### Contact me \n\nQQ群 ： [331230369](https://jq.qq.com/?_wv=1027\u0026k=47QGEhL)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliudf0716%2Fxkcptun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliudf0716%2Fxkcptun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliudf0716%2Fxkcptun/lists"}