mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-25 13:36:50 +00:00
refactor(tls): centralize runtime foundation (#3065)
* refactor(targets): move notify net helpers from utils * refactor(tls): centralize runtime foundation * refactor(targets): move notify net helpers from utils * refactor(tls): centralize runtime foundation * feat(tls-runtime): add TLS debug state and admin handler * refactor(tls-runtime): unify TLS debug consumer status view * fix(tls): address PR3065 review feedback * refactor(tls): align debug status payload types * refactor(targets): harden TLS hot reload paths * fix(targets): resolve review-4348251652 findings * fix(targets): finalize tls runtime review follow-ups * fix(targets): harden tls reload and review follow-ups * fix(targets): align tls reload handling across targets * fix(targets): finalize tls reload state and metrics updates * chore(deps): trim unused TLS deps * style(targets): normalize TLS reload formatting * refactor(targets): introduce tls runtime adapter path * chore: update workspace manifests for tls refactor * fix(tls): stabilize material reload and audit workflow * fix(targets): refresh tls fingerprint flow across sinks * fix(tls): align runtime coordinator and http reader updates * fix(sftp): simplify protocol error mapping * fix(tls): harmonize material loading behavior * fix(server): finalize tls material wiring in startup flow * fix(protos): tighten tls generation cache and deps
This commit is contained in:
@@ -37,6 +37,13 @@ pub mod pulsar;
|
||||
pub mod redis;
|
||||
pub mod webhook;
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) use crate::runtime::tls::fingerprint::TargetTlsFingerprint as TargetTlsFingerprintState;
|
||||
#[cfg(test)]
|
||||
pub(crate) use crate::runtime::tls::fingerprint::TargetTlsGeneration;
|
||||
pub(crate) use crate::runtime::tls::fingerprint::TargetTlsState;
|
||||
pub(crate) use crate::runtime::tls::fingerprint::build_target_tls_fingerprint;
|
||||
|
||||
/// A read-only snapshot of delivery counters for a target.
|
||||
#[derive(Debug, Clone, Default, PartialEq, Eq)]
|
||||
pub struct TargetDeliverySnapshot {
|
||||
@@ -531,6 +538,48 @@ pub(crate) fn ensure_rustls_provider_installed() {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tls_state_tests {
|
||||
use super::{TargetTlsFingerprintState, TargetTlsGeneration, TargetTlsState};
|
||||
|
||||
#[test]
|
||||
fn refresh_increments_generation_only_when_fingerprint_changes() {
|
||||
let mut state = TargetTlsState::default();
|
||||
let first = TargetTlsFingerprintState {
|
||||
ca_sha256: Some([1; 32]),
|
||||
client_cert_sha256: None,
|
||||
client_key_sha256: None,
|
||||
};
|
||||
let second = TargetTlsFingerprintState {
|
||||
ca_sha256: Some([2; 32]),
|
||||
client_cert_sha256: None,
|
||||
client_key_sha256: None,
|
||||
};
|
||||
|
||||
assert!(state.refresh(first.clone()));
|
||||
assert_eq!(state.generation, TargetTlsGeneration(1));
|
||||
assert!(!state.refresh(first));
|
||||
assert_eq!(state.generation, TargetTlsGeneration(1));
|
||||
assert!(state.refresh(second));
|
||||
assert_eq!(state.generation, TargetTlsGeneration(2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reset_clears_generation_and_fingerprint() {
|
||||
let mut state = TargetTlsState {
|
||||
generation: TargetTlsGeneration(5),
|
||||
fingerprint: Some(TargetTlsFingerprintState {
|
||||
ca_sha256: Some([9; 32]),
|
||||
client_cert_sha256: None,
|
||||
client_key_sha256: None,
|
||||
}),
|
||||
};
|
||||
|
||||
state.reset();
|
||||
assert_eq!(state, TargetTlsState::default());
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user