capture

package
v1.86.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2025 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Overview

Package capture formats packet logging into a debug pcap stream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sink

type Sink struct {
	// contains filtered or unexported fields
}

Type Sink handles callbacks with packets to be logged, formatting them into a pcap stream which is mirrored to all registered outputs.

func (*Sink) CaptureCallback

func (s *Sink) CaptureCallback() packet.CaptureCallback

func (*Sink) Close

func (s *Sink) Close() error

Close shuts down the sink. Future calls to LogPacket are ignored, and any registered output that implements io.Closer is closed.

func (*Sink) LogPacket

func (s *Sink) LogPacket(path packet.CapturePath, when time.Time, data []byte, meta packet.CaptureMeta)

LogPacket is called to insert a packet into the capture.

This function does not take ownership of the provided data slice.

func (*Sink) NumOutputs

func (s *Sink) NumOutputs() int

NumOutputs returns the number of outputs registered with the sink.

func (*Sink) RegisterOutput

func (s *Sink) RegisterOutput(w io.Writer) (unregister func())

RegisterOutput connects an output to this sink, which will be written to with a pcap stream as packets are logged. A function is returned which unregisters the output when called.

If w implements io.Closer, it will be closed upon error or when the sink is closed. If w implements http.Flusher, it will be flushed periodically.

func (*Sink) WaitCh

func (s *Sink) WaitCh() <-chan struct{}

WaitCh returns a channel which blocks until the sink is closed.

Directories

Path Synopsis
Package dissector contains the Lua dissector for Tailscale packets.
Package dissector contains the Lua dissector for Tailscale packets.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL