A More Secure Internet Connection for Your Home https://fen.gg
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.
 
 
 
 
 
 

69 lines
2.2 KiB

  1. package main
  2. //
  3. // Fengg Security Gateway Server Application
  4. // Copyright (C) 2020 Lukas Matt <support@fen.gg>
  5. //
  6. // This program is free software: you can redistribute it and/or modify
  7. // it under the terms of the GNU General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. //
  18. import (
  19. "tea.fen.gg/fengg/server/config"
  20. "tea.fen.gg/fengg/server/types"
  21. "tea.fen.gg/fengg/server/worker"
  22. )
  23. func initWorkers(publicDirectory string) {
  24. var workers []types.Worker
  25. // start profile worker
  26. profiler := worker.NewProfilerWorker()
  27. profiler.Logger(logger)
  28. workers = append(workers, profiler)
  29. frontend := worker.NewFrontendWorker(publicDirectory)
  30. frontend.Logger(logger)
  31. workers = append(workers, frontend)
  32. hwdetect := worker.NewHWDetectWorker()
  33. hwdetect.Logger(logger)
  34. workers = append(workers, hwdetect)
  35. for i := uint16(0); i < uint16(config.App.NfqueueNum); i++ {
  36. queue := worker.NewNFQWorker(i + 100)
  37. queue.Logger(logger)
  38. workers = append(workers, queue)
  39. }
  40. iptables := worker.NewIPTablesWorker(config.App.NfqueueNum)
  41. iptables.Logger(logger)
  42. workers = append(workers, iptables)
  43. portal := worker.NewPortalWorker()
  44. portal.Logger(logger)
  45. workers = append(workers, portal)
  46. // finally start the configuration daemon
  47. confd := worker.NewConfdWorker(workers)
  48. confd.Logger(logger)
  49. go confd.Run()
  50. // configure the network interfaces on startup
  51. worker.ConfigChannel(types.NetworkConfiguration)
  52. // and start DHCP and DNS services
  53. worker.ConfigChannel(types.NetworkDHCPClientConfiguration)
  54. worker.ConfigChannel(types.NetworkDHCPServerConfiguration)
  55. worker.ConfigChannel(types.NetworkDNSConfiguration)
  56. // configure wifi on startup
  57. worker.ConfigChannel(types.WifiAPConfiguration)
  58. worker.ConfigChannel(types.WifiSTAConfiguration)
  59. }