Assorted small changes: name fix, adding comments, cookie domain fix

This commit is contained in:
🐙PiperYxzzy
2022-08-06 19:59:08 +02:00
parent 1dc0e18773
commit 74538d6f23
2 changed files with 12 additions and 2 deletions

View File

@@ -91,6 +91,10 @@ var unauthed = megabucket{
},
}
/**
* Applies rate limiting to unauthorized actors based on their IP address.
* Imperfect, but better than a stab to the eye with a blunt pencil.
*/
func UnauthRateLimit() gin.HandlerFunc {
return func(c *gin.Context) {
ip := c.ClientIP()
@@ -109,6 +113,10 @@ var authed = megabucket{
},
}
/**
* Authorized rate limit. Using the UID of the authorized user as the
* accessor signature, rate limit based on the preexisting rules.
*/
func AuthedRateLimit() gin.HandlerFunc {
return func(c *gin.Context) {
pif, exists := c.Get("principal")