Documentation
¶
Overview ¶
Package audit keeps the connection log: which IP each peer connected from, over what transport, and when it connected and disconnected.
An abuse report or a child-safety referral (NCMEC) needs to tie a peer ID to an IP address at a time, and nothing else on the server remembers that once a connection closes. The Recorder watches the host's network and writes a row per connection to storage (peer_connections); rows older than audit.connection_log_days are purged hourly. Moderators read the log through the moderation protocol's connections operation; nobody else can.
Recording must never slow a connection down: libp2p calls a notifiee while it holds its own locks. The callbacks only queue an event on a buffered channel, which one goroutine writes to storage. When the queue is full the event is dropped, and a warning says how many went.
Index ¶
Constants ¶
const TransportCircuit = "p2p-circuit"
TransportCircuit is the transport recorded for a relayed connection.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder writes the connection log. A nil Recorder (the log is off) records nothing, and its methods do nothing.
func New ¶
New returns a recorder keeping days of log in store, or nil when days is zero or less: the log is off.