├── README.md ├── bin ├── luci-kcptools_1.0.0-1_all.ipk ├── luci-udptools_1.0.0-1_all.ipk └── lui_udp_kcp.png ├── luci-kcptools ├── Makefile ├── README.md └── src │ ├── etc │ ├── config │ │ └── kcptools │ └── init.d │ │ └── kcptools │ └── luci │ ├── controller │ └── kcptools.lua │ ├── model │ └── cbi │ │ └── kcptools │ │ └── kcptools.lua │ └── view │ └── kcptools │ └── control.htm ├── luci-udptools ├── Makefile ├── README.md └── src │ ├── etc │ ├── config │ │ └── udptools │ └── init.d │ │ └── udptools │ └── luci │ ├── controller │ └── udptools.lua │ ├── i18n │ └── udptools.zh-cn.lmo │ ├── model │ └── cbi │ │ └── udptools.lua │ └── view │ └── control.htm ├── udp2raw └── Makefile └── udpspeeder └── Makefile /README.md: -------------------------------------------------------------------------------- 1 | # openwrt-luci-kcp-udp 软件包 2 | 3 |  4 | 5 | ### OpenWRT-18.06.2 编译完成的 安装包 6 | - udp2raw-tunne udpspeeder luci-udptools [安装包下载](https://github.com/hongwenjun/img/raw/master/openwrt/openwrt_udptools.zip) 7 | - 单独下载 [luci-udptools 和 luci-kcptools](https://github.com/hongwenjun/openwrt-luci-kcp-udp/tree/master/bin) 图形管理配置包(全平台CPU通用) 8 | 9 | ### KcpTun 软件下载 client_linux 改名成 kcp-client 存放路径 /usr/bin 10 | - https://github.com/xtaci/kcptun/releases 11 | 12 | ------ 13 | 14 | ### OpenWRT 安装 WireGuard 配置 Udp2Raw + UdpSpeeder (或者 KcpTun) 15 | - 短网址: https://git.io/wrt.wg 16 | 17 | -------- 18 | 19 | ### OpenWRT-18.06.2 X64 固件和SDK 下载地址和文件名 20 | https://downloads.openwrt.org/releases/18.06.2/targets/x86/64/ 21 | - openwrt-18.06.2-x86-64-combined-squashfs.img.gz 22 | - openwrt-sdk-18.06.2-x86-64_gcc-7.3.0_musl.Linux-x86_64.tar.xz 23 | 24 | ### OpenWRT-18.06.2 x86 固件和SDK 下载地址和文件名 25 | https://downloads.openwrt.org/releases/18.06.2/targets/x86/generic/ 26 | - openwrt-18.06.2-x86-generic-combined-squashfs.img.gz 27 | - openwrt-sdk-18.06.2-x86-generic_gcc-7.3.0_musl.Linux-x86_64.tar.xz 28 | 29 | ### 按CPU选择下载SDK后,在VPS上 解压SDK并重命名为 opensdk 30 | tar xvJf openwrt-sdk-18.06.2-x86-64_gcc-7.3.0_musl.Linux-x86_64.tar.xz 31 | mv openwrt-sdk-18.06.2-x86-64_gcc-7.3.0_musl.Linux-x86_64 ~/opensdk 32 | 33 | ### 安装编译环境 34 | 35 | ``` 36 | apt -y install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc wget unzip python time 37 | apt -y install libcloog-isl-dev 38 | ln -s /usr/lib/x86_64-linux-gnu/libisl.so /usr/lib/libisl.so.10 39 | ``` 40 | 41 | ### 下载 openwrt-luci-kcp-udp 到 opensdk/package 42 | cd ~/opensdk && git clone https://github.com/hongwenjun/openwrt-luci-kcp-udp.git 43 | mv openwrt-luci-kcp-udp/* package 44 | 45 | ### 配置make menuconfig; 在弹出的节目进入Luci—>3. applications,勾选为M即可,保存退出。 46 | cd ~/opensdk && make menuconfig 47 | 48 | ### 使用命令编译 luci-udptools luci-kcptools(目前还没调试完成) 49 | ``` 50 | make package/luci-udptools/compile V=99 51 | make package/luci-kcptools/compile V=99 52 | make package/udp2raw/compile V=99 53 | make package/udpspeeder/compile V=99 54 | 55 | ``` 56 | - 参考文件: 编译openwrt版udpspeeder和udp2raw [文章链接](https://www.atrandys.com/2018/1255.html) 57 | 58 | ### 方便下载ipk的脚本 59 | ``` 60 | #!/bin/bash 61 | cd ~/opensdk/bin/packages/ 62 | ipk_url=http://$(curl -4 ip.sb):8000 63 | python -m SimpleHTTPServer 8000 & 64 | echo -e "请网页打开 ${ipk_url} 下载ipk文件" 65 | echo -e "用命令 opkg install luci-xxxxxx.ipk 安装" 66 | ``` 67 | -------------------------------------------------------------------------------- /bin/luci-kcptools_1.0.0-1_all.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongwenjun/openwrt-luci-kcp-udp/7eadbabf164b1141d5424fcfdd6cd16e372d3977/bin/luci-kcptools_1.0.0-1_all.ipk -------------------------------------------------------------------------------- /bin/luci-udptools_1.0.0-1_all.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongwenjun/openwrt-luci-kcp-udp/7eadbabf164b1141d5424fcfdd6cd16e372d3977/bin/luci-udptools_1.0.0-1_all.ipk -------------------------------------------------------------------------------- /bin/lui_udp_kcp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongwenjun/openwrt-luci-kcp-udp/7eadbabf164b1141d5424fcfdd6cd16e372d3977/bin/lui_udp_kcp.png -------------------------------------------------------------------------------- /luci-kcptools/Makefile: -------------------------------------------------------------------------------- 1 | # https://github.com/hongwenjun/ 2 | 3 | include $(TOPDIR)/rules.mk 4 | 5 | PKG_NAME:=luci-kcptools 6 | PKG_VERSION:=1.0.0 7 | PKG_RELEASE:=1 8 | 9 | include $(INCLUDE_DIR)/package.mk 10 | 11 | define Package/$(PKG_NAME) 12 | SECTION:=luci 13 | CATEGORY:=LuCI 14 | SUBMENU:=3. Applications 15 | TITLE:=LuCI for udp2raw and kcp-client 16 | PKGARCH:=all 17 | endef 18 | 19 | define Package/$(PKG_NAME)/description 20 | LuCI for udp2raw and kcp-client. 21 | endef 22 | 23 | define Build/Prepare 24 | endef 25 | 26 | define Build/Configure 27 | endef 28 | 29 | define Build/Compile 30 | endef 31 | 32 | define Package/$(PKG_NAME)/install 33 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller 34 | $(INSTALL_DATA) ./src/luci/controller/*.lua $(1)/usr/lib/lua/luci/controller/ 35 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/kcptools 36 | $(INSTALL_DATA) ./src/luci/model/cbi/kcptools/*.lua $(1)/usr/lib/lua/luci/model/cbi/kcptools/ 37 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/kcptools 38 | $(INSTALL_DATA) ./src/luci/view/kcptools/*.htm $(1)/usr/lib/lua/luci/view/kcptools/ 39 | $(INSTALL_DIR) $(1)/etc/config 40 | $(INSTALL_CONF) ./src/etc/config/kcptools $(1)/etc/config/kcptools 41 | $(INSTALL_DIR) $(1)/etc/init.d 42 | $(INSTALL_BIN) ./src/etc/init.d/kcptools $(1)/etc/init.d/kcptools 43 | endef 44 | 45 | $(eval $(call BuildPackage,$(PKG_NAME))) 46 | -------------------------------------------------------------------------------- /luci-kcptools/README.md: -------------------------------------------------------------------------------- 1 | # luci-kcptools 2 | openwrt luci for kcp-client and udp2raw 3 | 4 | 5 | ### udp2raw 软件 编译安装 6 | - https://github.com/hongwenjun/openwrt-luci-kcp-udp 7 | 8 | ### kcp-client 软件下载 client_linux 改名成 kcp-client 9 | - https://github.com/xtaci/kcptun/releases 10 | - OpenWRT 存放路径 /usr/bin 11 | -------------------------------------------------------------------------------- /luci-kcptools/src/etc/config/kcptools: -------------------------------------------------------------------------------- 1 | config kcpconfig 2 | option password 'passwd' 3 | option client '127.0.0.1' 4 | option server '11.11.11.11' 5 | option serverport '1111' 6 | option auto '1' 7 | option clientport '3333' 8 | option enable '1' 9 | -------------------------------------------------------------------------------- /luci-kcptools/src/etc/init.d/kcptools: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | START=90 3 | 4 | run_kcp() 5 | { 6 | local server 7 | local serverport 8 | local client 9 | local clientport 10 | local password 11 | 12 | config_get server $1 server 13 | config_get serverport $1 serverport 14 | config_get client $1 client 15 | config_get clientport $1 clientport 16 | config_get password $1 password 17 | 18 | (kcp-client -r 127.0.0.1:4000 -l :$clientport --key $password -mode fast2 -mtu 1300 >/dev/null 2>&1 )& 19 | (udp2raw -c -l127.0.0.1:4000 -r$server:$serverport --raw-mode faketcp -a -k $password >/dev/null 2>&1 )& 20 | 21 | } 22 | 23 | start() 24 | { 25 | config_load kcptools 26 | config_foreach run_kcp kcpconfig 27 | } 28 | 29 | stop() 30 | { 31 | 32 | killall -9 kcp-client 33 | killall -9 udp2raw 34 | } 35 | -------------------------------------------------------------------------------- /luci-kcptools/src/luci/controller/kcptools.lua: -------------------------------------------------------------------------------- 1 | module("luci.controller.kcptools", package.seeall) 2 | 3 | function index() 4 | entry({"admin", "network", "kcptools"}, firstchild(), _("KCPTools")).dependent = false 5 | entry({"admin", "network", "kcptools", "control"}, template("kcptools/control"), _("Control"), 1) 6 | entry({"admin", "network", "kcptools", "config"}, cbi("kcptools/kcptools"), _("Config"), 2) 7 | entry({"admin", "network", "kcptools", "restart"}, call("restart")) 8 | entry({"admin", "network", "kcptools", "stop"}, call("stop")) 9 | end 10 | 11 | function restart() 12 | luci.sys.exec("/etc/init.d/kcptools restart >/dev/null") 13 | luci.template.render("kcptools/control") 14 | end 15 | 16 | function stop() 17 | luci.sys.exec("/etc/init.d/kcptools stop >/dev/null") 18 | luci.template.render("kcptools/control") 19 | end 20 | -------------------------------------------------------------------------------- /luci-kcptools/src/luci/model/cbi/kcptools/kcptools.lua: -------------------------------------------------------------------------------- 1 | require("luci.sys") 2 | 3 | m = Map("kcptools", translate("KCPTools"), translate("kcp-client and udp2raw")) 4 | 5 | s = m:section(TypedSection, "kcpconfig", "") 6 | s.addremove = false 7 | s.anonymous = true 8 | 9 | server = s:option(Value, "server", translate("UDPServer"), translate("UDPServerDesc")) 10 | serverport = s:option(Value, "serverport", translate("ServerPort"), translate("ServerPortDesc")) 11 | client = s:option(Value, "client", translate("KCPClient"), translate("KCPClientDesc")) 12 | clientport = s:option(Value, "clientport", translate("KCPClientPort"), translate("KCPClientPortDesc")) 13 | password = s:option(Value, "password", translate("Password"), translate("PasswordDesc")) 14 | 15 | return m 16 | -------------------------------------------------------------------------------- /luci-kcptools/src/luci/view/kcptools/control.htm: -------------------------------------------------------------------------------- 1 | <%+header%> 2 | <% 3 | local function get_kcp_status(name) 4 | local ps = luci.sys.exec("ps | grep -e %s | grep -v grep 2>/dev/null" %{name}) 5 | local status = "" 6 | if ps ~= "" then 7 | status = "Running" 8 | else 9 | status = "Stoped" 10 | end 11 | return status 12 | end 13 | 14 | local udp2raw_status = get_kcp_status("udp2raw") 15 | local kcpclient_status = get_kcp_status("kcp-client") 16 | -%> 17 | 18 |
39 | 48 | 49 | <%+footer%> 50 | 51 | -------------------------------------------------------------------------------- /luci-udptools/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # author:atrandys 3 | # www.atrandys.com 4 | # 5 | # 6 | 7 | include $(TOPDIR)/rules.mk 8 | 9 | PKG_NAME:=luci-udptools 10 | PKG_VERSION:=1.0.0 11 | PKG_RELEASE:=1 12 | 13 | include $(INCLUDE_DIR)/package.mk 14 | 15 | define Package/$(PKG_NAME) 16 | SECTION:=luci 17 | CATEGORY:=LuCI 18 | SUBMENU:=3. Applications 19 | TITLE:=LuCI for udp2raw and udpspeeder 20 | PKGARCH:=all 21 | endef 22 | 23 | define Package/$(PKG_NAME)/description 24 | LuCI for udp2raw and udpspeeder. 25 | endef 26 | 27 | define Build/Prepare 28 | endef 29 | 30 | define Build/Configure 31 | endef 32 | 33 | define Build/Compile 34 | endef 35 | 36 | define Package/$(PKG_NAME)/install 37 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n 38 | $(INSTALL_DATA) ./src/luci/i18n/udptools.zh-cn.lmo $(1)/usr/lib/lua/luci/i18n/ 39 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller 40 | $(INSTALL_DATA) ./src/luci/controller/*.lua $(1)/usr/lib/lua/luci/controller/ 41 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi 42 | $(INSTALL_DATA) ./src/luci/model/cbi/*.lua $(1)/usr/lib/lua/luci/model/cbi/ 43 | $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view 44 | $(INSTALL_DATA) ./src/luci/view/*.htm $(1)/usr/lib/lua/luci/view/ 45 | $(INSTALL_DIR) $(1)/etc/config 46 | $(INSTALL_CONF) ./src/etc/config/udptools $(1)/etc/config/udptools 47 | $(INSTALL_DIR) $(1)/etc/init.d 48 | $(INSTALL_BIN) ./src/etc/init.d/udptools $(1)/etc/init.d/udptools 49 | endef 50 | 51 | $(eval $(call BuildPackage,$(PKG_NAME))) -------------------------------------------------------------------------------- /luci-udptools/README.md: -------------------------------------------------------------------------------- 1 | # luci-udptools 2 | openwrt luci for udpspeeder and udp2raw 3 | -------------------------------------------------------------------------------- /luci-udptools/src/etc/config/udptools: -------------------------------------------------------------------------------- 1 | 2 | config udpconfig 3 | option password 'passwd' 4 | option timeout '0' 5 | option client '127.0.0.1' 6 | option server '11.11.11.11' 7 | option serverport '1111' 8 | option fec '2:4' 9 | option auto '1' 10 | option clientport '3333' 11 | option enable '1' 12 | 13 | -------------------------------------------------------------------------------- /luci-udptools/src/etc/init.d/udptools: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | START=90 3 | 4 | run_udp() 5 | { 6 | local server 7 | local serverport 8 | local client 9 | local clientport 10 | local password 11 | local fec 12 | local timeout 13 | 14 | config_get server $1 server 15 | config_get serverport $1 serverport 16 | config_get client $1 client 17 | config_get clientport $1 clientport 18 | config_get password $1 password 19 | config_get fec $1 fec 20 | config_get timeout $1 timeout 21 | (udpspeeder -c -l$client:$clientport -r127.0.0.1:21333 -f$fec --mode 0 --timeout $timeout -k $password >/dev/null 2>&1 )& 22 | (udp2raw -c -l127.0.0.1:21333 -r$server:$serverport --raw-mode faketcp -a -k $password >/dev/null 2>&1 )& 23 | ip route add $server via $(ip route | awk '$1=="default" {print $3}') 24 | } 25 | 26 | start() 27 | { 28 | config_load udptools 29 | config_foreach run_udp udpconfig 30 | } 31 | 32 | stop() 33 | { 34 | 35 | killall -9 udpspeeder 36 | killall -9 udp2raw 37 | } 38 | -------------------------------------------------------------------------------- /luci-udptools/src/luci/controller/udptools.lua: -------------------------------------------------------------------------------- 1 | module("luci.controller.udptools", package.seeall) 2 | 3 | function index() 4 | entry({"admin", "network", "udptools"}, firstchild(), _("UDPTools")).dependent = false 5 | entry({"admin", "network", "udptools", "config"}, cbi("udptools"), _("Config"), 2) 6 | entry({"admin", "network", "udptools", "control"}, template("control"), _("Control"), 1) 7 | entry({"admin", "network", "udptools", "restart"}, call("restart")) 8 | entry({"admin", "network", "udptools", "stop"}, call("stop")) 9 | end 10 | 11 | function restart() 12 | luci.sys.exec("/etc/init.d/udptools restart >/dev/null") 13 | luci.template.render("control") 14 | end 15 | 16 | function stop() 17 | luci.sys.exec("/etc/init.d/udptools stop >/dev/null") 18 | luci.template.render("control") 19 | end 20 | -------------------------------------------------------------------------------- /luci-udptools/src/luci/i18n/udptools.zh-cn.lmo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hongwenjun/openwrt-luci-kcp-udp/7eadbabf164b1141d5424fcfdd6cd16e372d3977/luci-udptools/src/luci/i18n/udptools.zh-cn.lmo -------------------------------------------------------------------------------- /luci-udptools/src/luci/model/cbi/udptools.lua: -------------------------------------------------------------------------------- 1 | require("luci.sys") 2 | 3 | m = Map("udptools", translate("UDPTools"), translate("udpspeeder and udp2raw")) 4 | 5 | s = m:section(TypedSection, "udpconfig", "") 6 | s.addremove = false 7 | s.anonymous = true 8 | 9 | server = s:option(Value, "server", translate("UDPServer"), translate("UDPServerDesc")) 10 | serverport = s:option(Value, "serverport", translate("ServerPort"), translate("ServerPortDesc")) 11 | client = s:option(Value, "client", translate("UDPClient"), translate("UDPClientDesc")) 12 | clientport = s:option(Value, "clientport", translate("ClientPort"), translate("ClientPortDesc")) 13 | password = s:option(Value, "password", translate("Password"), translate("PasswordDesc")) 14 | fec = s:option(Value, "fec", translate("Fec"), translate("FecDesc")) 15 | timeout = s:option(Value, "timeout", translate("Timeout"), translate("TimeoutDesc")) 16 | 17 | return m 18 | -------------------------------------------------------------------------------- /luci-udptools/src/luci/view/control.htm: -------------------------------------------------------------------------------- 1 | <%+header%> 2 | <% 3 | local function get_udp_status(name) 4 | local ps = luci.sys.exec("ps | grep -e %s | grep -v grep 2>/dev/null" %{name}) 5 | local status = "" 6 | if ps ~= "" then 7 | status = "Running" 8 | else 9 | status = "Stoped" 10 | end 11 | return status 12 | end 13 | 14 | local udp2raw_status = get_udp_status("udp2raw") 15 | local udpspeeder_status = get_udp_status("udpspeeder") 16 | -%> 17 | 18 | 39 | 48 | 49 | <%+footer%> 50 | 51 | -------------------------------------------------------------------------------- /udp2raw/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017 Yu Wang