-
Notifications
You must be signed in to change notification settings - Fork 1
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
Issues related to API implementation #25
Comments
Hey, thanks for taking interest in this project! Are there any particular features you're looking to contribute or see implemented? If you don't have a specific focus in mind and are just interested in helping out in some way, I've added a list of features that would be good to add to this crate in the near future. As for API design, I'm not sure that changing this crate to mirror the API of |
Using stream may be inconvenient. recv/send is easier to use |
I was actually referring to the |
Is recv and send with immutable references feasible |
Not if Windows is to be supported, unfortunately. *nix systems use file descriptors, so they could all be implemented using an immutable reference, but the wintun API requires a mutable reference to a WintunSession when allocating a packet that will subsequently be sent over the tunnel: fn WintunAllocateSendPacket(session: *mut WintunSession, packet_size: u32) -> *mut u8; This means that any cross-platform fn WintunReceivePacket(session: *mut WintunSession, packet_size: *mut u32) -> *mut u8; Again, passing a mutable pointer when using an immutable reference to |
I'm curious--is there some key benefit within |
Wintun session is thread-safe, would there be any issues with converting it to an immutable reference? |
The main requirement is to implement concurrent read and write operations. Since 'tappers' does not implement 'split', I'm not sure how to achieve read-write separation. |
I went ahead and converted it to an immutable reference based on Wintun being thread-safe; this should hopefully make concurrent read/write easier |
I've now implemented |
Line 46 in a501303
Converting a Wintun handle into a Socket will fail. I tested the library async-io = "2.3.4". Using Waitable::new(tun.read_handle()) from async-io allows for asynchronous listening to readable events. However, it’s extremely unstable, and I'm not sure why. |
Line 81 in a501303
async-io supports using RawHandle |
Using |
I was worried about that--some of the workarounds I used to make Wait, so does using |
It looks like |
Yes, converting to Socket, Async, or NamedPipe all results in errors. Using Waitable can capture read events, but it’s unstable. |
It looks like async backends use a global threadpool (albeit managed by Win32) to wait on events anyways--this is what the async-io
Given this, and that |
Using a sub-thread works better. The internal implementation of async-io is also based on sub-threads. |
Alright, I've re-implemented it so that a blocking sub-thread is used instead of waiting on a |
How can I contribute code. Is it possible to implement an API similar to 'https://crates.io/crates/tun-rs'?
The text was updated successfully, but these errors were encountered: