netlog
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 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)ReconfigNetworkMap¶added inv1.92.0
func (nl *Logger) ReconfigNetworkMap(nm *netmap.NetworkMap)
ReconfigNetworkMap configures the network logger with an updated netmap.
func (*Logger)ReconfigRoutes¶
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)Shutdown¶
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.