mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-29 21:56:40 +00:00
add limiter to the get all peers
This commit is contained in:
@@ -203,6 +203,10 @@ func (h *Handler) HandlePeer(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// GetAllPeers returns a list of all peers associated with a provided account
|
||||
func (h *Handler) GetAllPeers(w http.ResponseWriter, r *http.Request) {
|
||||
if !h.rateLimiter.Allow() {
|
||||
util.WriteError(r.Context(), fmt.Errorf("temp rate limit reached"), w)
|
||||
return
|
||||
}
|
||||
userAuth, err := nbcontext.GetUserAuthFromContext(r.Context())
|
||||
if err != nil {
|
||||
util.WriteError(r.Context(), err, w)
|
||||
|
||||
Reference in New Issue
Block a user