Movatterモバイル変換


[0]ホーム

URL:


netlog

package
v1.92.2Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License:BSD-3-ClauseImports:31Imported by:3

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package netlog provides a logger that monitors a TUN device andperiodically records any traffic into a log stream.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeDevice

type Device interface {SetConnectionCounter(netlogfunc.ConnectionCounter)}

Device is an abstraction over a tunnel device or a magic socket.Both *tstun.Wrapper and *magicsock.Conn implement this interface.

typeLogger

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

Logger logs statistics about every connection.At present, it only logs connections within a tailscale network.By default, exit node traffic is not logged for privacy reasonsunless the Tailnet administrator opts-into explicit logging.The zero value is ready for use.

func (*Logger)ReconfigNetworkMapadded inv1.92.0

func (nl *Logger) ReconfigNetworkMap(nm *netmap.NetworkMap)

ReconfigNetworkMap configures the network logger with an updated netmap.

func (*Logger)ReconfigRoutes

func (nl *Logger) ReconfigRoutes(cfg *router.Config)

ReconfigRoutes configures the network logger with updated routes.The cfg is used to classify the types of connections captured bythe tun Device passed to Startup.

func (*Logger)Running

func (nl *Logger) Running()bool

Running reports whether the logger is running.

func (*Logger)Shutdown

func (nl *Logger) Shutdown(ctxcontext.Context)error

Shutdown shuts down the network logger.This attempts to flush out all pending log messages.Even if an error is returned, the logger is still shut down.

func (*Logger)Startup

func (nl *Logger) Startup(logflogger.Logf, nm *netmap.NetworkMap, nodeLogID, domainLogIDlogid.PrivateID, tun, sockDevice, netMon *netmon.Monitor, health *health.Tracker, bus *eventbus.Bus, logExitFlowEnabledEnabledbool)error

Startup starts an asynchronous network logger that monitorsstatistics for the provided tun and/or sock device.

The tunDevice captures packets within the tailscale network,where at least one address is usually a tailscale IP address.The source is usually from the perspective of the current node.If one of the other endpoint is not a tailscale IP address,then it suggests the use of a subnet router or exit node.For example, when using a subnet router, the source address isthe tailscale IP address of the current node, andthe destination address is an IP address within the subnet range.In contrast, when acting as a subnet router, the source address isan IP address within the subnet range, and the destination is atailscale IP address that initiated the subnet proxy connection.In this case, the node acting as a subnet router is acting on behalfof some remote endpoint within the subnet range.The tun is used to populate the VirtualTraffic, SubnetTraffic,and ExitTraffic fields innetlogtype.Message.

The sockDevice captures packets at the magicsock layer.The source is always a tailscale IP address and the destinationis a non-tailscale IP address to contact for that particular tailscale node.The IP protocol and source port are always zero.The sock is used to populated the PhysicalTraffic field innetlogtype.Message.

The netMon parameter is optional; if non-nil it's used to do faster interface lookups.

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