mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
v2ray plugin support
This commit is contained in:
parent
df7a7ffd2b
commit
58b4ff3198
8 changed files with 186 additions and 40 deletions
|
@ -103,6 +103,8 @@ _get_ss_redir() {
|
|||
[ "$cf_no_delay" = "1" ] && no_delay="true"
|
||||
config_get cf_obfs $1 obfs
|
||||
[ "$cf_obfs" = "1" ] && obfs="true"
|
||||
config_get cf_obfs_plugin $1 obfs_plugin
|
||||
config_get cf_obfs_type $1 obfs_type
|
||||
}
|
||||
|
||||
_set_ss_server_vps() {
|
||||
|
@ -123,6 +125,8 @@ _set_ss_server_vps() {
|
|||
current_method="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.method')"
|
||||
current_ebpf="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.ebpf')"
|
||||
current_obfs="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs')"
|
||||
current_obfs_plugin="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs_plugin')"
|
||||
current_obfs_type="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs_type')"
|
||||
current_fast_open="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.fast_open')"
|
||||
current_no_delay="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.no_delay')"
|
||||
|
||||
|
@ -130,12 +134,14 @@ _set_ss_server_vps() {
|
|||
fast_open="false"
|
||||
no_delay="false"
|
||||
obfs="false"
|
||||
obfs_plugin="v2ray"
|
||||
obfs_type="http"
|
||||
config_load shadowsocks-libev
|
||||
config_foreach _get_ss_redir ss_redir
|
||||
|
||||
if [ "$current_port" != "$port" ] || [ "$current_method" != "$method" ] || [ "$current_key" != "$key" ] || [ "$current_ebpf" != "$ebpf" ] || [ "$current_obfs" != "$obfs" ] || [ "$current_fast_open" != "$fast_open" ] || [ "$current_no_delay" != "$no_delay" ]; then
|
||||
if [ "$current_obfs_plugin" != "$obfs_plugin" ] || [ "$current_obfs_type" != "$obfs_type" ] || [ "$current_port" != "$port" ] || [ "$current_method" != "$method" ] || [ "$current_key" != "$key" ] || [ "$current_ebpf" != "$ebpf" ] || [ "$current_obfs" != "$obfs" ] || [ "$current_fast_open" != "$fast_open" ] || [ "$current_no_delay" != "$no_delay" ]; then
|
||||
local settings
|
||||
settings='{"port": '$port',"method":"'$method'","fast_open":'$fast_open',"reuse_port":true,"no_delay":'$no_delay',"mptcp":true,"key":"'$key'","ebpf":'$ebpf',"obfs":'$obfs'}'
|
||||
settings='{"port": '$port',"method":"'$method'","fast_open":'$fast_open',"reuse_port":true,"no_delay":'$no_delay',"mptcp":true,"key":"'$key'","ebpf":'$ebpf',"obfs":'$obfs',"obfs_plugin":"'$obfs_plugin'","obfs_type":"'$obfs_type'"}'
|
||||
_set_json "shadowsocks" "$settings"
|
||||
fi
|
||||
}
|
||||
|
@ -276,12 +282,14 @@ _set_config_from_vps() {
|
|||
ss_no_delay="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.no_delay')"
|
||||
ss_fast_open="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.fast_open')"
|
||||
ss_obfs="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs')"
|
||||
ss_obfs_plugin="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.obfs_plugin')"
|
||||
#ss_reuse_port="$(echo "$vps_config" | jsonfilter -q -e '@.shadowsocks.reuse_port')"
|
||||
config_load shadowsocks-libev
|
||||
config_foreach _set_ss_redir ss_redir "no_delay" $ss_no_delay
|
||||
config_foreach _set_ss_redir ss_redir "fast_open" $ss_fast_open
|
||||
config_foreach _set_ss_redir ss_redir "ebpf" $ss_ebpf
|
||||
config_foreach _set_ss_redir ss_redir "obfs" $ss_obfs
|
||||
config_foreach _set_ss_redir ss_redir "obfs_plugin" $ss_obfs_plugin
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
set shadowsocks-libev.sss0.key=$ss_key
|
||||
set shadowsocks-libev.sss0.server_port=$ss_port
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue