[][src]Module boringtun::ffi

Modules

benchmark

C bindings for the BoringTun library

Structs

stats
wireguard_result

The return type of WireGuard functions

x25519_key

Enums

result_type

Indicates the operation required from the caller

Functions

benchmark

Performs an iternal benchmark, and returns its result as a C-string.

check_base64_encoded_x25519_key

Check if the input C-string represents a valid base64 encoded x25519 key. Return 1 if valid 0 otherwise.

new_tunnel

Allocate a new tunnel, return NULL on failure. Keys must be valid base64 encoded 32-byte keys.

tunnel_free

Drops the Tunn object

wireguard_force_handshake

Force the tunnel to initiate a new handshake, dst buffer must be at least 148 byte long.

wireguard_read

Read a UDP packet from the server. For more details check noise::network_to_tunnel functions.

wireguard_stats

Returns stats from the tunnel: Time of last handshake in seconds (or -1 if no handshake occured) Number of data bytes encapsulated Number of data bytes decapsulated

wireguard_tick

This is a state keeping function, that need to be called preriodically. Recommended interval: 100ms.

wireguard_write

Write an IP packet from the tunnel interface. For more details check noise::tunnel_to_network functions.

x25519_secret_key

Generates a new x25519 secret key.

x25519_public_key

Computes a public x25519 key from a secret key.

x25519_key_to_hex

Returns the hex encoding of a key as a UTF8 C-string.

x25519_key_to_str_free

Frees memory of the string given by x25519_key_to_hex or x25519_key_to_base64

x25519_key_to_base64

Returns the base64 encoding of a key as a UTF8 C-string.