From 31bd11db3cf9622ee4816cf8d7d330fa19be215b Mon Sep 17 00:00:00 2001 From: "honwen.chan" Date: Sat, 23 Jan 2021 23:23:09 +0800 Subject: [PATCH] switch to ss-rust --- Makefile | 139 ++++++++++++------------------------------------ README.md | 155 ++++++++++++++++++++++++------------------------------ 2 files changed, 103 insertions(+), 191 deletions(-) diff --git a/Makefile b/Makefile index fd33da4..e46aae0 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2014-2020 Jian Chang +# Copyright (C) 2021 honwen # # This is free software, licensed under the GNU General Public License v3. # See /LICENSE for more information. @@ -7,124 +7,55 @@ include $(TOPDIR)/rules.mk -PKG_NAME:=shadowsocks-libev -PKG_VERSION:=3.3.5 -PKG_RELEASE:=1 +PKG_NAME:=shadowsocks-rust +PKG_VERSION:=1.8.23 +PKG_RELEASE:=20201103 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/shadowsocks/shadowsocks-libev.git -PKG_SOURCE_VERSION:=8285e5a7de093b8ae5a2ca68f7108e6f273092b1 -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz - -PKG_LICENSE:=GPLv3 -PKG_LICENSE_FILES:=LICENSE -PKG_MAINTAINER:=Jian Chang - -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION) - -PKG_INSTALL:=1 -PKG_FIXUP:=autoreconf -PKG_USE_MIPS16:=0 -PKG_BUILD_PARALLEL:=1 -PKG_BUILD_DEPENDS:=c-ares libev libsodium mbedtls pcre - -PKG_CONFIG_DEPENDS:= \ - CONFIG_SHADOWSOCKS_STATIC_LINK \ - CONFIG_SHADOWSOCKS_WITH_EV \ - CONFIG_SHADOWSOCKS_WITH_PCRE \ - CONFIG_SHADOWSOCKS_WITH_CARES \ - CONFIG_SHADOWSOCKS_WITH_SODIUM \ - CONFIG_SHADOWSOCKS_WITH_MBEDTLS +PKG_SOURCE:=shadowsocks-v$(PKG_VERSION).$(ARCH)-unknown-linux-musl.tar.xz +PKG_SOURCE_URL:=https://github.com/shadowsocks/shadowsocks-rust/releases/download/v$(PKG_VERSION)/ +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) +PKG_HASH:=skip include $(INCLUDE_DIR)/package.mk -define Package/shadowsocks-libev +define Package/$(PKG_NAME) SECTION:=net CATEGORY:=Network - TITLE:=Lightweight Secured Socks5 Proxy - URL:=https://github.com/shadowsocks/shadowsocks-libev - DEPENDS:=+libpthread \ - +!SHADOWSOCKS_WITH_EV:libev \ - +!SHADOWSOCKS_WITH_PCRE:libpcre \ - +!SHADOWSOCKS_WITH_CARES:libcares \ - +!SHADOWSOCKS_WITH_SODIUM:libsodium \ - +!SHADOWSOCKS_WITH_MBEDTLS:libmbedtls + TITLE:=Lightweight Secured Socks5 Proxy - Rust. + URL:=https://github.com/shadowsocks/shadowsocks-rust endef -Package/shadowsocks-libev-server = $(Package/shadowsocks-libev) - -define Package/shadowsocks-libev-server/config -menu "Shadowsocks-libev Compile Configuration" - depends on PACKAGE_shadowsocks-libev || PACKAGE_shadowsocks-libev-server - config SHADOWSOCKS_STATIC_LINK - bool "enable static link libraries." - default n - - menu "Select libraries" - depends on SHADOWSOCKS_STATIC_LINK - config SHADOWSOCKS_WITH_EV - bool "static link libev." - default y - - config SHADOWSOCKS_WITH_PCRE - bool "static link libpcre." - default y - - config SHADOWSOCKS_WITH_CARES - bool "static link libcares." - default y - - config SHADOWSOCKS_WITH_SODIUM - bool "static link libsodium." - default y - - config SHADOWSOCKS_WITH_MBEDTLS - bool "static link libmbedtls." - default y - endmenu -endmenu +define Package/$(PKG_NAME)/config + config SS_RUST_SERVER + depends on PACKAGE_shadowsocks-rust + bool "Build ssserver" + config SS_RUST_TOOLS + depends on PACKAGE_shadowsocks-rust + bool "Build ssurl/ssmanager" endef -define Package/shadowsocks-libev/description -Shadowsocks-libev is a lightweight secured socks5 proxy for embedded devices and low end boxes. +define Package/$(PKG_NAME)/description +This is a port of shadowsocks. endef -Package/shadowsocks-libev-server/description = $(Package/shadowsocks-libev/description) - -CONFIGURE_ARGS += \ - --disable-ssp \ - --disable-documentation \ - --disable-assert - -ifeq ($(CONFIG_SHADOWSOCKS_STATIC_LINK),y) - ifeq ($(CONFIG_SHADOWSOCKS_WITH_EV),y) - CONFIGURE_ARGS += --with-ev="$(STAGING_DIR)/usr" - endif - ifeq ($(CONFIG_SHADOWSOCKS_WITH_PCRE),y) - CONFIGURE_ARGS += --with-pcre="$(STAGING_DIR)/usr" - endif - ifeq ($(CONFIG_SHADOWSOCKS_WITH_CARES),y) - CONFIGURE_ARGS += --with-cares="$(STAGING_DIR)/usr" - endif - ifeq ($(CONFIG_SHADOWSOCKS_WITH_SODIUM),y) - CONFIGURE_ARGS += --with-sodium="$(STAGING_DIR)/usr" - endif - ifeq ($(CONFIG_SHADOWSOCKS_WITH_MBEDTLS),y) - CONFIGURE_ARGS += --with-mbedtls="$(STAGING_DIR)/usr" - endif - CONFIGURE_ARGS += LDFLAGS="-Wl,-static -static -static-libgcc" -endif +define Build/Prepare + tar -C $(PKG_BUILD_DIR)/ -Jxf $(DL_DIR)/$(PKG_SOURCE) +endef -define Package/shadowsocks-libev/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-{local,redir,tunnel} $(1)/usr/bin +define Build/Compile + echo "$(PKG_NAME) Compile Skiped!" endef -define Package/shadowsocks-libev-server/install +define Package/$(PKG_NAME)/install $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ss-server $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/sslocal $(1)/usr/bin/ +ifeq ($(CONFIG_SS_RUST_SERVER),y) + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ssserver $(1)/usr/bin/ +endif +ifeq ($(CONFIG_SS_RUST_TOOLS),y) + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ssurl $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ssmanager $(1)/usr/bin/ +endif endef -$(eval $(call BuildPackage,shadowsocks-libev)) -$(eval $(call BuildPackage,shadowsocks-libev-server)) +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/README.md b/README.md index 7ab1318..ffd379c 100644 --- a/README.md +++ b/README.md @@ -1,87 +1,68 @@ -Shadowsocks-libev for OpenWrt -=== - -[![Download][B]][2] - -简介 ---- - - 本项目是 [shadowsocks-libev][1] 在 OpenWrt 上的移植 - -特性 ---- - -软件包只包含 [shadowsocks-libev][1] 的可执行文件, 可与 [luci-app-shadowsocks][3] 搭配使用 -可编译两种版本 - - - shadowsocks-libev - - ``` - 客户端/ - └── usr/ - └── bin/ - ├── ss-local // 提供 SOCKS 代理 - ├── ss-redir // 提供透明代理, 从 v2.2.0 开始支持 UDP - └── ss-tunnel // 提供端口转发, 可用于 DNS 查询 - ``` - - - shadowsocks-libev-server - - ``` - 服务端/ - └── usr/ - └── bin/ - └── ss-server // 服务端可执行文件 - ``` - -编译 ---- - - - 从 OpenWrt 的 [SDK][S] 编译 - - ```bash - # 以 ar71xx 平台为例 - tar xjf OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2 - cd OpenWrt-SDK-ar71xx-* - # 添加 feeds - git clone https://github.com/shadowsocks/openwrt-feeds.git package/feeds - # 获取 shadowsocks-libev Makefile - git clone https://github.com/shadowsocks/openwrt-shadowsocks.git package/shadowsocks-libev - # 选择要编译的包 Network -> shadowsocks-libev - make menuconfig - # 开始编译 - make package/shadowsocks-libev/compile V=99 - ``` - -配置 ---- - - 软件包本身并不包含配置文件, 配置文件内容为 JSON 格式, 支持的键: - - 键名 | 数据类型 | 说明 - ---------------|----------|----------------------------------------------- - server | 字符串 | 服务器地址, 可以是 IP 或者域名 - server_port | 整数值 | 服务器端口号 - local_address | 字符串 | 本地绑定的 IP 地址, 默认 `127.0.0.1` - local_port | 整数值 | 本地绑定的端口号 - password | 字符串 | 服务端设置的密码 - method | 字符串 | 加密方式, [详情参考][E] - timeout | 整数值 | 超时时间(秒), 默认 60 - plugin | 字符串 | 插件名称, eg: `obfs-local` - plugin_opts | 字符串 | 插件参数, eg: `obfs=http;obfs-host=www.bing.com` - fast_open | 布尔值 | 是否启用 [TCP Fast Open][F] - nofile | 整数值 | 设置 Linux ulimit - mode | 枚举值 | 转发模式, 可用值: [`tcp_only`, `udp_only`, `tcp_and_udp`] - mptcp | 布尔值 | 是否启用 [Multipath TCP][M] - reuse_port | 布尔值 | 是否启用端口复用, 需要内核版本大于 3.9.0 - - - [1]: https://github.com/shadowsocks/shadowsocks-libev - [2]: https://github.com/shadowsocks/openwrt-shadowsocks/releases/latest - [B]: https://img.shields.io/github/release/shadowsocks/openwrt-shadowsocks.svg - [3]: https://github.com/shadowsocks/luci-app-shadowsocks - [A]: https://shadowsocks.org/en/spec/one-time-auth.html - [E]: https://github.com/shadowsocks/luci-app-shadowsocks/wiki/Encrypt-method - [F]: https://github.com/shadowsocks/shadowsocks/wiki/TCP-Fast-Open - [S]: https://wiki.openwrt.org/doc/howto/obtain.firmware.sdk - [M]: https://www.multipath-tcp.org/ +# Shadowsocks-Rust for OpenWrt + +[![Download][b]][2] + +## 简介 + +本项目是 [shadowsocks-rust][1] 在 OpenWrt 上的移植 + +## 特性 + +软件包只包含 [shadowsocks-rust][1] 的可执行文件, 可与 [luci-app-shadowsocks][3] 搭配使用 +可编译两种版本 + +- shadowsocks-rust + + ``` + 客户端/ + └── usr/ + └── bin/ + ├── sslocal // 提供 SOCKS 代理 + ├── ssredir // 提供透明代理 + └── sstunnel // 提供端口转发, 可用于 DNS 查询 + └── ssurl // SIP002: ShadowSocks URLs (可选) + └── ssserver // 提供 ShadowSocks 服务 (可选) + └── ssmanager // 管理 ShadowSocks 服务 (可选) + ``` + +## 编译 + +- 从 OpenWrt 的 [SDK][s] 编译 + + ```bash + # 以 ar71xx 平台为例 + tar xjf OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.8-linaro_uClibc-0.9.33.2.tar.bz2 + cd OpenWrt-SDK-ar71xx-* + # 获取 shadowsocks-rust Makefile + git clone https://github.com/honwen/openwrt-shadowsocks-rust.git package/shadowsocks-rust + # 选择要编译的包 Network -> shadowsocks-rust + make menuconfig + # 开始编译 + make package/shadowsocks-rust/compile V=99 + ``` + +## 配置 + +软件包本身并不包含配置文件, 配置文件内容为 JSON 格式, 支持的键: + +| 键名 | 数据类型 | 说明 | +| ------------- | -------- | --------------------------------------------------------- | +| server | 字符串 | 服务器地址, 可以是 IP 或者域名 | +| server_port | 整数值 | 服务器端口号 | +| local_address | 字符串 | 本地绑定的 IP 地址, 默认 `127.0.0.1` | +| local_port | 整数值 | 本地绑定的端口号 | +| password | 字符串 | 服务端设置的密码 | +| method | 字符串 | 加密方式, [详情参考][e] | +| timeout | 整数值 | 超时时间(秒), 默认 60 | +| plugin | 字符串 | 插件名称, eg: `obfs-local` | +| plugin_opts | 字符串 | 插件参数, eg: `obfs=http;obfs-host=www.bing.com` | +| nofile | 整数值 | 设置 Linux ulimit | +| mode | 枚举值 | 转发模式, 可用值: [`tcp_only`, `udp_only`, `tcp_and_udp`] | + +[1]: https://github.com/shadowsocks/shadowsocks-rust +[2]: https://github.com/shadowsocks/openwrt-shadowsocks/releases/latest +[b]: https://img.shields.io/crates/v/shadowsocks-rust.svg +[3]: https://github.com/shadowsocks/luci-app-shadowsocks +[a]: https://shadowsocks.org/en/spec/one-time-auth.html +[e]: https://github.com/shadowsocks/luci-app-shadowsocks/wiki/Encrypt-method +[s]: https://wiki.openwrt.org/doc/howto/obtain.firmware.sdk