add naiveproxy
This commit is contained in:
parent
b0ceba06df
commit
dece5df380
5 changed files with 309 additions and 0 deletions
6
naiveproxy/files/naiveproxy.config
Normal file
6
naiveproxy/files/naiveproxy.config
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
config naiveproxy 'config'
|
||||
option enable '0'
|
||||
option listen_addr ''
|
||||
option server_addr ''
|
||||
option extra_argument ''
|
||||
47
naiveproxy/files/naiveproxy.init
Normal file
47
naiveproxy/files/naiveproxy.init
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/procd.sh
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
init_conf() {
|
||||
config_load "naiveproxy"
|
||||
config_get "enable" "config" "enable" "0"
|
||||
config_get "listen_addr" "config" "listen_addr"
|
||||
config_get "server_addr" "config" "server_addr"
|
||||
config_get "extra_argument" "config" "extra_argument"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
init_conf
|
||||
[ "${enable}" == "1" ] || return 0
|
||||
|
||||
procd_open_instance naiveproxy
|
||||
|
||||
procd_set_param command naive
|
||||
procd_append_param command --listen="${listen_addr}"
|
||||
procd_append_param command --proxy="${server_addr}"
|
||||
[ -n "${extra_argument}" ] && procd_append_param command "${extra_argument}"
|
||||
|
||||
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service()
|
||||
{
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "naiveproxy"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue