Skip to content

Commit b04c114

Browse files
authored
Merge pull request #16 from NullNet-ai/switch-transmissions
Add fields to allow switching packets & resources transmissions on/off at the client
2 parents d108bf4 + 6a1365f commit b04c114

File tree

8 files changed

+37
-3
lines changed

8 files changed

+37
-3
lines changed

libwallguard/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "nullnet-libwallguard"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
edition = "2024"
55
authors = ["Giuliano Bellini <[email protected]>", "Anton Liashkevich <[email protected]>"]
66
description = "A centralized management system for network firewalls"

libwallguard/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ impl WallGuardGrpcInterface {
9494
}
9595

9696
#[allow(clippy::missing_errors_doc)]
97-
pub async fn handle_system_resources(&mut self, message: SystemResources) -> Result<CommonResponse, String> {
97+
pub async fn handle_system_resources(
98+
&mut self,
99+
message: SystemResources,
100+
) -> Result<CommonResponse, String> {
98101
self.client
99102
.handle_system_resources(Request::new(message))
100103
.await

libwallguard/src/proto/wallguard.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ pub struct HeartbeatResponse {
2222
pub remote_ui_enabled: bool,
2323
#[prost(bool, tag = "5")]
2424
pub remote_ssh_enabled: bool,
25+
/// rename this to is_config_monitoring_enabled ???
2526
#[prost(bool, tag = "6")]
2627
pub is_monitoring_enabled: bool,
28+
#[prost(bool, tag = "7")]
29+
pub is_packet_capture_enabled: bool,
30+
#[prost(bool, tag = "8")]
31+
pub is_resource_monitoring_enabled: bool,
2732
}
2833
#[derive(Clone, PartialEq, ::prost::Message)]
2934
pub struct CommonResponse {

proto/wallguard.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ message HeartbeatResponse {
3232
bool remote_shell_enabled = 3;
3333
bool remote_ui_enabled = 4;
3434
bool remote_ssh_enabled = 5;
35+
// rename this to is_config_monitoring_enabled ???
3536
bool is_monitoring_enabled = 6;
37+
bool is_packet_capture_enabled = 7;
38+
bool is_resource_monitoring_enabled = 8;
3639
}
3740

3841
message CommonResponse {

src/client_stream/auth_stream.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ async fn stream_impl(
7777
remote_ui_enabled,
7878
remote_ssh_enabled,
7979
is_monitoring_enabled: response.is_monitoring_enabled,
80+
is_packet_capture_enabled: response.is_packet_capture_enabled,
81+
is_resource_monitoring_enabled: response.is_resource_monitoring_enabled,
8082
};
8183

8284
if tx.send(Ok(response)).await.is_err() {

src/datastore/features/heartbeat/latest_device_info.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use nullnet_liberror::{Error, ErrorHandler, Location, location};
55
pub struct LatestDeviceInfo {
66
pub status: DeviceStatus,
77
pub is_monitoring_enabled: bool,
8+
pub is_packet_capture_enabled: bool,
9+
pub is_resource_monitoring_enabled: bool,
810
}
911

1012
impl LatestDeviceInfo {
@@ -28,6 +30,18 @@ impl LatestDeviceInfo {
2830
.ok_or("Could not parse 'is_monitoring_enabled'")
2931
.handle_err(location!())?;
3032

33+
let is_packet_capture_enabled = object
34+
.get("is_packet_capture_enabled")
35+
.and_then(serde_json::Value::as_bool)
36+
.ok_or("Could not parse 'is_packet_capture_enabled'")
37+
.handle_err(location!())?;
38+
39+
let is_resource_monitoring_enabled = object
40+
.get("is_resource_monitoring_enabled")
41+
.and_then(serde_json::Value::as_bool)
42+
.ok_or("Could not parse 'is_resource_monitoring_enabled'")
43+
.handle_err(location!())?;
44+
3145
let status = object
3246
.get("status")
3347
.and_then(|v| v.as_str())
@@ -38,6 +52,8 @@ impl LatestDeviceInfo {
3852
Ok(Self {
3953
status: map_status_value_to_enum(&status),
4054
is_monitoring_enabled,
55+
is_packet_capture_enabled,
56+
is_resource_monitoring_enabled,
4157
})
4258
}
4359
}

src/datastore/features/heartbeat/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl DatastoreWrapper {
6565
table: String::from("devices"),
6666
}),
6767
query: Some(Query {
68-
pluck: String::from("status,is_monitoring_enabled,is_remote_access_enabled"),
68+
pluck: String::from("status,is_monitoring_enabled,is_remote_access_enabled,is_packet_capture_enabled,is_resource_monitoring_enabled"),
6969
durability: String::from("soft"),
7070
}),
7171
};

src/proto/wallguard.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@ pub struct HeartbeatResponse {
2222
pub remote_ui_enabled: bool,
2323
#[prost(bool, tag = "5")]
2424
pub remote_ssh_enabled: bool,
25+
/// rename this to is_config_monitoring_enabled ???
2526
#[prost(bool, tag = "6")]
2627
pub is_monitoring_enabled: bool,
28+
#[prost(bool, tag = "7")]
29+
pub is_packet_capture_enabled: bool,
30+
#[prost(bool, tag = "8")]
31+
pub is_resource_monitoring_enabled: bool,
2732
}
2833
#[derive(Clone, PartialEq, ::prost::Message)]
2934
pub struct CommonResponse {

0 commit comments

Comments
 (0)