Skip to content

Commit 791b192

Browse files
Merge pull request #5 from maxmouchet/max/caracat-v1.3.0
Upgrade to caracat v1.3.0
2 parents 7d2d303 + dd1e70f commit 791b192

File tree

4 files changed

+217
-77
lines changed

4 files changed

+217
-77
lines changed

Cargo.lock

Lines changed: 3 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ edition = "2021"
55

66
[dependencies]
77
anyhow = "1.0.95"
8-
caracat = "1.2.0"
8+
caracat = "1.3.0"
99
chrono = "0.4.39"
1010
clap = { version = "4.5.20", features = ["derive"] }
1111
clap-verbosity-flag = "3.0.0"
1212
csv = "1.3.1"
1313
env_logger = "0.11.5"
14+
hyperloglog = "1.0.2"
1415
log = "0.4.22"
1516
pcap = "2.2.0"
1617
rdkafka = { version = "0.37.0" }

src/handler.rs

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,61 @@
11
use anyhow::Result;
2-
use caracat::high_level::Config;
32
use caracat::models::Probe;
3+
use caracat::rate_limiter::RateLimitingMethod;
44
use log::{info, warn};
55
use rdkafka::message::BorrowedMessage;
66
use rdkafka::message::{Headers, Message};
77
use std::net::IpAddr;
8+
use std::net::Ipv4Addr;
9+
use std::net::Ipv6Addr;
810
use std::time::Duration;
911
use tokio::task;
1012

1113
use crate::prober::probe;
1214

15+
/// Probing configuration.
16+
#[derive(Debug)]
17+
pub struct Config {
18+
/// Number of probes to send before calling the rate limiter.
19+
pub batch_size: u64,
20+
/// Identifier encoded in the probes (random by default).
21+
pub instance_id: u16,
22+
/// Whether to actually send the probes on the network or not.
23+
pub dry_run: bool,
24+
/// Do not send probes with ttl < min_ttl.
25+
pub min_ttl: Option<u8>,
26+
/// Do not send probes with ttl > max_ttl.
27+
pub max_ttl: Option<u8>,
28+
/// Check that replies match valid probes.
29+
pub integrity_check: bool,
30+
/// Interface from which to send the packets.
31+
pub interface: String,
32+
/// Source IPv4 address
33+
pub src_ipv4_addr: Option<Ipv4Addr>,
34+
/// Source IPv6 address
35+
pub src_ipv6_addr: Option<Ipv6Addr>,
36+
/// Maximum number of probes to send (unlimited by default).
37+
pub max_probes: Option<u64>,
38+
/// Number of packets to send per probe.
39+
pub packets: u64,
40+
/// Probing rate in packets per second.
41+
pub probing_rate: u64,
42+
/// Method to use to limit the packets rate.
43+
pub rate_limiting_method: RateLimitingMethod,
44+
/// Time in seconds to wait after sending the probes to stop the receiver.
45+
pub receiver_wait_time: Duration,
46+
}
47+
1348
fn create_config() -> Config {
1449
Config {
15-
allowed_prefixes_file: None,
16-
blocked_prefixes_file: None,
1750
batch_size: 128,
1851
dry_run: false,
19-
extra_string: None,
2052
min_ttl: None,
2153
max_ttl: None,
2254
integrity_check: true,
2355
instance_id: 0,
2456
interface: caracat::utilities::get_default_interface(),
57+
src_ipv4_addr: None,
58+
src_ipv6_addr: None,
2559
max_probes: None,
2660
packets: 1,
2761
probing_rate: 100,

0 commit comments

Comments
 (0)