Struct wintun::Adapter [−][src]
pub struct Adapter { /* fields omitted */ }
Expand description
Wrapper around a https://git.zx2c4.com/wintun/about/#wintun_adapter_handle
Implementations
pub fn create(
wintun: &Arc<wintun>,
pool: &str,
name: &str,
guid: Option<u128>
) -> Result<CreateData, WintunError>
pub fn create(
wintun: &Arc<wintun>,
pool: &str,
name: &str,
guid: Option<u128>
) -> Result<CreateData, WintunError>
Creates a new wintun adapter inside the pool pool
with name name
Optionally a GUID can be specified that will become the GUID of this adapter once created.
Adapters obtained via this function will be able to return their adapter index via
Adapter::get_adapter_index
Attempts to open an existing wintun interface inside pool
with name name
.
Adapters opened via this call will have an unknown GUID meaning Adapter::get_adapter_index
will always fail because knowing the adapter’s GUID is required to determine its index.
Currently a workaround is to delete and re-create a new adapter every time one is needed so
that it gets created with a known GUID, allowing Adapter::get_adapter_index
to works as
expected. There is likely a way to get the GUID of our adapter using the Windows Registry
or via the Win32 API, so PR’s that solve this issue are always welcome!
pub fn list_all(
wintun: &Arc<wintun>,
pool: &str
) -> Result<Vec<EnumeratedAdapter>, WintunError>
pub fn list_all(
wintun: &Arc<wintun>,
pool: &str
) -> Result<Vec<EnumeratedAdapter>, WintunError>
Returns a vector of the wintun adapters that exist in a particular pool
Delete an adapter, consuming it in the process
Returns Ok(reboot_suggested: bool)
on success
Initiates a new wintun session on the given adapter.
Capacity is the size in bytes of the ring buffer used internally by the driver. Must be
a power of two between crate::MIN_RING_CAPACITY
and crate::MIN_RING_CAPACITY
.
Returns the name of this adapter. Set by calls to Adapter::create
Returns the Win32 interface index of this adapter. Useful for specifying the interface
when executing netsh interface ip
commands
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Adapter
impl !UnwindSafe for Adapter