nutcas3
49dc77d241
feat: Add CSP, Referrer-Policy, and Permissions-Policy headers to SecurityHeadersMiddleware
...
- Add Content-Security-Policy header with self-only defaults and unsafe-inline styles
- Add Referrer-Policy header with strict-origin-when-cross-origin
- Add Permissions-Policy header blocking geolocation, microphone, and camera access
2026-05-01 09:05:02 +03:00
nutcas3
d9c2ad1f71
feat: Add structured JSON logging to PerformanceMiddleware slow request handler with comprehensive request metadata
...
- Replace fmt.Appendf with json.Marshal for structured log output
- Add logData map with level/type/method/path/query/response_time/status/user_agent/ip/timestamp fields
- Update logSlowRequest to output JSON-formatted logs with newline terminator for better log parsing and monitoring integration
2026-04-24 07:35:32 +03:00
nutcas3
7ee875c544
feat: Remove ETag generation and validation middleware, simplify CacheMiddleware to basic Cache-Control header
...
- Remove ResponseWriterWrapper struct with Write/Body methods for response body capture
- Remove ETagData/ETagGenerator structs and all ETag generation/validation/caching logic
- Remove generateETag/generateContentETag/generateWeakETag/etagMatches helper functions
- Remove ETagValidationMiddleware/ContentBasedETagMiddleware/CacheInvalidationMiddleware/AdvancedCacheMiddleware handlers
2026-04-24 07:33:07 +03:00
nutcas3
5a3f08829f
feat: Add response body capture to ContentBasedETagMiddleware for accurate content-based ETag generation
...
- Add ResponseWriterWrapper struct with gin.ResponseWriter and body buffer fields to capture response content
- Add Write method to ResponseWriterWrapper that captures response body while writing to original writer
- Add Body method to ResponseWriterWrapper that returns captured response bytes
- Update ContentBasedETagMiddleware to wrap response writer with ResponseWriterWrapper before calling
2026-04-23 02:59:18 +03:00
nutcas3
5773cf00bb
feat: Add sophisticated ETag generation with SHA-256 hashing, cache storage, validation middleware, and content-based caching
...
- Add ETagData struct with Path/Method/Content/Timestamp/UserID/Params fields for ETag generation
- Add ETagGenerator struct with secretKey/cacheStorage fields and NewETagGenerator constructor
- Add GenerateETag method with SHA-256 hashing, path/method/content/timestamp/userID/params/secretKey composition
- Add GenerateWeakETag for dynamic content, GetCachedETag/CacheETag for cache operations,
2026-04-23 02:53:01 +03:00
nutcas3
6f3a4e2690
feat: Add performance middleware with request tracking, metrics collection, and optimization utilities
...
- Add PerformanceMetrics struct with requestCount/totalResponseTime/slowRequests/fastRequests/errorRequests fields and sync.RWMutex
- Add PerformanceMiddleware struct with metrics/slowThreshold fields and NewPerformanceMiddleware constructor
- Add Middleware method with request timing, metrics updates, X-Response-Time/X-Request-ID headers, and slow request logging
- Add updateMetrics with request
2026-04-23 02:51:20 +03:00