also anonymize data in header

This commit is contained in:
Robin Appelman 2026-10-26 13:08:00 +01:00
commit 74ed41a725
Signed by: robin
SSH key fingerprint: SHA256:kifqgrqnut7q1YUIrI0AdMNC23qiKAS/T9uGFmIYvbE
4 changed files with 42 additions and 10 deletions

View file

@ -3,6 +3,7 @@ use std::collections::HashMap;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering;
use crate::mutate::HeaderMutator;
use crate::mutate::MessageMutator;
use crate::mutate::MutatorList;
use crate::mutate::PacketMutator;
@ -139,7 +140,17 @@ impl MessageMutator for Anonymize {
}
}
#[derive(Default)]
pub struct AnonymizeHeader;
impl HeaderMutator for AnonymizeHeader {
fn mutate_header(&mut self, header: &mut tf_demo_parser::demo::header::Header) {
header.server = String::from("Redacted");
header.nick = String::from("Redacted");
}
}
pub fn anonymize(mutators: &mut MutatorList) {
let mutator = Anonymize::default();
mutators.push_packet_mutator(mutator);
mutators.push_packet_mutator(Anonymize::default());
mutators.push_header_mutator(AnonymizeHeader);
}