MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / registerManagementRoutes

Method registerManagementRoutes

internal/api/server.go:596–761  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

594}
595
596func (s *Server) registerManagementRoutes() {
597 if s == nil || s.engine == nil || s.mgmt == nil {
598 return
599 }
600 if !s.managementRoutesRegistered.CompareAndSwap(false, true) {
601 return
602 }
603
604 log.Info("management routes registered after secret key configuration")
605
606 s.engine.POST("/v0/management/oauth-callback", s.managementAvailabilityMiddleware(), s.mgmt.PostOAuthCallback)
607 s.engine.GET("/v0/management/oauth-callback", s.managementAvailabilityMiddleware(), s.mgmt.GetOAuthCallback)
608
609 mgmt := s.engine.Group("/v0/management")
610 mgmt.Use(s.managementAvailabilityMiddleware(), s.mgmt.Middleware())
611 {
612 mgmt.GET("/config", s.mgmt.GetConfig)
613 mgmt.GET("/config.yaml", s.mgmt.GetConfigYAML)
614 mgmt.PUT("/config.yaml", s.mgmt.PutConfigYAML)
615 mgmt.GET("/latest-version", s.mgmt.GetLatestVersion)
616 mgmt.GET("/plugins", s.mgmt.ListPlugins)
617 mgmt.GET("/plugin-store", s.mgmt.ListPluginStore)
618 mgmt.POST("/plugin-store/:id/install", s.mgmt.InstallPluginFromStore)
619 mgmt.DELETE("/plugins/:id", s.mgmt.DeletePlugin)
620 mgmt.PATCH("/plugins/:id/enabled", s.mgmt.PatchPluginEnabled)
621 mgmt.GET("/plugins/:id/config", s.mgmt.GetPluginConfig)
622 mgmt.PUT("/plugins/:id/config", s.mgmt.PutPluginConfig)
623 mgmt.PATCH("/plugins/:id/config", s.mgmt.PatchPluginConfig)
624
625 mgmt.GET("/debug", s.mgmt.GetDebug)
626 mgmt.PUT("/debug", s.mgmt.PutDebug)
627 mgmt.PATCH("/debug", s.mgmt.PutDebug)
628
629 mgmt.GET("/logging-to-file", s.mgmt.GetLoggingToFile)
630 mgmt.PUT("/logging-to-file", s.mgmt.PutLoggingToFile)
631 mgmt.PATCH("/logging-to-file", s.mgmt.PutLoggingToFile)
632
633 mgmt.GET("/logs-max-total-size-mb", s.mgmt.GetLogsMaxTotalSizeMB)
634 mgmt.PUT("/logs-max-total-size-mb", s.mgmt.PutLogsMaxTotalSizeMB)
635 mgmt.PATCH("/logs-max-total-size-mb", s.mgmt.PutLogsMaxTotalSizeMB)
636
637 mgmt.GET("/error-logs-max-files", s.mgmt.GetErrorLogsMaxFiles)
638 mgmt.PUT("/error-logs-max-files", s.mgmt.PutErrorLogsMaxFiles)
639 mgmt.PATCH("/error-logs-max-files", s.mgmt.PutErrorLogsMaxFiles)
640
641 mgmt.GET("/usage-statistics-enabled", s.mgmt.GetUsageStatisticsEnabled)
642 mgmt.PUT("/usage-statistics-enabled", s.mgmt.PutUsageStatisticsEnabled)
643 mgmt.PATCH("/usage-statistics-enabled", s.mgmt.PutUsageStatisticsEnabled)
644
645 mgmt.GET("/proxy-url", s.mgmt.GetProxyURL)
646 mgmt.PUT("/proxy-url", s.mgmt.PutProxyURL)
647 mgmt.PATCH("/proxy-url", s.mgmt.PutProxyURL)
648 mgmt.DELETE("/proxy-url", s.mgmt.DeleteProxyURL)
649
650 mgmt.POST("/api-call", s.mgmt.APICall)
651
652 mgmt.GET("/quota-exceeded/switch-project", s.mgmt.GetSwitchProject)
653 mgmt.PUT("/quota-exceeded/switch-project", s.mgmt.PutSwitchProject)

Callers 2

NewServerFunction · 0.95
UpdateClientsMethod · 0.95

Calls 2

MiddlewareMethod · 0.80

Tested by

no test coverage detected