Skip to main content

Module connection

Module connection 

Source
Expand description

Connection records.

This is a connection-level subscription that provides TCP and/or UDP connection information, statistics, and state history. It does not deliver payload data.

§Example

Logs TCP/22 and TCP/23 connection records to a file:

#[filter("tcp.port = 80 or tcp.port = 443")]
fn main() {
    let config = default_config();
    let file = Mutex::new(File::create("conn.jsonl").unwrap());
    let cb = |conn: Connection| {
        let mut wtr = file.lock().unwrap();
        jsonl::write(&mut *wtr, &conn).unwrap();
    };
    let mut runtime = Runtime::new(config, filter, cb).unwrap();
    runtime.run();
}

Structs§

Chunk
Start (inclusive) and end (exclusive) interval of contiguous TCP payload bytes.
Connection
A connection record.
Flow
A uni-directional flow.