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.

46 lines
1000 B

  1. #!/bin/sh /etc/rc.common
  2. START=80
  3. USE_PROCD=1
  4. PROG=/usr/sbin/https_dns_proxy
  5. xappend() { param="$param $1"; }
  6. append_parm() {
  7. local section="$1"
  8. local option="$2"
  9. local switch="$3"
  10. local default="$4"
  11. local _loctmp
  12. config_get _loctmp "$section" "$option" "$default"
  13. [ -z "$_loctmp" ] && return 0
  14. xappend "$switch $_loctmp"
  15. }
  16. start_instance() {
  17. local cfg="$1" param
  18. append_parm "$cfg" 'listen_addr' '-a' '127.0.0.1'
  19. append_parm "$cfg" 'listen_port' '-p' '5053'
  20. append_parm "$cfg" 'bootstrap_dns' '-b'
  21. append_parm "$cfg" 'url_prefix' '-r'
  22. append_parm "$cfg" 'user' '-u' 'nobody'
  23. append_parm "$cfg" 'group' '-g' 'nogroup'
  24. append_parm "$cfg" 'subnet_addr' '-e'
  25. append_parm "$cfg" 'proxy_server' '-t'
  26. procd_open_instance
  27. procd_set_param command ${PROG} ${param}
  28. procd_set_param respawn
  29. procd_close_instance
  30. }
  31. service_triggers() {
  32. procd_add_reload_trigger "https_dns_proxy"
  33. }
  34. start_service() {
  35. config_load 'https_dns_proxy'
  36. config_foreach start_instance 'https_dns_proxy'
  37. }