mholt / caddy-ratelimit

HTTP rate limiting module for Caddy 2
Apache License 2.0
254 stars 17 forks source link

Possible to add MAX incoming connection from remote? #6

Open wazerstar opened 2 years ago

wazerstar commented 2 years ago

Hi I'm using this with the rate limit and its fantastic, however I checked to see if I could find any relation to allowing max active connection from a client/remote and did not succeed.

Would this be something you would consider adding to this or any other project in caddy?

mholt commented 2 years ago

Difficult to say. Connection pooling is handled by the standard library. (As discussed on your forum topic).

It'd probably be much easier (and more practical) to limit the max number of active requests.

I'd be open to a proposal for this feature. It wouldn't be time-based, so that's a little interesting in terms of RL logic.

wazerstar commented 2 years ago

Difficult to say. Connection pooling is handled by the standard library. (As discussed on your forum topic).

It'd probably be much easier (and more practical) to limit the max number of active requests.

I'd be open to a proposal for this feature. It wouldn't be time-based, so that's a little interesting in terms of RL logic.

With this case in here, this would actually be to limit client/remote not to use up all limited connections to the unit, in this case 4.

So yeah would be very cool to get as a feature :)

mholt commented 2 years ago

Ok; feel free to contribute then! Or anyone else who would like this. (Or I could be commissioned via sponsorship. I do have a backlog for a few weeks right now though.)

wazerstar commented 2 years ago

Ok; feel free to contribute then! Or anyone else who would like this. (Or I could be commissioned via sponsorship. I do have a backlog for a few weeks right now though.)

Thanks what would commissioned typical be?

mholt commented 2 years ago

@wazerstar Good question, that kind of depends on the project scope and requirements. Right now my understanding is that you need to limit the number of connections to 4 per client, but you don't care about counting requests; limiting connections instead of requests will be a little trickier and probably cost more. (I still think limiting requests will be more useful btw.)

If you email me with your specific technical requirements, matt at dyanim dotcom, I can give you an estimate. Sponsorship tiers are here: https://github.com/sponsors/mholt - and you can see that some tiers offer discounts on development work!