Movatterモバイル変換


[0]ホーム

URL:


flowtrack

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:5Imported by:9

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package flowtrack contains types for tracking TCP/UDP flows by 4-tuples.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeCache

type Cache[Valueany] struct {// MaxEntries is the maximum number of cache entries before// an item is evicted. Zero means no limit.MaxEntriesint// contains filtered or unexported fields}

Cache is an LRU cache keyed by Tuple.

The zero value is valid to use.

It is not safe for concurrent access.

func (*Cache[Value])Add

func (c *Cache[Value]) Add(keyTuple, value Value)

Add adds a value to the cache, set or updating its associatedvalue.

If MaxEntries is non-zero and the length of the cache is greaterafter any addition, the least recently used value is evicted.

func (*Cache[Value])Get

func (c *Cache[Value]) Get(keyTuple) (value *Value, okbool)

Get looks up a key's value from the cache, also reportingwhether it was present.

func (*Cache[Value])Len

func (c *Cache[Value]) Len()int

Len returns the number of items in the cache.

func (*Cache[Value])Remove

func (c *Cache[Value]) Remove(keyTuple)

Remove removes the provided key from the cache if it was present.

func (*Cache[Value])RemoveOldest

func (c *Cache[Value]) RemoveOldest()

RemoveOldest removes the oldest item from the cache, if any.

typeTuple

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

Tuple is a 5-tuple of proto, source and destination IP and port.

This struct originally used netip.AddrPort, but that was about twice as slowwhen used as a map key due to the alignment and extra space for the IPv6 zonepointers (unneeded for all our current 2024-06-17 flowtrack needs).

This struct is packed optimally and doesn't contain gaps or pointers.

funcMakeTupleadded inv1.70.0

func MakeTuple(protoipproto.Proto, src, dstnetip.AddrPort)Tuple

MakeTuple makes a Tuple out of netip.AddrPort values.

func (Tuple)DstAddradded inv1.70.0

func (tTuple) DstAddr()netip.Addr

func (Tuple)DstPortadded inv1.70.0

func (tTuple) DstPort()uint16

func (Tuple)MarshalJSONadded inv1.70.0

func (tTuple) MarshalJSON() ([]byte,error)

func (Tuple)SrcAddradded inv1.70.0

func (tTuple) SrcAddr()netip.Addr

func (Tuple)SrcPortadded inv1.70.0

func (tTuple) SrcPort()uint16

func (Tuple)String

func (tTuple) String()string

func (*Tuple)UnmarshalJSONadded inv1.70.0

func (t *Tuple) UnmarshalJSON(b []byte)error

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