Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy using splice #120

Open
da-tai opened this issue Jul 28, 2020 · 3 comments
Open

Proxy using splice #120

da-tai opened this issue Jul 28, 2020 · 3 comments
Assignees
Labels
help wanted Extra attention is needed long term It's going to be a long-term work pending development Requested PR owner to improve code and waiting for the result question Further information is requested waiting for response waiting for the response from commenter
Milestone

Comments

@da-tai
Copy link

da-tai commented Jul 28, 2020

Using net package, you can make a proxy using splice with io.Copy. Is that possible with gnet , or is there a faster way to doit with gnet?

go io.Copy(remote, conn)
io.Copy(conn, cs.remote)

https://man7.org/linux/man-pages/man2/splice.2.html

@da-tai da-tai added help wanted Extra attention is needed question Further information is requested labels Jul 28, 2020
@panjf2000
Copy link
Owner

It is not currently supported in gnet yet.

@da-tai
Copy link
Author

da-tai commented Aug 5, 2020

It is not currently supported in gnet yet.

Any plans to do it soon or any other way to utilize something similar with gnet in the meantime.

@panjf2000 panjf2000 added the waiting for response waiting for the response from commenter label Aug 5, 2020
@panjf2000
Copy link
Owner

panjf2000 commented Aug 5, 2020

It is not currently supported in gnet yet.

Any plans to do it soon or any other way to utilize something similar with gnet in the meantime.

This would be a long-term plan if I decide to do it because the current API design of gnet is not quite compatible with the splice syscall, you see, gnet doesn't expose any file descriptor to users, which makes it hard to support splice.

I may add a new proxy feature to gnet in the future only for some scenarios like yours: building a proxy server on top of gnet.

As for the alternative, I'm afraid there is no such kind of thing in gnet for now.

@panjf2000 panjf2000 added long term It's going to be a long-term work pending development Requested PR owner to improve code and waiting for the result labels Aug 5, 2020
@panjf2000 panjf2000 added this to the v2 milestone Oct 7, 2021
@panjf2000 panjf2000 modified the milestones: v2, Long term Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed long term It's going to be a long-term work pending development Requested PR owner to improve code and waiting for the result question Further information is requested waiting for response waiting for the response from commenter
Projects
None yet
Development

No branches or pull requests

2 participants