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

Add support to construct TunPacket from Bytes directly. #81

Closed
yiransheng opened this issue Dec 25, 2023 · 1 comment
Closed

Add support to construct TunPacket from Bytes directly. #81

yiransheng opened this issue Dec 25, 2023 · 1 comment

Comments

@yiransheng
Copy link

Code pointer:
https://github.com/meh/rust-tun/blob/e762c419d71438e67379f9b2fed89b5cb835cc6a/src/async/codec.rs#L77C1-L80C2

TunPacket already stores the packet internally using bytes::Bytes, but it can only be constructed from a Vec via TunPacket::new. It would be nice to have a way (either a method of a From trait impl) to construct a TunPacket from Bytes directly, without going through the extra cloning in Bytes -> Vec -> Bytes.

@xmh0511
Copy link
Contributor

xmh0511 commented Jan 17, 2024

Fixed by ssrlive#5, you can switch to tun2, which is actively maintaining.

@ssrlive ssrlive closed this as completed Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants