xxoo/tun-rs-uring — reverse-engineered prompt
Reverse engineered prompt
Build me a Linux only Rust crate that makes it easy for another program to create and use a TUN/TAP network device asynchronously with io_uring. I want the public API to feel small and simple, centered around one main UringDevice type.
It should let users receive packets, send one packet, and send a batch of packets with send_many(). For batch sending, include an option to keep packet order within that batch. Support choosing one async backend at build time, either tokio or async io, and make it a compile error if both are enabled together.
Please include clear examples for receiving, sending a small batch, and running a simple throughput smoke test. If the machine can’t create a TUN device because of permissions, the examples and tests should explain that clearly instead of crashing with a confusing OS error.
Add practical tests for lifecycle, cleanup, timeouts, batch behavior, and basic reliability. Look up current Rust and io_uring docs online if you need to.
Want more depth? Deep Reverse