1. Overview
The VpnPage.hpp file is a GTKmm WireGuard page interface in BastionGuard.
Declares a three-tab VPN interface for connection control, configuration/key generation, kill-switch management, logging, asynchronous execution, and periodic state polling.
The documentation below is generated from the supplied source and covers its API surface, runtime responsibilities, data flow, filesystem or command interactions, concurrency model, and security considerations.
2. Source Inventory
- Original path:
vpn/VpnPage.hpp - Language: C++
- Source type:
.hpp - Line count: 127
- SHA-256:
99659f63e752c900592e721ac9c27f291db49d2d469dea045b80f62e92f6bae8
3. Dependencies
The file declares the following compile-time dependencies:
Project
LifetimeGuard.hppvpn/WireguardBackend.hpp
GTK/GLib
gtkmm.h
C/C++ Runtime
atomicfunctionalmemorystring
4. Types and Public Contract
The file declares or implements the following principal types:
- Class:
VpnPage - Class:
IpSlot - Enum:
IpSlot
Declared Public Members
VpnPage();~VpnPage() override;
5. API and Method Inventory
The file contains no out-of-line function implementation. Its behavior is supplied by declarations, inline functions, or associated implementation files.
6. Functional Architecture
Notebook Layout
- Connection tab: connect/disconnect, endpoint state, spinner, and public-IP comparison.
- Configuration tab: client key generation, server public key, endpoint, address, DNS, AllowedIPs, and
.confimport. - Kill-switch tab: a switch bound to backend nftables operations.
- A shared monospace log records all operations.
Asynchronous UI Model
- Runs backend work on detached worker threads.
- Returns results to GTK with
Glib::signal_idle().connect_once(). - Disables interactive controls while operations are active.
- Uses an alive flag to prevent callbacks from touching a destroyed page.
Connection Verification
- Captures the public IPv4 address before the tunnel.
- After connection, waits approximately 1.5 seconds before querying the tunneled address.
- Warns when the address does not change and points to AllowedIPs/NAT configuration.
7. Operational Flow
- Build the three-tab VPN interface and initialize the backend.
- Import a WireGuard file or populate the configuration form.
- Generate client keys when requested.
- Execute connect, disconnect, IP, or kill-switch work asynchronously.
- Return results to GTK, update labels/buttons, and append operation logs.
- Poll the backend periodically for current tunnel state.
8. Filesystem and External Command Surface
No hard-coded absolute filesystem path is declared directly in this file.
Commands or Security Primitives Referenced
ipshwg
9. Concurrency and Lifecycle
- Uses atomic state for cross-thread progress, lock state, or lifecycle coordination.
- Uses a lifetime guard so delayed callbacks do not access a destroyed widget.
10. Security Considerations
- Tunnel creation, route changes, DNS replacement, and nftables updates require elevated privileges.
- Private keys are held in memory and may be displayed in the configuration form.
- Imported WireGuard configuration must be treated as sensitive input.
- Failure paths must restore DNS, routes, and kill-switch state to avoid connectivity loss.
11. Implementation Considerations
- This header defines the public or private class contract; behavior is implemented by the matching
.cppfile unless marked inline.
12. Licensing and Branding
The source is distributed under the GNU General Public License version 3.
The source header identifies BastionGuard™ as a trademark and states that the name and branding are not licensed under the GPL.
The software is provided without warranty, including implied warranties of merchantability or fitness for a particular purpose.
