ddn.util.monaco.flow

Types 6

Bandwidth information for a network connection.

This struct provides bandwidth metrics for individual network connections, including bytes and packets per second over a sampling window.

Example:

auto bandwidth = connectionBandwidth(1.seconds);
foreach (conn; bandwidth) {
  writeln(conn.connection.localAddress, " -> ", conn.bytesPerSecond, " B/s");
}

Fields
NetConnection connection
ulong bytesPerSecond
ulong packetsPerSecond
Duration sampleWindow

Socket statistics from /proc/net/tcp (Linux).

This struct contains socket-level statistics including queue sizes and connection state information.

Fields
ulong rxQueue
ulong txQueue
ulong inode
ulong rxBytes
ulong txBytes
ulong rxPackets
ulong txPackets

Connection state snapshot for bandwidth tracking.

Stores a point-in-time snapshot of a connection's statistics for calculating bandwidth over time.

Fields
string connectionId
MonoTime timestamp
bool active

Historical bandwidth data for a connection.

Tracks bandwidth samples over time for analysis.

Fields
string connectionId
Duration trackingWindow

Network protocol types for connection classification.

This enum represents common application-layer protocols that can be detected through heuristic analysis of port numbers and connection patterns.

HTTPHTTP protocol (port 80)
HTTPSHTTPS protocol (port 443)
SSHSSH protocol (port 22)
FTPFTP protocol (port 21)
SMTPSMTP protocol (port 25)
DNSDNS protocol (port 53)
UNKNOWNUnknown or unclassified protocol

HTTP connection information.

This struct extends NetConnection with HTTP-specific details extracted from the connection state. Due to the stateless nature of monitoring, some fields may not be available for all connections.

Example:

auto httpConns = httpConnections();
foreach (conn; httpConns) {
  writeln(conn.host, " ", conn.method, " ", conn.statusCode);
}

Fields
string method
string host
ushort statusCode

Functions 8

private fnstring generateConnectionId(NetConnection conn) @safe pureGenerates a unique identifier for a connection.
private fnSocketStats[] readSocketStatsLinux(ulong inode = 0) @trustedReads socket statistics from /proc/net/tcp (Linux only).
fnConnectionBandwidth[] connectionBandwidth(Duration window = Duration.zero) @systemGets bandwidth information for all active network connections.
private fnConnectionStateSnapshot[] takeSnapshot(NetConnection[] connections) @safeTakes a snapshot of current connection states.
fnvoid resetConnectionTracking() @system nothrowResets the connection tracking state.
fnConnectionHistory[] getConnectionHistory(Duration window = Duration.zero) @systemGets historical bandwidth data for active connections.
fnProtocol detectProtocol(NetConnection conn) @safe pure nothrowDetects the application-layer protocol for a network connection.
fnHttpConnection[] httpConnections() @safeGets information about active HTTP connections.

Variables 3

varConnectionStateSnapshot[] previousSnapshots
varMonoTime lastSnapshotTime
varbool initialized