diff --git a/luci-app-shadowsocks-rust/htdocs/luci-static/resources/shadowsocks-rust.js b/luci-app-shadowsocks-rust/htdocs/luci-static/resources/shadowsocks-rust.js index 4e6d12605..238cb10bb 100644 --- a/luci-app-shadowsocks-rust/htdocs/luci-static/resources/shadowsocks-rust.js +++ b/luci-app-shadowsocks-rust/htdocs/luci-static/resources/shadowsocks-rust.js @@ -183,7 +183,8 @@ return L.Class.extend({ } else if (stype === 'ss_local' || stype === 'ss_redir' || stype === 'ss_tunnel') { this.cfgvalue_overview_(sdata, lines, names_options_client); if (stype === 'ss_tunnel') { - this.cfgvalue_overview_(sdata, lines, ['tunnel_address']); + this.cfgvalue_overview_(sdata, lines, ['forward_address']); + this.cfgvalue_overview_(sdata, lines, ['forward_port']); } this.cfgvalue_overview_(sdata, lines, names_options_common); } else { diff --git a/luci-app-shadowsocks-rust/htdocs/luci-static/resources/view/shadowsocks-rust/instances.js b/luci-app-shadowsocks-rust/htdocs/luci-static/resources/view/shadowsocks-rust/instances.js index 66b18163d..419eed46f 100644 --- a/luci-app-shadowsocks-rust/htdocs/luci-static/resources/view/shadowsocks-rust/instances.js +++ b/luci-app-shadowsocks-rust/htdocs/luci-static/resources/view/shadowsocks-rust/instances.js @@ -92,10 +92,13 @@ return L.view.extend({ } else { ss.options_client(s, 'general', res[1]); if (stype === 'ss_tunnel') { - o = s.taboption('general', form.Value, 'tunnel_address', + o = s.taboption('general', form.Value, 'forward_address', _('Tunnel address'), _('The address ss-tunnel will forward traffic to')); - o.datatype = 'hostport'; + o.datatype = 'host'; + o = s.taboption('general', form.Value, 'forward_port', + _('Tunnel port'), + _('The port ss-tunnel will forward traffic to')); } } }, this)); diff --git a/openmptcprouter/files/etc/uci-defaults/1930-omr-shadowsocks b/openmptcprouter/files/etc/uci-defaults/1930-omr-shadowsocks index 437ede096..cd8386aa9 100755 --- a/openmptcprouter/files/etc/uci-defaults/1930-omr-shadowsocks +++ b/openmptcprouter/files/etc/uci-defaults/1930-omr-shadowsocks @@ -127,6 +127,14 @@ if [ -z "$(uci -q get shadowsocks-rust.hi1.keep_alive)" ]; then commit shadowsocks-rust EOF fi +if [ -z "$(uci -q get shadowsocks-rust.dns.forward_address)" ]; then + uci -q batch <<-EOF > /dev/null + set shadowsocks-rust.dns.forward_address="8.8.8.8" + set shadowsocks-rust.dns.forward_port=53 + del shadowsocks-rust.dns.tunnel_address + commit shadowsocks-rust + EOF +fi rm -f /tmp/luci-indexcache exit 0 diff --git a/shadowsocks-rust/files/shadowsocks-rust.config b/shadowsocks-rust/files/shadowsocks-rust.config index 498783762..d618841a9 100644 --- a/shadowsocks-rust/files/shadowsocks-rust.config +++ b/shadowsocks-rust/files/shadowsocks-rust.config @@ -57,7 +57,8 @@ config ss_tunnel 'dns' option mode 'tcp_and_udp' option server 'sss0' option local_port '5353' - option tunnel_address '8.8.8.8:53' + option forward_address '8.8.8.8' + option forward_port '53' config ss_local 'tracker_sss0' option server 'sss0' diff --git a/shadowsocks-rust/files/shadowsocks-rust.init-nft b/shadowsocks-rust/files/shadowsocks-rust.init-nft index 9add4eddd..72394c3da 100755 --- a/shadowsocks-rust/files/shadowsocks-rust.init-nft +++ b/shadowsocks-rust/files/shadowsocks-rust.init-nft @@ -55,8 +55,10 @@ ss_mkjson_ss_server_conf() { ss_mkjson_ss_tunnel_conf() { ss_mkjson_server_conf || return 1 - [ -n "$tunnel_address" ] || return 1 - json_add_string tunnel_address "$tunnel_address" + [ -n "$forward_address" ] || return 1 + [ -n "$forward_port" ] || return 1 + json_add_string forward_address "$forward_address" + json_add_int forward_port "$forward_port" } ss_xxx() { @@ -421,5 +423,6 @@ validate_ss_server_section() { validate_ss_tunnel_section() { validate_common_client_options_ ss_tunnel "$1" \ "$2" \ - 'tunnel_address:regex(".+\:[0-9]+")' + 'forward_address:host' + 'forward_port:uinteger' }