package api import ( "net/http" "vpnem/internal/rules" ) func NewRouter(store *rules.Store) http.Handler { h := NewHandler(store) mux := http.NewServeMux() mux.HandleFunc("GET /health", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.Write([]byte(`{"status":"ok"}`)) }) mux.HandleFunc("GET /api/v1/servers", h.Servers) mux.HandleFunc("GET /api/v1/ruleset/manifest", h.RuleSetManifest) mux.HandleFunc("GET /api/v1/version", h.Version) // Static file serving for .srs and .txt rule files rulesFS := http.StripPrefix("/rules/", http.FileServer(http.Dir(store.RulesDir()))) mux.Handle("/rules/", rulesFS) // Static file serving for client releases releasesFS := http.StripPrefix("/releases/", http.FileServer(http.Dir(store.ReleasesDir()))) mux.Handle("/releases/", releasesFS) return mux }