akrabat / ip-address-middleware

PSR-7 Middleware that determines the client IP address and stores it as an ServerRequest attribute
Other
168 stars 38 forks source link

Add CIDR and wildcard matching #21

Closed homeyjd closed 3 years ago

homeyjd commented 5 years ago

Only activated if trusted proxy value contains a "*" (wildcard) or "/" (CIDR). Uses strpos() on object-creation, so very low performance hit. Tests are included.

I need CIDR matching for using this library within a load-balanced AWS VPC. There is no way to accurately predict the IP addresses for the load balancer nodes, you only know the IP range via CIDR block.

Elte156 commented 5 years ago

I too need this functionality.

pmous commented 4 years ago

Hi @homeyjd Sorry, I saw your code just after I commited my own code. I think my code is a bit cleaner (no offence), although I only support CIDR. I really don't see the need for wildcards. I see your code still is not merged. 2 years ago :-(. Any idea why it is not merged yet?

akrabat commented 3 years ago

I have no excuse for how long this has taken me to get to. I'm taking this, but it needed rebasing, which is #28.