Enhance graceful shutdown and logging for HTTP server
- Implemented graceful shutdown for the HTTP server, allowing for a controlled shutdown process with a timeout. - Added logging for shutdown signals and server exit to improve traceability during application termination. - Introduced IP blacklist configuration to enhance security by blocking specified IP addresses. - Updated database cache configurations to allow dynamic adjustment via environment variables for better performance tuning.
This commit is contained in:
@@ -54,6 +54,16 @@ func (s *Server) isIPBlacklisted(remote string) bool {
|
||||
// Extract IP from remote address (e.g., "192.168.1.1:12345" -> "192.168.1.1")
|
||||
remoteIP := strings.Split(remote, ":")[0]
|
||||
|
||||
// Check static IP blacklist from config first
|
||||
if len(s.Config.IPBlacklist) > 0 {
|
||||
for _, blocked := range s.Config.IPBlacklist {
|
||||
// Allow simple prefix matching for subnets (e.g., "192.168" matches 192.168.0.0/16)
|
||||
if blocked != "" && strings.HasPrefix(remoteIP, blocked) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if managed ACL is available and active
|
||||
if s.Config.ACLMode == "managed" {
|
||||
for _, aclInstance := range acl.Registry.ACL {
|
||||
|
||||
Reference in New Issue
Block a user