Documentation ¶
Overview ¶
Package capture formats packet logging into a debug pcap stream.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DissectorLua string
Functions ¶
This section is empty.
Types ¶
type Callback ¶
Callback describes a function which is called to record packets when debugging packet-capture. Such callbacks must not take ownership of the provided data slice: it may only copy out of it within the lifetime of the function.
type Path ¶
type Path uint8
Path describes where in the data path the packet was captured.
const ( // FromLocal indicates the packet was logged as it traversed the FromLocal path: // i.e.: A packet from the local system into the TUN. FromLocal Path = 0 // FromPeer indicates the packet was logged upon reception from a remote peer. FromPeer Path = 1 // SynthesizedToLocal indicates the packet was generated from within tailscaled, // and is being routed to the local machine's network stack. SynthesizedToLocal Path = 2 // SynthesizedToPeer indicates the packet was generated from within tailscaled, // and is being routed to a remote Wireguard peer. SynthesizedToPeer Path = 3 // PathDisco indicates the packet is information about a disco frame. PathDisco Path = 254 )
Valid Path values.
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) 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 ¶
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.