Skip to main content

Crate openiwan

Crate openiwan 

Source
Expand description

Client and protocol support for iWAN-compatible networks.

The crate separates the byte-level protocol from system tunnel management. Applications that already own a TUN device can use Client and PacketDevice without invoking any platform commands.

§Main APIs

  • Client authenticates direct connections and creates a ConnectedSession.
  • PacketDevice exchanges IP packets without configuring a system TUN interface.
  • ClientConfig configures transport, encryption, reconnection, and Segment Routing.
  • protocol contains wire-level packet and TLV types.
  • managed contains controller authentication and connection discovery when the managed feature is enabled.

§Example

use openiwan::{Client, ClientConfig, EncryptionMethod, Result};

fn connect(password: String) -> Result<()> {
    let mut config = ClientConfig::new("vpn.example.com:443");
    config.encryption = EncryptionMethod::Aes;

    let client = Client::new(config, "alice", password)?;
    let session = client.authenticate()?;
    session.close()
}

§Cargo features

  • managed enables controller-managed APIs and the CLI’s profile and saved credential workflows.
  • forward enables the CLI’s TCP, HTTP, and HTTPS forwarding commands.

Both features are enabled by default. Disable them when an application needs only the core client, protocol, DNS, and TUN APIs.

Re-exports§

pub use client::Client;
pub use client::ConnectedSession;
pub use client::PacketDevice;
pub use client::SessionEnd;
pub use client::SessionInfo;
pub use config::ClientConfig;
pub use config::ReconnectPolicy;
pub use config::SegmentRoutingConfig;
pub use error::Error;
pub use error::Result;
pub use protocol::EncryptionMethod;
pub use protocol::PacketHeader;
pub use protocol::PacketType;
pub use protocol::Tlv;
pub use protocol::TlvType;
pub use sr::SrEncryptionAlgorithm;

Modules§

client
config
crypto
Cryptographic primitives used by the traditional iWAN data plane.
dns
DNS policy, packet enforcement, physical relay, platform configuration, and userspace name resolution.
error
fragment
Traditional and segment-routing iWAN fragment codecs.
managed
protocol
Byte-exact traditional iWAN framing.
sr
Segment Routing (SEGRT) transport.
tun