-
-
Notifications
You must be signed in to change notification settings - Fork 38
Support for fasthttp #29
Comments
Thanks for the feature request! Adding support for fasthttp is not on my immediate TODO list, but I like the idea. If the goal is increased performance, is ie. echo (which supports |
Using https://github.com/valyala/fasthttp/fasthttpadaptor should work. I am using it here: https://github.com/xyproto/algernon/blob/main/engine/serve.go I'll have to try using it together with permissions2 to see if any changes to permissions2 is needed. |
@xyproto The problem with adaptor is that it adds overhead. So if you are checking for |
Another thing, your examples folder is part of https://github.com/xyproto/permissions2/blob/main/v2/go.mod#L6 So even if i have a fasthttp server, my go.mod will end with gin, chi, martini, negroni, etc which are not needed for |
I see, I thought the overhead of fasthttpadaptor was minimal, but I have not benchmarked it yet. What would be the best way to support fasthttp? To add a middleware function, like lu does? https://github.com/vincentLiuxiang/lu Thanks for pointing out the issue with the |
I gave you full access to this repository, btw, in case you have a good plan for adding support for fasthttp and want to add it. I would have to look more into fasthttp first. |
@xyproto Yes, the best way is to have a native fasthttp middleware. Adaptor while great it has convert/adapt each net/http to a fasthttp ctx. An excellent examples for using adaptor: Prometheus Endpoint |
Will do, thanks 💪 |
btw, if fasthttp needs to be imported by permissions2 in order to support fasthttp, that would require all users of permission2 to also get fasthttp as a dependency, right? Is there a way to support fasthttp without having to import it in permissions2? |
@xyproto They have instructions here https://github.com/valyala/fasthttp?tab=readme-ov-file#switching-from-nethttp-to-fasthttp Would have to check what sections of net/http Yes, it would require importing it. I have to think if there's a way around that by creating an interface. |
In worst case, perhaps a separate permissions package for supporting fasthttp would be needed. |
I will do a PR tonight to update the CI process first. Will look imto fasthttp after that. 💪 |
Hello, are there any plans to add support for fasthttp? https://github.com/valyala/fasthttp
https://github.com/valyala/fasthttp#switching-from-nethttp-to-fasthttp
Thanks!
The text was updated successfully, but these errors were encountered: