Movatterモバイル変換


[0]ホーム

URL:


capture

package
v1.78.3Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License:BSD-3-ClauseImports:10Imported by:0

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package capture formats packet logging into a debug pcap stream.

Index

Constants

This section is empty.

Variables

View Source
var DissectorLuastring

Functions

This section is empty.

Types

typeCallback

type Callback func(Path,time.Time, []byte,packet.CaptureMeta)

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.

funcNew

func New() *Sink

New creates a new capture sink.

func (*Sink)Close

func (s *Sink) Close()error

Close shuts down the sink. Future calls to LogPacketare ignored, and any registered output that implementsio.Closer is closed.

func (*Sink)LogPacket

func (s *Sink) LogPacket(pathPath, whentime.Time, data []byte, metapacket.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(wio.Writer) (unregister func())

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.

func (*Sink)WaitCh

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

WaitCh returns a channel which blocks untilthe sink is closed.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp