1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//! Connection builders for different network types.
//!
//! This module provides two complementary APIs for constructing NetworkManager
//! settings dictionaries:
//!
//! - **Fluent builder types** that support method chaining and perform
//! validation when `.build()` is called.
//! - **Free `build_*` functions** that take already-prepared structs and
//! produce the same settings map directly.
//!
//! # Fluent builders
//!
//! - [`ConnectionBuilder`] — generic, low-level builder used as the foundation
//! for all other builders. Supports IPv4/IPv6 method, manual addresses,
//! routes, DNS, autoconnect, MTU, and more. See [`IpConfig`] / [`Route`].
//! - [`WifiConnectionBuilder`] — Wi-Fi (open / WPA-PSK / WPA-EAP), with band,
//! channel, hidden SSID, BSSID pinning, and AP-mode shortcuts. See
//! [`WifiBand`] / [`WifiMode`].
//! - [`WireGuardBuilder`] — kernel-level WireGuard tunnels.
//! - [`OpenVpnBuilder`] — NM-plugin OpenVPN connections, with
//! [`from_ovpn_file`](OpenVpnBuilder::from_ovpn_file) for `.ovpn` import.
//!
//! # Free functions
//!
//! - [`build_wifi_connection`] / [`build_ethernet_connection`] (in [`wifi`])
//! - [`build_wireguard_connection`] / [`build_openvpn_connection`] (in [`vpn`])
//! - [`build_bluetooth_connection`] (in [`bluetooth`])
//! - [`build_vlan_connection`] (in [`vlan`])
//!
//! # When to use these
//!
//! Most users should use the high-level
//! [`NetworkManager`](crate::NetworkManager) API instead of calling these
//! builders directly. They are exposed for advanced use cases where you
//! need fine-grained control over the raw settings dictionary before
//! handing it to NetworkManager's `AddConnection` or
//! `AddAndActivateConnection` D-Bus methods.
//!
//! # Examples
//!
//! ## Wi-Fi (free function)
//!
//! ```rust
//! use nmrs::builders::{build_ethernet_connection, build_wifi_connection};
//! use nmrs::{ConnectionOptions, WifiSecurity};
//!
//! let opts = ConnectionOptions::new(true).with_priority(10);
//!
//! let wifi = build_wifi_connection(
//! "MyNetwork",
//! &WifiSecurity::WpaPsk { psk: "password".into() },
//! &opts,
//! );
//! let eth = build_ethernet_connection("eth0", &opts);
//! ```
//!
//! ## WireGuard (fluent builder)
//!
//! ```rust
//! use nmrs::builders::WireGuardBuilder;
//! use nmrs::WireGuardPeer;
//!
//! let peer = WireGuardPeer::new(
//! "HIgo9xNzJMWLKAShlKl6/bUT1VI9Q0SDBXGtLXkPFXc=",
//! "vpn.example.com:51820",
//! vec!["0.0.0.0/0".into()],
//! ).with_persistent_keepalive(25);
//!
//! let settings = WireGuardBuilder::new("MyVPN")
//! .private_key("YBk6X3pP8KjKz7+HFWzVHNqL3qTZq8hX9VxFQJ4zVmM=")
//! .address("10.0.0.2/24")
//! .add_peer(peer)
//! .dns(vec!["1.1.1.1".into()])
//! .build()
//! .expect("WireGuardBuilder is fully configured");
//! ```
//!
//! The returned settings can then be passed to NetworkManager's
//! `AddConnection` or `AddAndActivateConnection` D-Bus methods.
// Re-export core builder types
pub use ;
pub use OpenVpnBuilder;
pub use ;
pub use WireGuardBuilder;
// Re-export builder functions for convenience
pub use build_bluetooth_connection;
pub use build_vlan_connection;
pub use ;
pub use ;