go‑Tracer Sensor is a high‑performance, stateful network agent written in Go. It monitors traffic, summarizes flows into compact JSON FlowEvent objects, and posts them to the Python Smart‑Trace Brain for AI analysis.
- Stateful flow analysis using an in‑memory
FlowCache(not a packet logger). - High performance via Go goroutines and channels; handles thousands of packets/sec.
- Produces lightweight JSON summaries (
FlowDuration,PacketCount,ByteCount) for ML/AI. - Enriches flows with
hostname,interface, anddirection(inbound/outbound/local). - Containerized with Docker for easy deployment.
-
Station 1 — capture (Collector)
- Uses
gopacket/pcapto sniff packets. - Emits raw packets to
packetChan.
- Uses
-
Station 2 — processor (Assembler / Brain)
- Maintains
FlowCacheto track conversations. - Consumes
packetChan, updates flow state, finalizes flows on FIN/RST or timeout. - Emits finalized
FlowEventtoeventChan. - Runs a
janitorgoroutine to evict timed‑out flows.
- Maintains
-
Station 3 — sender (Shipper)
- Consumes
eventChan. - Sends each
FlowEventas a JSONPOSTto the backend API.
- Consumes
network-go/
├── cmd/agent/main.go # Entry point — builds the factory
├── internal/
│ ├── capture/ # Station 1: packet capture
│ ├── processor/ # Station 2: stateful flow analysis
│ ├── sender/ # Station 3: JSON-over-HTTP sender
│ └── models/ # FlowEvent struct
├── pkg/
│ └── config/ # Env var configuration
├── go.mod
├── go.sum
├── Dockerfile
└── docker-compose.yml
This agent is designed to run in Docker.
-
Prerequisites
- Docker
- Docker Compose
- A reachable TracerAI backend (set via
AGENT_ENDPOINT_URL)
-
Configuration (via
docker-compose.ymlor env vars)AGENT_INTERFACE— network interface to monitor (e.g.,eth0)AGENT_ENDPOINT_URL— backend ingest URL (e.g.,http://127.0.0.1:8000/ingest)
-
Build & Run
- Find your interface:
ip addr
- Edit
docker-compose.yml:- Set
AGENT_INTERFACEto your interface. - Ensure
AGENT_ENDPOINT_URLpoints to the running backend.
- Set
- Build and start (sudo may be required for privileged network access):
sudo docker-compose up --build
- Find your interface:
That's it — the agent will capture traffic, produce FlowEvent JSON summaries, and POST them to the configured backend.