Add comments

This commit is contained in:
Maximilian Friedersdorff 2025-12-11 21:36:13 +00:00
parent 55c7e00ad6
commit 35a5dfc17a

View file

@ -18,6 +18,7 @@ type netList []net.IPNet
const ipHeader = "x-forwarded-for"
// Check if any IPNet in the netList contains the given IP
func (n *netList) Contains(ip net.IP) bool {
for _, net := range *n {
if contains := net.Contains(ip); contains {
@ -27,6 +28,8 @@ func (n *netList) Contains(ip net.IP) bool {
return false
}
// Redirect to redirect url any request where the user is anon and the request
// does not appear to come from a safe origin
func RejectAnonMiddleware(redirect string, next http.Handler) http.Handler {
safeOriginNets := make(netList, 0, len(conf.Conf.AnonCIDRs))