web_route.go 564 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package main
  2. import "net/http"
  3. type Route struct {
  4. Path string
  5. Handler http.HandlerFunc
  6. }
  7. var routes = []Route{
  8. {
  9. "/api/auth/login",
  10. loginHandler,
  11. },
  12. {
  13. "/api/auth/logout",
  14. logoutHandler,
  15. },
  16. {
  17. "/api/device/imei",
  18. getIMEIHandler,
  19. },
  20. {
  21. "/api/service/log",
  22. serviceLogHandler,
  23. },
  24. {
  25. "/api/network/interfaces",
  26. netInterfaces,
  27. },
  28. {
  29. "/api/network/routes",
  30. netRoutes,
  31. },
  32. {
  33. "/api/network/dns",
  34. netDNS,
  35. },
  36. }
  37. func registerRoutes(mux *http.ServeMux) {
  38. for _, r := range routes {
  39. mux.HandleFunc(r.Path, r.Handler)
  40. }
  41. }