mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
udpxy: Import 1.0.23-9 from packages, add config and use procd.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
config udpxy
|
||||
option verbose '0'
|
||||
option status '1'
|
||||
option bind '0.0.0.0'
|
||||
option port '4022'
|
||||
option source '0.0.0.0'
|
||||
option max_clients '3'
|
||||
option log_file '/var/log/udpxy'
|
||||
option buffer_size '2048'
|
||||
option buffer_messages '1'
|
||||
option buffer_time '1'
|
||||
option nice_increment '0'
|
||||
option mcsub_renew '0'
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2006-2014 OpenWrt.org
|
||||
|
||||
START=50
|
||||
USE_PROCD=1
|
||||
|
||||
udpxy_parse() {
|
||||
local cfg="$1"
|
||||
|
||||
local cfg_verbose
|
||||
local cfg_status
|
||||
local cfg_mcsub_renew
|
||||
local cfg_bind
|
||||
local cfg_port
|
||||
local cfg_source
|
||||
local cfg_max_clients
|
||||
local cfg_log_file
|
||||
local cfg_buffer_size
|
||||
local cfg_buffer_messages
|
||||
local cfg_buffer_time
|
||||
local cfg_nice_increment
|
||||
local cfg_mcsub_renew
|
||||
|
||||
config_get_bool cfg_verbose $cfg 'verbose' 0
|
||||
config_get_bool cfg_status $cfg 'status' 1
|
||||
config_get cfg_bind $cfg 'bind' '0.0.0.0'
|
||||
config_get cfg_port $cfg 'port' '4022'
|
||||
config_get cfg_source $cfg 'source' '0.0.0.0'
|
||||
config_get cfg_max_clients $cfg 'max_clients' '3'
|
||||
config_get cfg_log_file $cfg 'log_file' '/var/log/udpxy'
|
||||
config_get cfg_buffer_size $cfg 'buffer_size' '2048'
|
||||
config_get cfg_buffer_messages $cfg 'buffer_messages' '1'
|
||||
config_get cfg_buffer_time $cfg 'buffer_time' '1'
|
||||
config_get cfg_nice_increment $cfg 'nice_increment' '0'
|
||||
config_get cfg_mcsub_renew $cfg 'mcsub_renew' 0
|
||||
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command /usr/bin/udpxy
|
||||
procd_append_param command -T
|
||||
[ "$cfg_verbose" -eq 1 ] && procd_append_param command -v
|
||||
[ "$cfg_status" -eq 1 ] && procd_append_param command -S
|
||||
procd_append_param command -a $cfg_bind
|
||||
procd_append_param command -p $cfg_port
|
||||
procd_append_param command -m $cfg_source
|
||||
procd_append_param command -c $cfg_max_clients
|
||||
procd_append_param command -l $cfg_log_file
|
||||
[ "$cfg_nice_increment" -ge 4096 ] && procd_append_param command -B $cfg_buffer_size
|
||||
procd_append_param command -R $cfg_buffer_messages
|
||||
procd_append_param command -H $cfg_buffer_time
|
||||
[ "$cfg_nice_increment" -ne 0 ] && procd_append_param command -n $cfg_nice_increment
|
||||
procd_append_param command -M $cfg_mcsub_renew
|
||||
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
start_service() {
|
||||
config_load udpxy
|
||||
config_foreach udpxy_parse udpxy
|
||||
}
|
||||
Reference in New Issue
Block a user