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.

61 lines
1.8 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' '0.0.0.0'
  23. config_get cfg_port $cfg 'port' '4022'
  24. config_get cfg_source $cfg 'source' '0.0.0.0'
  25. config_get cfg_max_clients $cfg 'max_clients' '3'
  26. config_get cfg_log_file $cfg 'log_file' '/var/log/udpxy'
  27. config_get cfg_buffer_size $cfg 'buffer_size' '2048'
  28. config_get cfg_buffer_messages $cfg 'buffer_messages' '1'
  29. config_get cfg_buffer_time $cfg 'buffer_time' '1'
  30. config_get cfg_nice_increment $cfg 'nice_increment' '0'
  31. config_get cfg_mcsub_renew $cfg 'mcsub_renew' 0
  32. procd_open_instance
  33. procd_set_param command /usr/bin/udpxy
  34. procd_append_param command -T
  35. [ "$cfg_verbose" -eq 1 ] && procd_append_param command -v
  36. [ "$cfg_status" -eq 1 ] && procd_append_param command -S
  37. procd_append_param command -a $cfg_bind
  38. procd_append_param command -p $cfg_port
  39. procd_append_param command -m $cfg_source
  40. procd_append_param command -c $cfg_max_clients
  41. procd_append_param command -l $cfg_log_file
  42. [ "$cfg_nice_increment" -ge 4096 ] && procd_append_param command -B $cfg_buffer_size
  43. procd_append_param command -R $cfg_buffer_messages
  44. procd_append_param command -H $cfg_buffer_time
  45. [ "$cfg_nice_increment" -ne 0 ] && procd_append_param command -n $cfg_nice_increment
  46. procd_append_param command -M $cfg_mcsub_renew
  47. procd_set_param respawn
  48. procd_close_instance
  49. }
  50. start_service() {
  51. config_load udpxy
  52. config_foreach udpxy_parse udpxy
  53. }