Skip to content

Architecture and Probe Development

Event and Output Pipeline ​

Relevant source files

The following files were used as context for generating this wiki page:

Purpose and Scope ​

This page provides a deep architectural and implementation-level trace of the core TLS event and output pipeline in eCapture. It covers the complete lifecycle of captured OpenSSL/BoringSSL, GoTLS, and GnuTLS events—starting from kernel-space eBPF ring buffer extraction, through user-space decoding (BaseEvent.Decode) pkg/event_processor/base_event.go:89-120, asynchronous dispatch via EventProcessor pkg/event_processor/processor.go:70-93, worker aggregation in eventWorker pkg/event_processor/iworker.go:69-88, handler processing (Text, Keylog, and Pcapng), raw transport routing via ByteSink docs/agent/output-pipeline.md:33-42, and additive publication to typed eCaptureQ channels docs/agent/output-pipeline.md:57-59.


1. Event Decoding and Asynchronous Dispatch ​

When eBPF probes capture TLS plaintext or master secrets, raw byte buffers are pushed from kernel space to user space via Perf/Ring buffers. The event processor pipeline transforms these raw byte arrays into structured domain events and routes them to appropriate worker routines.

Key Components & Data Structures ​

Sourcespkg/event_processor/base_event.go:76-120pkg/event_processor/processor.go:27-115pkg/event_processor/iworker.go:69-99pkg/event_processor/iparser.go:85-115

2. Representation Handlers and Routing ​

Once events are processed by workers, they are classified and routed to representation handlers depending on the active capture mode (Text, Keylog, or Pcapng).

Handler Mechanics ​

Sourcespkg/event_processor/base_event.go:134-167pkg/event_processor/iparser.go:117-162pkg/event_processor/http_request.go:28-45pkg/event_processor/http_response.go:28-37internal/probe/base/handlers/keylog_handler.go:37-106docs/agent/output-pipeline.md:33-55

3. ByteSink Destinations and Transport Routing ​

Raw transports are decoupled from format representation using the ByteSink interface docs/agent/output-pipeline.md:33-42. This allows text, keylog, and pcapng encoders to write seamlessly to various underlying targets via a unified factory docs/agent/output-pipeline.md:95-114.

ByteSink Contract ​

go
type ByteSink interface {
    io.Writer
    Name() string
    Flush() error
    Close() error
}

Source: docs/agent/output-pipeline.md:33-42

Supported Transport Destinations ​

Sourcesdocs/agent/output-pipeline.md:33-55internal/output/writers/pipeline_test.go:31-104

4. Additive eCaptureQ Publication ​

In addition to writing raw byte streams to primary ByteSink destinations, eCaptureQ operates as an additive, typed event publisher docs/agent/output-pipeline.md:57-65.

Separation of Concerns ​

  • Isolation: Captured payloads and sensitive TLS secrets are strictly partitioned from operational logs and never enter --logaddr or PROCESS_LOG channels docs/agent/output-pipeline.md:27-30.
  • Protocol: eCaptureQ messages are serialized as binary protobuf LogEntry structures containing metadata, timestamps, process information, and network tuples without reverse-parsing raw sink bytes docs/agent/output-pipeline.md:105-118.
Sourcesdocs/agent/output-pipeline.md:27-30docs/agent/output-pipeline.md:105-118
Event and Output Pipeline has loaded

Released under the MIT License.