├── .travis.yml ├── LICENSE ├── Makefile └── README.md /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: bionic 2 | os: linux 3 | notifications: 4 | email: false 5 | language: c 6 | compiler: gcc 7 | cache: 8 | bundler: true 9 | ccache: true 10 | directories: 11 | - ${HOME}/dl 12 | - ${HOME}/files 13 | - ${HOME}/feeds 14 | git: 15 | depth: 3 16 | submodules: false 17 | env: 18 | global: 19 | - PACKAGE=kcptun 20 | - DOWNLOAD_DIR=${HOME}/files 21 | - CONFIG_CCACHE=y 22 | matrix: 23 | include: 24 | - env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/x86/64 SDK=-sdk-x86-64_ 25 | - if: tag IS present 26 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/x86/generic SDK=-sdk-x86-generic_ 27 | - if: tag IS present 28 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/ar71xx/generic SDK=-sdk-ar71xx-generic_ 29 | - if: tag IS present 30 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/ramips/mt7620 SDK=-sdk-ramips-mt7620_ 31 | - if: tag IS present 32 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/brcm2708/bcm2709 SDK=-sdk-brcm2708-bcm2709_ 33 | - if: tag IS present 34 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/brcm2708/bcm2710 SDK=-sdk-brcm2708-bcm2710_ 35 | - if: tag IS present 36 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/brcm63xx/generic SDK=-sdk-brcm63xx-generic_ 37 | - if: tag IS present 38 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/bcm53xx/generic SDK=-sdk-bcm53xx-generic_ 39 | - if: tag IS present 40 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/brcm47xx/generic SDK=-sdk-brcm47xx-generic_ 41 | - if: tag IS present 42 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa9 SDK=-sdk-mvebu-cortexa9_ 43 | - if: tag IS present 44 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa72 SDK=-sdk-mvebu-cortexa72_ 45 | - if: tag IS present 46 | env: SDK_PATH=https://downloads.openwrt.org/snapshots/targets/ipq806x/generic SDK=-sdk-ipq806x-generic_ 47 | - if: tag IS present 48 | env: SDK_URL=http://downloads.openwrt.org/snapshots/targets/layerscape/armv8_64b SDK=-sdk-layerscape-armv8_64b_ 49 | before_install: 50 | - test -d "$DOWNLOAD_DIR" || mkdir -p "$DOWNLOAD_DIR" 51 | - cd "$DOWNLOAD_DIR" 52 | - wget "${SDK_PATH}/sha256sums" -O sha256sums 53 | - | 54 | if ! grep -- "$SDK" sha256sums > sha256sums.small 2>/dev/null ; then 55 | printf "\033[1;31m=== Can not find ${SDK} file in sha256sums.\033[m\n" 56 | exit 1 57 | fi 58 | - export SDK_FILE="$(cat sha256sums.small | cut -d' ' -f2 | sed 's/*//g')" 59 | - | 60 | if ! sha256sum -c ./sha256sums.small 2>/dev/null ; then 61 | wget "${SDK_PATH}/${SDK_FILE}" -O "$SDK_FILE" 62 | if ! sha256sum -c ./sha256sums.small 2>/dev/null ; then 63 | printf "\033[1;31m=== SDK can not be verified!\033[m\n" 64 | exit 1 65 | fi 66 | fi 67 | - file "${DOWNLOAD_DIR}/${SDK_FILE}" 68 | install: 69 | - test -d "${HOME}/dl" || mkdir -p "${HOME}/dl" 70 | - test -d "${HOME}/feeds" || mkdir -p "${HOME}/feeds" 71 | - export SDK_HOME="$(mktemp -d)" 72 | - tar -Jxf "${DOWNLOAD_DIR}/${SDK_FILE}" -C "$SDK_HOME" --strip=1 73 | - cd "$SDK_HOME" 74 | - test -d "dl" && rm -rf dl || true 75 | - test -d "feeds" && rm -rf feeds || true 76 | - ln -s "${HOME}/dl/" dl 77 | - ln -s "${HOME}/feeds" feeds 78 | - echo "src-git base https://github.com/openwrt/openwrt.git" >feeds.conf 79 | - echo "src-git packages https://github.com/openwrt/packages.git" >>feeds.conf 80 | - echo "src-git luci https://github.com/openwrt/luci.git" >>feeds.conf 81 | - echo "src-git routing https://git.openwrt.org/feed/routing.git" >>feeds.conf 82 | - echo "src-git telephony https://github.com/openwrt/telephony.git" >>feeds.conf 83 | - ln -s "$TRAVIS_BUILD_DIR" "package/${PACKAGE}" 84 | before_script: 85 | - cd "$SDK_HOME" 86 | - ./scripts/feeds update -a 87 | - | 88 | test -d ./feeds/packages/net/kcptun && \ 89 | rm -rf ./feeds/package/net/kcptun || true 90 | - | 91 | curl https://codeload.github.com/openwrt/packages/tar.gz/${OPENWRT_GOLANG_COMMIT:-master} | \ 92 | tar -xz -C ./feeds/packages/lang --strip=2 packages-${OPENWRT_GOLANG_COMMIT:-master}/lang/golang 93 | - ./scripts/feeds install -a 94 | - make defconfig 95 | script: 96 | - cd "$SDK_HOME" 97 | - make package/${PACKAGE}/compile V=s 98 | after_success: 99 | - find "${SDK_HOME}/bin/" 100 | before_deploy: 101 | - find "${SDK_HOME}/bin/" -name ${PACKAGE}-*.ipk -exec cp {} "$TRAVIS_BUILD_DIR" \; 102 | - ls -hl "$TRAVIS_BUILD_DIR" | grep .*\.ipk 103 | deploy: 104 | provider: releases 105 | file_glob: true 106 | file: "${TRAVIS_BUILD_DIR}/*.ipk" 107 | cleanup: false 108 | edge: true 109 | token: $GITHUB_TOKEN 110 | on: 111 | tags: true 112 | all_branches: true 113 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Xingwang Liao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2019-2020 Xingwang Liao 3 | # 4 | # This is free software, licensed under the GNU General Public License v2. 5 | # See /LICENSE for more information. 6 | # 7 | 8 | include $(TOPDIR)/rules.mk 9 | 10 | PKG_NAME:=kcptun 11 | PKG_VERSION:=20210103 12 | PKG_RELEASE:=1 13 | 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 15 | PKG_SOURCE_URL:=https://codeload.github.com/xtaci/kcptun/tar.gz/v$(PKG_VERSION)? 16 | PKG_HASH:=0821b61b92041b764a1d621f750c1c693d913eed43051d3c109bd303d8f02472 17 | 18 | PKG_LICENSE:=MIT 19 | PKG_LICENSE_FILES:=LICENSE.md 20 | PKG_MAINTAINER:=Xingwang Liao 21 | 22 | PKG_BUILD_DEPENDS:=golang/host 23 | PKG_BUILD_PARALLEL:=1 24 | PKG_USE_MIPS16:=0 25 | 26 | GO_PKG:=github.com/xtaci/kcptun 27 | 28 | GO_PKG_LDFLAGS:=-s -w -X 'main.VERSION=$(PKG_VERSION)-$(PKG_RELEASE) for OpenWrt' 29 | 30 | # Can't use GO_PKG_LDFLAGS_X to define X args with space 31 | 32 | include $(INCLUDE_DIR)/package.mk 33 | include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk 34 | 35 | define Package/kcptun/Default 36 | define Package/kcptun-$(1) 37 | SECTION:=net 38 | CATEGORY:=Network 39 | SUBMENU:=Web Servers/Proxies 40 | DEPENDS:=$$(GO_ARCH_DEPENDS) 41 | TITLE:=Simple UDP Tunnel Based On KCP ($1) 42 | URL:=https://github.com/xtaci/kcptun 43 | endef 44 | 45 | define Package/kcptun-$(1)/description 46 | A Stable & Secure Tunnel Based On KCP with N:M Multiplexing. 47 | 48 | This package contains the kcptun $(1). 49 | endef 50 | 51 | define Package/kcptun-$(1)/install 52 | $$(call GoPackage/Package/Install/Bin,$$(PKG_INSTALL_DIR)) 53 | 54 | $$(INSTALL_DIR) $$(1)/usr/bin 55 | $$(INSTALL_BIN) $$(PKG_INSTALL_DIR)/usr/bin/$(1) $$(1)/usr/bin/kcptun-$(1) 56 | endef 57 | endef 58 | 59 | KCPTUN_COMPONENTS:=client server 60 | 61 | $(foreach component,$(KCPTUN_COMPONENTS), \ 62 | $(eval $(call Package/kcptun/Default,$(component))) \ 63 | $(eval $(call GoBinPackage,kcptun-$(component))) \ 64 | $(eval $(call BuildPackage,kcptun-$(component))) \ 65 | ) 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # openwrt-kcptun 2 | 3 | Kcptun Client/Server for OpenWrt 4 | 5 | OpenWrt/LEDE 上可用的 Kcptun 客户端/服务端 6 | 7 | [![Release Version](https://img.shields.io/github/release/kuoruan/openwrt-kcptun.svg)](https://github.com/kuoruan/openwrt-kcptun/releases/latest) [![Latest Release Download](https://img.shields.io/github/downloads/kuoruan/openwrt-kcptun/total.svg)](https://github.com/kuoruan/openwrt-kcptun/releases/latest) 8 | 9 | ## 安装说明 10 | 11 | 1. 到 [release](https://github.com/kuoruan/openwrt-kcptun/releases) 页面下载最新版的```kcptun-client``` 或 ```kcptun-server```(注:请根据你的路由器架构下载对应版本) 12 | 13 | 2. 将文件上传到你的路由器上,进行安装 14 | 15 | ```sh 16 | opkg install kcptun-client_*.ipk 17 | opkg install kcptun-server_*.ipk 18 | ``` 19 | 20 | 安装完毕,你可以在 ```/usr/bin``` 目录下找到对应的二进制文件。 21 | 22 | ``` 23 | root@OpenWrt:~# kcptun-client -v 24 | kcptun version 20190109-2_OpenWrt 25 | 26 | root@OpenWrt:~# kcptun-server -v 27 | kcptun version 20190109-2_OpenWrt 28 | ``` 29 | 30 | 配合 [luci-app-kcptun](https://github.com/kuoruan/luci-app-kcptun) 使用时,请将 ```客户端文件``` 路径配置为 ```/usr/bin/kcptun-client``` 31 | 32 | * 注意:```luci-app-kcptun``` 并不支持 ```kcptun-server```。 33 | 34 | ## 编译说明 35 | 36 | 请使用最新版的 OpenWrt SDK 或 master 版源代码。 37 | 38 | 进入 SDK 根目录或源码根目录,执行命令下载 Makefile: 39 | 40 | ```sh 41 | git clone https://github.com/kuoruan/openwrt-kcptun.git package/kcptun 42 | ``` 43 | 44 | 编译流程: 45 | 46 | ```sh 47 | ./scripts/feeds update -a 48 | ./scripts/feeds install -a 49 | 50 | make menuconfig 51 | 52 | Network ---> Web Servers/Proxies ---> <*> kcptun-client 53 | Network ---> Web Servers/Proxies ---> <*> kcptun-server 54 | 55 | make package/kcptun/{clean,compile} V=s 56 | ``` 57 | 58 | ## 卸载说明 59 | 60 | ```sh 61 | opkg remove kcptun-client 62 | opkg remove kcptun-server 63 | ``` 64 | --------------------------------------------------------------------------------