Files
software-station/internal/security/constants.go
Sudo-Ivan 9fb84eb228 Update global and API rate limits for enhanced performance
- Increased GlobalRateLimit from 100 to 500 to accommodate higher traffic.
- Raised APIRateLimit from 30 to 150 to improve API responsiveness and user experience.
2025-12-27 22:38:27 -06:00

51 lines
1.2 KiB
Go

package security
import (
"time"
"golang.org/x/time/rate"
)
const (
_ = iota
KB = 1 << (10 * iota)
MB
GB
)
const (
// Download Throttling
DefaultDownloadLimit = rate.Limit(5 * MB) // 5MB/s
DefaultDownloadBurst = 2 * MB // 2MB
SpeedDownloaderLimit = rate.Limit(1 * MB) // 1MB/s
SpeedDownloaderBurst = 512 * KB // 512KB
HeavyDownloaderThreshold = 1 * GB // 1GB
HeavyDownloaderLimit = rate.Limit(256 * KB) // 256KB/s
// Rate Limiting
GlobalRateLimit = 500
GlobalRateWindow = 1 * time.Minute
APIRateLimit = 150
APIRateWindow = 1 * time.Minute
)
var ForbiddenPatterns = []string{
".git", ".env", ".aws", ".config", ".ssh",
"wp-admin", "wp-login", "phpinfo", ".php",
"etc/passwd", "cgi-bin", "shell", "cmd",
".sql", ".bak", ".old", ".zip", ".rar",
}
var BotUserAgents = []string{
"bot", "crawl", "spider", "slurp", "googlebot", "bingbot", "yandexbot",
"ahrefsbot", "baiduspider", "duckduckbot", "facebookexternalhit",
"twitterbot", "rogerbot", "linkedinbot", "embedly", "quora link preview",
"showyoubot", "outbrain", "pinterest", "slackbot", "vkShare", "W3C_Validator",
}
var SpeedDownloaders = []string{
"aria2", "wget", "curl", "axel", "transmission", "libcurl",
}