Contributions to the Sarracenia project, a high-performance anti-scraper tarpit server written in Go. Our work focuses on improving client IP handling and logging accuracy for better proxy support.
Add support for X-Real-IP header
Added support for the X-Real-IP header in the client IP detection logic, ensuring proper handling of proxy headers for accurate client identification. This change also reordered header precedence to check X-Real-IP before X-Forwarded-For for better accuracy.
https://github.com/CTAG07/Sarracenia/pull/6
Comprehensive unit tests and testing documentation
Added a comprehensive test suite for the getClientIP function covering:
- Trusted vs. untrusted proxy scenarios
- Header precedence (X-Real-IP before X-Forwarded-For)
- IPv4 and IPv6 CIDR range matching
- Various proxy header combinations
Also added a testing section to the README with clear examples of how to run tests (all tests, package-specific, and single test execution). This improves confidence in the IP detection logic and provides clear guidance for future contributors.
https://github.com/CTAG07/Sarracenia/pull/7
Improved configuration documentation
Clarified the trusted_proxies configuration description to explicitly list the headers that are processed (CF-Connecting-IP, X-Real-IP, and X-Forwarded-For), making it easier for users to understand the proxy handling behavior.