You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.9 KiB

  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2006-2014 OpenWrt.org
  3. START=50
  4. USE_PROCD=1
  5. udpxy_parse() {
  6. local cfg="$1"
  7. local cfg_verbose
  8. local cfg_status
  9. local cfg_mcsub_renew
  10. local cfg_bind
  11. local cfg_port
  12. local cfg_source
  13. local cfg_max_clients
  14. local cfg_log_file
  15. local cfg_buffer_size
  16. local cfg_buffer_messages
  17. local cfg_buffer_time
  18. local cfg_nice_increment
  19. local cfg_mcsub_renew
  20. config_get_bool cfg_verbose $cfg 'verbose' 0
  21. config_get_bool cfg_status $cfg 'status' 1
  22. config_get cfg_bind $cfg 'bind'
  23. config_get cfg_port $cfg 'port' '4022'
  24. config_get cfg_source $cfg 'source'
  25. config_get cfg_max_clients $cfg 'max_clients'
  26. config_get cfg_log_file $cfg 'log_file'
  27. config_get cfg_buffer_size $cfg 'buffer_size'
  28. config_get cfg_buffer_messages $cfg 'buffer_messages'
  29. config_get cfg_buffer_time $cfg 'buffer_time'
  30. config_get cfg_nice_increment $cfg 'nice_increment'
  31. config_get cfg_mcsub_renew $cfg 'mcsub_renew'
  32. procd_open_instance
  33. procd_set_param command /usr/bin/udpxy
  34. procd_append_param command -T -p $cfg_port
  35. [ "$cfg_verbose" -eq 1 ] && procd_append_param command -v
  36. [ "$cfg_status" -eq 1 ] && procd_append_param command -S
  37. [ ! -z "$cfg_bind" ] && procd_append_param command -a $cfg_bind
  38. [ ! -z "$cfg_source" ] && procd_append_param command -m $cfg_source
  39. [ ! -z "$cfg_max_clients" ] && procd_append_param command -c $cfg_max_clients
  40. [ ! -z "$cfg_log_file" ] && procd_append_param command -l $cfg_log_file
  41. [ ! -z "$cfg_buffer_size" ] && procd_append_param command -B $cfg_buffer_size
  42. [ ! -z "$cfg_buffer_messages" ] && procd_append_param command -R $cfg_buffer_messages
  43. [ ! -z "$cfg_buffer_time" ] && procd_append_param command -H $cfg_buffer_time
  44. [ ! -z "$cfg_nice_increment" ] && procd_append_param command -n $cfg_nice_increment
  45. [ ! -z "$cfg_mcsub_renew" ] && procd_append_param command -M $cfg_mcsub_renew
  46. procd_set_param respawn
  47. procd_close_instance
  48. }
  49. start_service() {
  50. config_load udpxy
  51. config_foreach udpxy_parse udpxy
  52. }