Movatterモバイル変換


[0]ホーム

URL:


filter

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:21Imported by:28

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package filter is a stateful packet filter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

typeCapMatchadded inv1.24.0

type CapMatch =filtertype.CapMatch

typeCapTestFuncadded inv1.70.0

type CapTestFunc = func(srcIPnetip.Addr, captailcfg.NodeCapability)bool

CapTestFunc is the function signature of a function that tests whether srcIPhas a given capability.

It it used in the fast path of evaluating filter rules so should be fast.

typeFilter

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

Filter is a stateful packet filter.

funcNew

func New(matches []Match, capTestCapTestFunc, localNets, logIPs *netipx.IPSet, shareStateWith *Filter, logflogger.Logf) *Filter

New creates a new packet filter. The filter enforces that incoming packetsmust be destined to an IP in localNets, and must be allowed by matches.The optional capTest func is used to evaluate a Match that uses capabilities.If nil, such matches will always fail.

If shareStateWith is non-nil, the returned filter shares state with theprevious one, to enable changing rules at runtime without breaking existingstateful flows.

funcNewAllowAllForTestadded inv1.4.0

func NewAllowAllForTest(logflogger.Logf) *Filter

NewAllowAllForTest returns a packet filter that acceptseverything. Use in tests only, as it permits some kinds of spoofingattacks to reach the OS network stack.

funcNewAllowNone

func NewAllowNone(logflogger.Logf, logIPs *netipx.IPSet) *Filter

NewAllowNone returns a packet filter that rejects everything.

funcNewShieldsUpFilteradded inv1.4.0

func NewShieldsUpFilter(localNets *netipx.IPSet, logIPs *netipx.IPSet, shareStateWith *Filter, logflogger.Logf) *Filter

NewShieldsUpFilter returns a packet filter that rejects incoming connections.

If shareStateWith is non-nil, the returned filter shares state with the previous one,as long as the previous one was also a shields up filter.

func (*Filter)CapsWithValuesadded inv1.48.0

func (f *Filter) CapsWithValues(srcIP, dstIPnetip.Addr)tailcfg.PeerCapMap

CapsWithValues appends to base the capabilities that srcIP has talkingto dstIP.

func (*Filter)Checkadded inv1.56.0

func (f *Filter) Check(srcIP, dstIPnetip.Addr, dstPortuint16, protoipproto.Proto)Response

Check determines whether traffic from srcIP to dstIP:dstPort is allowedusing protocol proto.

func (*Filter)CheckTCPadded inv1.4.0

func (f *Filter) CheckTCP(srcIP, dstIPnetip.Addr, dstPortuint16)Response

CheckTCP determines whether TCP traffic from srcIP to dstIP:dstPortis allowed.

func (*Filter)RunIn

func (f *Filter) RunIn(q *packet.Parsed, rfRunFlags)Response

RunIn determines whether this node is allowed to receive q from aTailscale peer.

func (*Filter)RunOut

RunOut determines whether this node is allowed to send q to aTailscale peer.

func (*Filter)ShieldsUpadded inv1.4.0

func (f *Filter) ShieldsUp()bool

ShieldsUp reports whether this is a "shields up" (block everythingincoming) filter.

typeMatch

type Match =filtertype.Match

funcMatchesFromFilterRulesadded inv1.2.0

func MatchesFromFilterRules(pf []tailcfg.FilterRule) ([]Match,error)

MatchesFromFilterRules converts tailcfg FilterRules into Matches.If an error is returned, the Matches result is still valid,containing the rules that were successfully converted.

typeNetPortRangeadded inv0.98.1

type NetPortRange =filtertype.NetPortRange

typePortRange

type PortRange =filtertype.PortRange

typeResponse

type Responseint

Response is a verdict from the packet filter.

const (DropResponse =iota// do not continue processing packet.DropSilently// do not continue processing packet, but also don't logAccept// continue processing packet.)

func (Response)IsDropadded inv1.4.0

func (rResponse) IsDrop()bool

func (Response)String

func (rResponse) String()string

typeRunFlags

type RunFlagsint

RunFlags controls the filter's debug log verbosity at runtime.

const (LogDropsRunFlags = 1 <<iota// write dropped packet info to logfLogAccepts// write accepted packet info to logfHexdumpDrops// print packet hexdump when logging dropsHexdumpAccepts// print packet hexdump when logging accepts)

Source Files

View all Source files

Directories

PathSynopsis
Package filtertype defines the types used by wgengine/filter.
Package filtertype defines the types used by wgengine/filter.

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