Skip to content

Commit cddce59

Browse files
committed
fix: logging consistency, Rust doc comments, test file headers, naming conventions
- Replace zap.L() global logger with explicit *zap.Logger parameter in buildHtpasswdFromConfig and CreateBackendTLSConfig - Add tracing imports and use bare macro form in forward.rs and wireguard.rs - Capitalize log messages in converter.go to match dominant pattern - Add //! module doc comments to proxy, sdwan, mesh, and l4 mod.rs - Add Apache 2.0 license headers to 10 test files - Rename _additional test files to _extended - Unexport ErrInvalidByteSize to errInvalidByteSize (internal-only sentinel)
1 parent 5e2012c commit cddce59

22 files changed

Lines changed: 206 additions & 37 deletions

File tree

dataplane/novaedge-dataplane/src/l4/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// L4 proxy modules provide advanced TCP/UDP proxying with connection limits,
2-
// session affinity, metrics, and PROXY protocol support. Currently the
3-
// listener manager uses inline copy_bidirectional for L4 gateways; these
4-
// modules will be integrated once per-gateway connection limits and byte
5-
// counters are wired through config.
1+
//! L4 proxy modules provide advanced TCP/UDP proxying with connection limits,
2+
//! session affinity, metrics, and PROXY protocol support. Currently the
3+
//! listener manager uses inline copy_bidirectional for L4 gateways; these
4+
//! modules will be integrated once per-gateway connection limits and byte
5+
//! counters are wired through config.
66
#[allow(dead_code)]
77
pub mod proxy_protocol;
88
#[allow(dead_code)]

dataplane/novaedge-dataplane/src/mesh/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Service mesh module.
2+
13
pub mod authz;
24
pub mod mtls;
35
pub mod spiffe;

dataplane/novaedge-dataplane/src/middleware/auth/forward.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::time::Duration;
88

99
use tokio::io::{AsyncReadExt, AsyncWriteExt};
1010
use tokio::net::TcpStream;
11+
use tracing::warn;
1112

1213
/// Forward auth configuration.
1314
#[allow(dead_code)] // Forward auth requires async network calls; handled separately from sync pipeline.
@@ -60,7 +61,7 @@ impl ForwardAuth {
6061
{
6162
// Reject header names/values containing CR or LF to prevent request smuggling.
6263
if contains_cr_lf(header_name) || contains_cr_lf(value) {
63-
tracing::warn!(
64+
warn!(
6465
header = %header_name,
6566
"Dropping header with CR/LF characters to prevent request smuggling"
6667
);
@@ -88,7 +89,7 @@ impl ForwardAuth {
8889
};
8990
for sock_addr in &resolved {
9091
if is_denied_ip(&sock_addr.ip()) {
91-
tracing::warn!(
92+
warn!(
9293
addr = %sock_addr,
9394
auth_url = %self.config.auth_url,
9495
"Forward auth URL resolves to denied internal IP — blocking SSRF"

dataplane/novaedge-dataplane/src/proxy/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Proxy module.
2+
13
pub mod handler;
24
pub mod http3;
35
pub mod response;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! SD-WAN module.
2+
13
pub mod link;
24
pub mod path_selection;
35
pub mod wireguard;

dataplane/novaedge-dataplane/src/sdwan/wireguard.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ use std::fmt;
22
use std::net::SocketAddr;
33
use std::time::Duration;
44

5+
use tracing::info;
6+
57
/// WireGuard peer configuration.
68
#[derive(Clone)]
79
pub struct WireGuardPeer {
@@ -73,14 +75,14 @@ impl WireGuardManager {
7375
}
7476

7577
pub fn add_tunnel(&mut self, config: WireGuardConfig) -> anyhow::Result<()> {
76-
tracing::info!(interface = %config.interface_name, "Adding WireGuard tunnel");
78+
info!(interface = %config.interface_name, "Adding WireGuard tunnel");
7779
self.tunnels.push(config);
7880
Ok(())
7981
}
8082

8183
pub fn remove_tunnel(&mut self, interface: &str) -> anyhow::Result<()> {
8284
self.tunnels.retain(|t| t.interface_name != interface);
83-
tracing::info!(interface = %interface, "Removed WireGuard tunnel");
85+
info!(interface = %interface, "Removed WireGuard tunnel");
8486
Ok(())
8587
}
8688

@@ -95,14 +97,14 @@ impl WireGuardManager {
9597
#[cfg(target_os = "linux")]
9698
pub fn apply(&mut self) -> anyhow::Result<()> {
9799
// On Linux: create WireGuard interface via netlink, configure peers
98-
tracing::info!("Applying WireGuard configuration (Linux)");
100+
info!("Applying WireGuard configuration (Linux)");
99101
self.active = true;
100102
Ok(())
101103
}
102104

103105
#[cfg(not(target_os = "linux"))]
104106
pub fn apply(&mut self) -> anyhow::Result<()> {
105-
tracing::info!("WireGuard apply: mock mode (non-Linux)");
107+
info!("WireGuard apply: mock mode (non-Linux)");
106108
self.active = true;
107109
Ok(())
108110
}

internal/acme/client_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2024 NovaEdge Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package acme
218

319
import (

internal/acme/selfsigned_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2024 NovaEdge Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package acme
218

319
import (

internal/agent/config/validation_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2024 NovaEdge Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package config
218

319
import (

internal/agent/config/watcher_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
Copyright 2024 NovaEdge Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
117
package config
218

319
import (

0 commit comments

Comments
 (0)