Documentation
¶
Overview ¶
Package capture formats packet logging into a debug pcap stream.
Index ¶
- type Sink
- func (s *Sink) CaptureCallback() packet.CaptureCallback
- func (s *Sink) Close() error
- func (s *Sink) LogPacket(path packet.CapturePath, when time.Time, data []byte, meta packet.CaptureMeta)
- func (s *Sink) NumOutputs() int
- func (s *Sink) RegisterOutput(w io.Writer) (unregister func())
- func (s *Sink) WaitCh() <-chan struct{}
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 ¶
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 ¶
NumOutputs returns the number of outputs registered with the sink.
func (*Sink) RegisterOutput ¶
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.