Documentation ¶
Overview ¶
A collection of google/nftables expression partials used to compose rules
Index ¶
- Constants
- func Accept() *expr.Verdict
- func Bitwise(length uint32, mask []byte, xor []byte) *expr.Bitwise
- func BitwiseWithRegisters(sourceRegister uint32, destRegister uint32, length uint32, mask []byte, ...) *expr.Bitwise
- func CompareCtState(mask uint32) ([]expr.Any, error)
- func CompareCtStateWithRegister(reg uint32, mask uint32) ([]expr.Any, error)
- func CompareDestinationAddress(ip netip.Addr) ([]expr.Any, error)
- func CompareDestinationAddressSet(set *nftables.Set) ([]expr.Any, error)
- func CompareDestinationAddressSetWithRegister(set *nftables.Set, reg uint32) ([]expr.Any, error)
- func CompareDestinationAddressWithRegister(ip netip.Addr, reg uint32) ([]expr.Any, error)
- func CompareDestinationPort(port uint16) ([]expr.Any, error)
- func CompareDestinationPortSet(set *nftables.Set) ([]expr.Any, error)
- func CompareDestinationPortSetWithRegister(set *nftables.Set, reg uint32) ([]expr.Any, error)
- func CompareDestinationPortWithRegister(port uint16, reg uint32) ([]expr.Any, error)
- func CompareProtocolFamily(proto byte) ([]expr.Any, error)
- func CompareProtocolFamilyWithRegister(proto byte, reg uint32) ([]expr.Any, error)
- func CompareSourceAddress(ip netip.Addr) ([]expr.Any, error)
- func CompareSourceAddressSet(set *nftables.Set) ([]expr.Any, error)
- func CompareSourceAddressSetWithRegister(set *nftables.Set, reg uint32) ([]expr.Any, error)
- func CompareSourceAddressWithRegister(ip netip.Addr, reg uint32) ([]expr.Any, error)
- func CompareSourcePort(port uint16) ([]expr.Any, error)
- func CompareSourcePortSet(set *nftables.Set) ([]expr.Any, error)
- func CompareSourcePortSetWithRegister(set *nftables.Set, reg uint32) ([]expr.Any, error)
- func CompareSourcePortWithRegister(port uint16, reg uint32) ([]expr.Any, error)
- func CompareTransportProtocol(proto byte) ([]expr.Any, error)
- func CompareTransportProtocolWithRegister(proto byte, reg uint32) ([]expr.Any, error)
- func Counter() *expr.Counter
- func DestinationPort(reg uint32) *expr.Payload
- func Drop() *expr.Verdict
- func Equals(data []byte, reg uint32) *expr.Cmp
- func IPSetLookUp(set *nftables.Set, reg uint32) *expr.Lookup
- func IPv4DestinationAddress(reg uint32) *expr.Payload
- func IPv4SourceAddress(reg uint32) *expr.Payload
- func IPv6DestinationAddress(reg uint32) *expr.Payload
- func IPv6SourceAddress(reg uint32) *expr.Payload
- func LoadCtByKey(ctKey expr.CtKey) (*expr.Ct, error)
- func LoadCtByKeyWithRegister(ctKey expr.CtKey, reg uint32) (*expr.Ct, error)
- func Match(name string, revision uint32, info xt.InfoAny) *expr.Match
- func MatchBpf(info []byte) *expr.Match
- func MatchBpfWithVerdict(info []byte, verdict *expr.Verdict) []expr.Any
- func MatchUnknown(name string, revision uint32, info []byte) *expr.Match
- func Meta(meta expr.MetaKey, reg uint32) *expr.Meta
- func NotEquals(data []byte, reg uint32) *expr.Cmp
- func PortSetLookUp(set *nftables.Set, reg uint32) *expr.Lookup
- func SourcePort(reg uint32) *expr.Payload
- type AddrFamily
- type TransportProto
Constants ¶
const ( SrcPortOffset = 0 DstPortOffset = 2 PortLen = 2 )
Transport protocol lengths and offsets
const ( IPv4SrcOffset = 12 IPv4DstOffset = 16 IPv4AddrLen = 4 )
IPv4 lengths and offsets
const ( IPv6SrcOffest = 8 IPv6DstOffset = 24 IPv6AddrLen = 16 )
IPv6 lengths and offsets
Variables ¶
This section is empty.
Functions ¶
func BitwiseWithRegisters ¶ added in v0.0.12
func CompareCtStateWithRegister ¶ added in v0.0.12
Makes the comparison specified by `mask` to the CT State already loaded in `reg`. Valid values for mask are: expr.CtStateBitInvalid = 1 expr.CtStateBitESTABLISHED = 2 expr.CtStateBitRELATED = 4 expr.CtStateBitNEW = 8 expr.CtStateBitUNTRACKED = 64 Or combinations with a bitwise OR: `expr.CtStateBitNEW | expr.CtStateBitUNTRACKED`
func CompareDestinationAddress ¶
Returns a list of expressions that will compare the destination address of traffic
func CompareDestinationAddressSet ¶
Returns a list of expressions that will compare the destination address of traffic against a set
func CompareDestinationAddressSetWithRegister ¶
Returns a list of expressions that will compare the destnation address of traffic against a set, with a user defined register
func CompareDestinationAddressWithRegister ¶
Returns a list of expressions that will compare the destination address of traffic, with a user defined register
func CompareDestinationPort ¶
Returns a list of expressions that will compare the destination port of traffic
func CompareDestinationPortSet ¶
Returns a list of expressions that will compare the destination port of traffic against a set
func CompareDestinationPortSetWithRegister ¶
Returns a list of expressions that will compare the destination port of traffic against a set, with a user defined register
func CompareDestinationPortWithRegister ¶
Returns a list of expressions that will compare the destination port of traffic, with a user defined register
func CompareProtocolFamily ¶
Returns a list of expressions that will compare the netfilter protocol family of traffic
func CompareProtocolFamilyWithRegister ¶
Returns a list of expressions that will compare the protocol family of traffic, with a user defined register
func CompareSourceAddress ¶
Returns a list of expressions that will compare the source address of traffic
func CompareSourceAddressSet ¶
Returns a list of expressions that will compare the source address of traffic against a set
func CompareSourceAddressSetWithRegister ¶
Returns a list of expressions that will compare the source address of traffic against a set, with a user defined register
func CompareSourceAddressWithRegister ¶
Returns a list of expressions that will compare the source address of traffic, with a user defined register
func CompareSourcePort ¶
Returns a list of expressions that will compare the source port of traffic
func CompareSourcePortSet ¶
Returns a list of expressions that will compare the source port of traffic against a set
func CompareSourcePortSetWithRegister ¶
Returns a list of expressions that will compare the source port of traffic against a set, with a user defined register
func CompareSourcePortWithRegister ¶
Returns a list of expressions that will compare the source port of traffic, with a user defined register
func CompareTransportProtocol ¶
Returns a list of expressions that will compare the transport protocol of traffic
func CompareTransportProtocolWithRegister ¶
Returns a list of expressions that will compare the transport protocol of traffic, with a user defined register
func DestinationPort ¶
Returns a destination port payload expression
func IPSetLookUp ¶
Returns an IP set lookup expression
func IPv4DestinationAddress ¶
Returns a IPv4 destination address payload expression
func IPv4SourceAddress ¶
Returns a IPv4 source address payload expression
func IPv6DestinationAddress ¶
Returns a IPv6 destination address payload expression
func IPv6SourceAddress ¶
Returns a IPv6 source address payload expression
func LoadCtByKeyWithRegister ¶ added in v0.0.12
func MatchBpfWithVerdict ¶
Returns a xtables match bpf expression with a verdict
func MatchUnknown ¶
Returns a xtables match expression of unknown type
func PortSetLookUp ¶
Returns a port set lookup expression
func SourcePort ¶
Returns a source port payload expression
Types ¶
type AddrFamily ¶ added in v0.0.13
type AddrFamily int8
const ( AnyFamily AddrFamily = -1 IPv4 AddrFamily = unix.NFPROTO_IPV4 IPv6 AddrFamily = unix.NFPROTO_IPV6 )
type TransportProto ¶ added in v0.0.13
type TransportProto int8
const ( AnyTransport TransportProto = -1 TCP TransportProto = unix.IPPROTO_TCP UDP TransportProto = unix.IPPROTO_UDP )