#vpn #packets #tracing #trace #ts #target #macro

ya-packet-trace

Utility library for tracking VPN packets in yagna

1 unstable release

0.1.0 May 23, 2023

#23 in #ts

Download history 416/week @ 2024-07-27 444/week @ 2024-08-03 250/week @ 2024-08-10 215/week @ 2024-08-17 174/week @ 2024-08-24 285/week @ 2024-08-31 335/week @ 2024-09-07 523/week @ 2024-09-14 274/week @ 2024-09-21 338/week @ 2024-09-28 128/week @ 2024-10-05 135/week @ 2024-10-12 83/week @ 2024-10-19 70/week @ 2024-10-26 67/week @ 2024-11-02 49/week @ 2024-11-09

286 downloads per month
Used in 4 crates (2 directly)

GPL-3.0 license

22KB
221 lines

ya-packet-trace

Utility for tracing VPN packets

Usage

At any interesting point in the flow of VPN packets, invoke the macro like so:

packet_trace!(
    "possibly-slow-subsystem-before",
    {
        // code returning AsRef<[u8]> corresponding to the packet payload
    }
);

packet_trace_maybe!(
    "whatever",
    {
        // code returning Option<AsRef<[u8]>> corresponding to the packet payload
    }
);

Then, if the ya-packet-trace is compiled with the enabled feature, a log like possibly-slow-subsystem-before,<HASH>,<TS> will be printed at TRACE level to target packet-trace.

  • <HASH> is 16-character, 0-padded hex-digest of FxHash output
  • <TS> is current datetime as formatted by chrono with the following format string: %Y-%m-%dT%H:%M:%S%.6f%z.

Dependencies

~1.5MB
~22K SLoC