feat: limit max connection count (#2701)

This commit is contained in:
BoYanZh
2022-12-14 10:33:58 +08:00
committed by GitHub
parent 33bae52fa1
commit 7947ff1ae4
3 changed files with 21 additions and 0 deletions

View File

@ -16,6 +16,9 @@ func Init(r *gin.Engine) {
common.SecretKey = []byte(conf.Conf.JwtSecret)
Cors(r)
r.Use(middlewares.StoragesLoaded)
if conf.Conf.MaxConnections > 0 {
r.Use(middlewares.MaxAllowed(conf.Conf.MaxConnections))
}
WebDav(r.Group("/dav"))
r.GET("/favicon.ico", handles.Favicon)