Documentation ¶
Index ¶
- Variables
- type Server
- func (s *Server) GetFormattedTimeString() (result string)
- func (s *Server) GetLogMessages(c *fiber.Ctx) error
- func (s *Server) GetLogMessagesWithKey(c *fiber.Ctx) error
- func (s *Server) HandleLogin(context *fiber.Ctx) error
- func (s *Server) HandleLogout(context *fiber.Ctx) error
- func (s *Server) LogMessage(c *fiber.Ctx) error
- func (s *Server) LogMessageWithKey(c *fiber.Ctx) error
- func (s *Server) LogRequest(context *fiber.Ctx) error
- func (s *Server) RenderFailedLogin(context *fiber.Ctx) error
- func (s *Server) RenderHomePage(context *fiber.Ctx) error
- func (s *Server) RenderLoginPage(context *fiber.Ctx) error
- func (s *Server) SetupAdminRoutes()
- func (s *Server) SetupPublicRoutes()
- func (s *Server) Start()
- func (s *Server) ValidateAdmin(context *fiber.Ctx) (result bool)
- func (s *Server) ValidateAdminMW(context *fiber.Ctx) error
- func (s *Server) ValidateLoginCredentials(context *fiber.Ctx) (result bool)
Constants ¶
This section is empty.
Variables ¶
View Source
var CDNLimter = rate_limiter.New(rate_limiter.Config{ Max: 6, Expiration: 1 * time.Second, KeyGenerator: func(c *fiber.Ctx) string { return c.Get("x-forwarded-for") }, LimitReached: func(c *fiber.Ctx) error { ip_address := c.IP() log_message := fmt.Sprintf("%s === %s === %s === PUBLIC RATE LIMIT REACHED !!!", ip_address, c.Method(), c.Path()) log.Info(log_message) c.Set("Content-Type", "text/html") return c.SendString("<html><h1>loading ...</h1><script>setTimeout(function(){ window.location.reload(1); }, 6000);</script></html>") }, })
View Source
var PublicLimter = rate_limiter.New(rate_limiter.Config{ Max: 3, Expiration: 1 * time.Second, KeyGenerator: func(c *fiber.Ctx) string { return c.Get("x-forwarded-for") }, LimitReached: func(c *fiber.Ctx) error { ip_address := c.IP() log_message := fmt.Sprintf("%s === %s === %s === PUBLIC RATE LIMIT REACHED !!!", ip_address, c.Method(), c.Path()) log.Info(log_message) c.Set("Content-Type", "text/html") return c.SendString("<html><h1>loading ...</h1><script>setTimeout(function(){ window.location.reload(1); }, 6000);</script></html>") }, })
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { FiberApp *fiber.App `yaml:"fiber_app"` Config *types.ConfigFile `yaml:"config"` Location *time.Location `yaml:"-"` }
func New ¶
func New(config *types.ConfigFile) (server Server)
func (*Server) GetFormattedTimeString ¶
func (*Server) GetLogMessagesWithKey ¶ added in v1.1.4
func (*Server) HandleLogin ¶
func (*Server) LogMessageWithKey ¶ added in v1.1.4
func (*Server) SetupAdminRoutes ¶
func (s *Server) SetupAdminRoutes()
func (*Server) SetupPublicRoutes ¶
func (s *Server) SetupPublicRoutes()
Click to show internal directories.
Click to hide internal directories.