Documentation ¶
Overview ¶
Package filter is a stateful packet filter.
Index ¶
- type Filter
- func New(matches []Match, localNets *netaddr.IPSet, logIPs *netaddr.IPSet, ...) *Filter
- func NewAllowAllForTest(logf logger.Logf) *Filter
- func NewAllowNone(logf logger.Logf, logIPs *netaddr.IPSet) *Filter
- func NewShieldsUpFilter(localNets *netaddr.IPSet, logIPs *netaddr.IPSet, shareStateWith *Filter, ...) *Filter
- type Match
- type NetPortRange
- type PortRange
- type Response
- type RunFlags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a stateful packet filter.
func New ¶
func New(matches []Match, localNets *netaddr.IPSet, logIPs *netaddr.IPSet, shareStateWith *Filter, logf logger.Logf) *Filter
New creates a new packet filter. The filter enforces that incoming packets must be destined to an IP in localNets, and must be allowed by matches. If shareStateWith is non-nil, the returned filter shares state with the previous one, to enable changing rules at runtime without breaking existing stateful flows.
func NewAllowAllForTest ¶ added in v1.4.0
NewAllowAllForTest returns a packet filter that accepts everything. Use in tests only, as it permits some kinds of spoofing attacks to reach the OS network stack.
func NewAllowNone ¶
NewAllowNone returns a packet filter that rejects everything.
func NewShieldsUpFilter ¶ added in v1.4.0
func NewShieldsUpFilter(localNets *netaddr.IPSet, logIPs *netaddr.IPSet, shareStateWith *Filter, logf logger.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) CheckTCP ¶ added in v1.4.0
CheckTCP determines whether TCP traffic from srcIP to dstIP:dstPort is allowed.
func (*Filter) RunIn ¶
RunIn determines whether this node is allowed to receive q from a Tailscale peer.
type Match ¶
type Match struct { IPProto []ipproto.Proto // required set (no default value at this layer) Dsts []NetPortRange Srcs []netaddr.IPPrefix }
Match matches packets from any IP address in Srcs to any ip:port in Dsts.
func MatchesFromFilterRules ¶ added in v1.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.
type NetPortRange ¶ added in v0.98.1
NetPortRange combines an IP address prefix and PortRange.
func (NetPortRange) String ¶ added in v0.98.1
func (npr NetPortRange) String() string
type PortRange ¶
type PortRange struct {
First, Last uint16 // inclusive
}
PortRange is a range of TCP and UDP ports.