Skip to content

Version exchange and logging #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Aug 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bda2bf9
versioning for gateway service
j-chmielewski Aug 7, 2025
d99b2a2
cargo fmt
j-chmielewski Aug 7, 2025
9ead0a2
use DefguardVersionClientLayer for version exchange with the server
j-chmielewski Aug 7, 2025
1194239
use defguard_version tracing
j-chmielewski Aug 7, 2025
e6be48b
DefguardVersionSet no longer behind RwLock
j-chmielewski Aug 8, 2025
d8f8772
implement span-based approach to version logging
j-chmielewski Aug 11, 2025
5d40ad5
fix DefguardVersionClientLayer constructor use
j-chmielewski Aug 11, 2025
b961a88
fix span variable names
j-chmielewski Aug 12, 2025
51e2863
simplify version header injection
j-chmielewski Aug 13, 2025
a535438
version_info_from_metadata
j-chmielewski Aug 14, 2025
f9f50cc
Merge branch 'release/1.5-alpha' into versions-merger
j-chmielewski Aug 18, 2025
fe2dd8d
use new version tracing initializator
j-chmielewski Aug 19, 2025
0574ee5
use defguard_version interceptor instead of manually setting the headers
j-chmielewski Aug 19, 2025
7e69b97
use the new tracing fields
j-chmielewski Aug 20, 2025
51faeea
add tracing instrumentation to keep all communication in the versioni…
j-chmielewski Aug 21, 2025
8b97a74
use DefguardComponent enum in span definitions
j-chmielewski Aug 21, 2025
9947b27
store strongly-typed core ComponentInfo
j-chmielewski Aug 21, 2025
912c57a
improve version typing
j-chmielewski Aug 21, 2025
9f7b843
use re-exported semver::Error
j-chmielewski Aug 21, 2025
c703c2c
review changes
j-chmielewski Aug 21, 2025
9a4f179
switch to git dependency for defguard_version
j-chmielewski Aug 22, 2025
5ae3773
fix long type for clippy
j-chmielewski Aug 22, 2025
d5a1608
add cargo-deny exception for defguard_version crate
j-chmielewski Aug 22, 2025
4257784
use map_or instead of map into unwrap_or
j-chmielewski Aug 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 176 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "1.5.0"
edition = "2021"

[dependencies]
defguard_version = { git = "https://github.com/DefGuard/defguard.git", rev = "f61ce40927a4d21095ea53a691219d5ae46e3e4e" }
axum = { version = "0.8", features = ["macros"] }
base64 = "0.22"
clap = { version = "4.5", features = ["derive", "env"] }
Expand All @@ -29,6 +30,7 @@ tonic = { version = "0.14", default-features = false, features = [
"tls-native-roots",
"tls-ring",
] }
tracing = "0.1"
tonic-prost = "0.14"

[target.'cfg(target_os = "linux")'.dependencies]
Expand Down
5 changes: 4 additions & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ allow = [
confidence-threshold = 0.8
# Allow 1 or more licenses on a per-crate basis, so that particular licenses
# aren't accepted for every possible crate as with the normal allow list
exceptions = [{ allow = ["AGPL-3.0-only"], crate = "defguard-gateway" }]
exceptions = [
{ allow = ["AGPL-3.0-only"], crate = "defguard-gateway" },
{ allow = ["AGPL-3.0-only"], crate = "defguard_version" }
]

# Some crates don't have (easily) machine readable licensing information,
# adding a clarification entry for it allows you to manually specify the
Expand Down
4 changes: 4 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ use crate::error::GatewayError;
#[clap(about = "Defguard VPN gateway service")]
#[command(version)]
pub struct Config {
#[arg(long, short = 'l', env = "DEFGUARD_LOG_LEVEL", default_value = "info")]
pub log_level: String,

/// Token received from Defguard after completing the network wizard
#[arg(
long,
Expand Down Expand Up @@ -113,6 +116,7 @@ pub struct Config {
impl Default for Config {
fn default() -> Self {
Self {
log_level: "info".to_string(),
token: "TOKEN".into(),
name: None,
grpc_url: "http://localhost:50051".into(),
Expand Down
7 changes: 7 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use defguard_version::{DefguardVersionError, SemverError};
use defguard_wireguard_rs::error::WireguardInterfaceError;
use thiserror::Error;

Expand Down Expand Up @@ -43,4 +44,10 @@ pub enum GatewayError {

#[error("Firewall error: {0}")]
FirewallError(#[from] FirewallError),

#[error(transparent)]
DefguardVersionError(#[from] DefguardVersionError),

#[error(transparent)]
SemverError(#[from] SemverError),
}
Loading