From afe7d3424003b4f5c44458f1e8dd8ed3ee818fb6 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Mon, 6 May 2019 15:59:14 +0000 Subject: [PATCH] shadowsocks-libev: move plugin options to server section Plugin options are properties of shadowsocks deployment as a whole, including both server and each client components. Multiple client instances accessing the same server will need to share the same plugin settings With this change, plugin options will need to specified to "server" and "ss-server" section, not to each component section. Fixes: c19e949 ("shadowsocks-libev: add plugin options support") Reference: https://github.com/openwrt/packages/issues/8903#issuecomment-489674137 Signed-off-by: Yousong Zhou --- net/shadowsocks-libev/Makefile | 2 +- net/shadowsocks-libev/README.md | 2 ++ net/shadowsocks-libev/files/shadowsocks-libev.init | 10 +++++----- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/net/shadowsocks-libev/Makefile b/net/shadowsocks-libev/Makefile index b1dc6bfe75..0374e7ece5 100644 --- a/net/shadowsocks-libev/Makefile +++ b/net/shadowsocks-libev/Makefile @@ -14,7 +14,7 @@ include $(TOPDIR)/rules.mk # PKG_NAME:=shadowsocks-libev PKG_VERSION:=3.2.5 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/shadowsocks/shadowsocks-libev/releases/download/v$(PKG_VERSION) diff --git a/net/shadowsocks-libev/README.md b/net/shadowsocks-libev/README.md index 30181ce25a..742d1316b9 100644 --- a/net/shadowsocks-libev/README.md +++ b/net/shadowsocks-libev/README.md @@ -32,6 +32,8 @@ Section type `server` is for definition of remote shadowsocks servers. They wil Section type `ss_local`, `ss_redir`, `ss_tunnel` are for specification of shadowsocks-libev components. They share mostly a common set of options like `local_port`, `verbose`, `fast_open`, `timeout`, etc. +Plugin options should be specified in `server` section and will be inherited by other compoenents referring to it. + We can have multiple instances of component and `server` sections. The relationship between them is many-to-one. This will have the following implications - It's possible to have both `ss_local` and `ss_redir` referring to the same `server` definition diff --git a/net/shadowsocks-libev/files/shadowsocks-libev.init b/net/shadowsocks-libev/files/shadowsocks-libev.init index 2f51681774..79ec2e8b3a 100644 --- a/net/shadowsocks-libev/files/shadowsocks-libev.init +++ b/net/shadowsocks-libev/files/shadowsocks-libev.init @@ -30,6 +30,8 @@ ss_mkjson_server_conf_() { [ -z "$method" ] || json_add_string method "$method" [ -z "$key" ] || json_add_string key "$key" [ -z "$password" ] || json_add_string password "$password" + [ -z "$plugin" ] || json_add_string plugin "$plugin" + [ -z "$plugin_opts" ] || json_add_string plugin_opts "$plugin_opts" } ss_mkjson_ss_local_conf() { @@ -73,8 +75,6 @@ ss_xxx() { [ -z "$mode" ] || json_add_string mode "$mode" [ -z "$mtu" ] || json_add_int mtu "$mtu" [ -z "$timeout" ] || json_add_int timeout "$timeout" - [ -z "$plugin" ] || json_add_string plugin "$plugin" - [ -z "$plugin_opts" ] || json_add_string plugin_opts "$plugin_opts" [ -z "$user" ] || json_add_string user "$user" json_dump -i >"$confjson" @@ -214,7 +214,9 @@ validate_common_server_options_() { 'server_port:port' \ 'password:string' \ 'key:string' \ - "method:or($stream_methods, $aead_methods)" + "method:or($stream_methods, $aead_methods)" \ + 'plugin:string' \ + 'plugin_opts:string' } validate_common_client_options_() { @@ -239,8 +241,6 @@ validate_common_options_() { 'mode:or("tcp_only", "udp_only", "tcp_and_udp"):tcp_only' \ 'mtu:uinteger' \ 'timeout:uinteger' \ - 'plugin:string' \ - 'plugin_opts:string' \ 'user:string' } -- 2.30.2