From 6e435ae825003794bab90c9375f45ff09e28b2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Tue, 3 Nov 2026 09:47:06 +0100 Subject: [PATCH 1/4] ConnectionEvent --- enterprise/v2/monitor/monitor.proto | 35 +++++++++++++++++++++++++++++ v2/gateway.proto | 2 ++ 2 files changed, 37 insertions(+) create mode 100644 enterprise/v2/monitor/monitor.proto diff --git a/enterprise/v2/monitor/monitor.proto b/enterprise/v2/monitor/monitor.proto new file mode 100644 index 0000000..06a4e98 --- /dev/null +++ b/enterprise/v2/monitor/monitor.proto @@ -0,0 +1,35 @@ +syntax = "proto3"; +package defguard.enterprise.monitor.v2; + +import "google/protobuf/timestamp.proto"; + +enum Direction { + DIRECTION_INBOUND = 0; + DIRECTION_OUTBOUND = 1; +} + +enum Status { + STATUS_ALLOWED = 0; + STATUS_BLOCKED = 1; +} + +message ConnectionEvent { + google.protobuf.Timestamp timestamp = 1; + Direction direction = 2; + Status status = 3; + // IANA protocol number (e.g. 6 for TCP, 17 for UDP). + uint32 protocol = 4; + // Origin of the traffic. + bytes source_ip_addr = 5; + optional uint32 source_port = 6; + // Target of the traffic. + bytes destination_ip_addr = 7; + optional uint32 destination_port = 8; + // ID of the Defguard ACL rule that matched, or `None` if the default policy applied or the + // traffic is not subject to ACL rules. + optional int64 rule_id = 9; + // Bytes sent by the VPN device. + uint64 upload_bytes = 10; + // Bytes received by the VPN device. + uint64 download_bytes = 11; +} diff --git a/v2/gateway.proto b/v2/gateway.proto index 8b15750..4a3b900 100644 --- a/v2/gateway.proto +++ b/v2/gateway.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package defguard.gateway.v2; import "enterprise/v2/firewall/firewall.proto"; +import "enterprise/v2/monitor/monitor.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/timestamp.proto"; import "v2/common.proto"; @@ -76,6 +77,7 @@ message CoreRequest { oneof payload { PeerStats peer_stats = 2; google.protobuf.Empty config_request = 3; + defguard.enterprise.monitor.v2.ConnectionEvent connection_event = 4; } } From 6c13d6264e8dd620d10c14b2609fc096e097d672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Mon, 9 Nov 2026 09:58:20 +0100 Subject: [PATCH 2/4] Add count --- enterprise/v2/monitor/monitor.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/enterprise/v2/monitor/monitor.proto b/enterprise/v2/monitor/monitor.proto index 06a4e98..5f771f7 100644 --- a/enterprise/v2/monitor/monitor.proto +++ b/enterprise/v2/monitor/monitor.proto @@ -32,4 +32,6 @@ message ConnectionEvent { uint64 upload_bytes = 10; // Bytes received by the VPN device. uint64 download_bytes = 11; + // Number of packets of this kind (aggregation). + uint64 count = 12; } From e4fc0a217fc5e707bc70fcfcb810469b1d3509b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Tue, 10 Nov 2026 13:13:31 +0100 Subject: [PATCH 3/4] buf format --- enterprise/v2/monitor/monitor.proto | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/enterprise/v2/monitor/monitor.proto b/enterprise/v2/monitor/monitor.proto index 5f771f7..396fef2 100644 --- a/enterprise/v2/monitor/monitor.proto +++ b/enterprise/v2/monitor/monitor.proto @@ -4,34 +4,34 @@ package defguard.enterprise.monitor.v2; import "google/protobuf/timestamp.proto"; enum Direction { - DIRECTION_INBOUND = 0; - DIRECTION_OUTBOUND = 1; + DIRECTION_INBOUND = 0; + DIRECTION_OUTBOUND = 1; } enum Status { - STATUS_ALLOWED = 0; - STATUS_BLOCKED = 1; + STATUS_ALLOWED = 0; + STATUS_BLOCKED = 1; } message ConnectionEvent { - google.protobuf.Timestamp timestamp = 1; - Direction direction = 2; - Status status = 3; - // IANA protocol number (e.g. 6 for TCP, 17 for UDP). - uint32 protocol = 4; - // Origin of the traffic. - bytes source_ip_addr = 5; - optional uint32 source_port = 6; - // Target of the traffic. - bytes destination_ip_addr = 7; - optional uint32 destination_port = 8; - // ID of the Defguard ACL rule that matched, or `None` if the default policy applied or the - // traffic is not subject to ACL rules. - optional int64 rule_id = 9; - // Bytes sent by the VPN device. - uint64 upload_bytes = 10; - // Bytes received by the VPN device. - uint64 download_bytes = 11; - // Number of packets of this kind (aggregation). - uint64 count = 12; + google.protobuf.Timestamp timestamp = 1; + Direction direction = 2; + Status status = 3; + // IANA protocol number (e.g. 6 for TCP, 17 for UDP). + uint32 protocol = 4; + // Origin of the traffic. + bytes source_ip_addr = 5; + optional uint32 source_port = 6; + // Target of the traffic. + bytes destination_ip_addr = 7; + optional uint32 destination_port = 8; + // ID of the Defguard ACL rule that matched, or `None` if the default policy applied or the + // traffic is not subject to ACL rules. + optional int64 rule_id = 9; + // Bytes sent by the VPN device. + uint64 upload_bytes = 10; + // Bytes received by the VPN device. + uint64 download_bytes = 11; + // Number of packets of this kind (aggregation). + uint64 count = 12; } From c91abde3e7963b542e2dc99a94f23482f5b991a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Tue, 10 Nov 2026 14:10:21 +0100 Subject: [PATCH 4/4] Use UNSPECIFIED --- enterprise/v2/monitor/monitor.proto | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/enterprise/v2/monitor/monitor.proto b/enterprise/v2/monitor/monitor.proto index 396fef2..08f01f8 100644 --- a/enterprise/v2/monitor/monitor.proto +++ b/enterprise/v2/monitor/monitor.proto @@ -4,13 +4,15 @@ package defguard.enterprise.monitor.v2; import "google/protobuf/timestamp.proto"; enum Direction { - DIRECTION_INBOUND = 0; - DIRECTION_OUTBOUND = 1; + DIRECTION_UNSPECIFIED = 0; + DIRECTION_INBOUND = 1; + DIRECTION_OUTBOUND = 2; } enum Status { - STATUS_ALLOWED = 0; - STATUS_BLOCKED = 1; + STATUS_UNSPECIFIED = 0; + STATUS_ALLOWED = 1; + STATUS_BLOCKED = 2; } message ConnectionEvent {