capture
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package capture formats packet logging into a debug pcap stream.
Index¶
Constants¶
This section is empty.
Variables¶
var DissectorLuastringFunctions¶
This section is empty.
Types¶
typeCallback¶
Callback describes a function which is called torecord packets when debugging packet-capture.Such callbacks must not take ownership of theprovided data slice: it may only copy out of itwithin the lifetime of the function.
typePath¶
type Pathuint8
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.FromLocalPath = 0// FromPeer indicates the packet was logged upon reception from a remote peer.FromPeerPath = 1// SynthesizedToLocal indicates the packet was generated from within tailscaled,// and is being routed to the local machine's network stack.SynthesizedToLocalPath = 2// SynthesizedToPeer indicates the packet was generated from within tailscaled,// and is being routed to a remote Wireguard peer.SynthesizedToPeerPath = 3// PathDisco indicates the packet is information about a disco frame.PathDiscoPath = 254)
Valid Path values.
typeSink¶
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 toall registered outputs.
func (*Sink)Close¶
Close shuts down the sink. Future calls to LogPacketare ignored, and any registered output that implementsio.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, whichwill be written to with a pcap stream as packets are logged.A function is returned which unregisters the output whencalled.
If w implements io.Closer, it will be closed upon erroror when the sink is closed. If w implements http.Flusher,it will be flushed periodically.