Answer the question
In order to leave comments, you need to log in
How to limit the speed of uploading content in fasthttp?
Actually, the question is how to set a limit on the data transfer rate to the client without resorting to a third-party server such as nginx, etc. By means of fasthttp. There is a relatively complicated way with stream interception, but there may be some simple way. The task seems to be trivial. )
Answer the question
In order to leave comments, you need to log in
I had a similar task, only it was necessary to limit both the incoming and outgoing speed.
Unfortunately, the only working option is to limit the speed of writing / reading data.
I would recommend https://github.com/juju/ratelimit as I myself use this library in production. I tried a lot of different ones, but many had a problem with the write speed limit, except for juju / ratelimit.
With it, you can configure both the total speed limit for up / down, and separate.
You can somewhere in the middleware:
https://github.com/golang/go/wiki/RateLimiting
https://github.com/throttled/throttled
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question