Documentation ¶
Overview ¶
Package nftget help with conveniently retrieving information from nftable expressions.
Index ¶
- func IPv46(cmp *expr.Cmp) (net.IP, bool)
- func IsPayloadDestIP(payl *expr.Payload) bool
- func MetaL4ProtoTcpUdp(exprs nufftables.Expressions) (nufftables.Expressions, string)
- func OptionalDestIPv46(exprs nufftables.Expressions, family nftables.TableFamily) (nufftables.Expressions, net.IP)
- func OptionalIPv46(exprs nufftables.Expressions, family nftables.TableFamily) (nufftables.Expressions, net.IP)
- func PayloadL4ProtoTcpUdp(exprs nufftables.Expressions) (nufftables.Expressions, string)
- func PayloadPort(exprs nufftables.Expressions) (nufftables.Expressions, uint16)
- func Port(cmp *expr.Cmp) (uint16, bool)
- func TcpUdp(cmp *expr.Cmp) (string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsPayloadDestIP ¶ added in v2.6.0
IsPayloadDestIP returns true if the passed Payload expression loads an IP address of the correct size (either 4 or 16 bytes) from the correct IPv4 or IPv6 network layer header.
See also RFC 791, section 3.1 for the following IPv4 header structure; the word offsets are in decimal and not shown in the original RFC ASCII illustration.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +00 |Version| IHL |Type of Service| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +04 | Identification |Flags| Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +08 | Time to Live | Protocol | Header Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +12 | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +16 | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +20 | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
See also RFC 8200, section 3 for the following IPv6 header structure; the word offsets are in decimal and not shown in the original RFC ASCII illustration. Similarly, the bit number heading has been added for improved clarification.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +00 |Version| Traffic Class | Flow Label | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +04 | Payload Length | Next Header | Hop Limit | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +08 | | + + +12 | | + Source Address + +16 | | + + +20 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +24 | | + + +28 | | + Destination Address + +32 | | + + +36 | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
func MetaL4ProtoTcpUdp ¶ added in v2.6.1
func MetaL4ProtoTcpUdp(exprs nufftables.Expressions) (nufftables.Expressions, string)
MetaL4ProtoTcpUdp returns the transport layer protocol name checked for from a Meta/Cmp twin-expression, together with the remaining expressions; otherwise, it returns nil.
func OptionalDestIPv46 ¶ added in v2.6.0
func OptionalDestIPv46(exprs nufftables.Expressions, family nftables.TableFamily) (nufftables.Expressions, net.IP)
OptionalDestIPv46 returns the IPv4 or IPv6 address in a twin Payload network header load and Cmp expression; otherwise, it returns the unspecified IP address of the particular IP family.
func OptionalIPv46 ¶
func OptionalIPv46(exprs nufftables.Expressions, family nftables.TableFamily) (nufftables.Expressions, net.IP)
OptionalIPv46 returns the IPv4 or IPv6 address enclosed in a Cmp expression, otherwise the unspecified IP address of the particular IP family.
func PayloadL4ProtoTcpUdp ¶ added in v2.6.1
func PayloadL4ProtoTcpUdp(exprs nufftables.Expressions) (nufftables.Expressions, string)
PayloadL4ProtoTcpUdp returns the transport layer protocol name checked for from a Payload/Cmp twin-expression, together with the remaining expressions; otherwise, it returns nil.
func PayloadPort ¶ added in v2.6.0
func PayloadPort(exprs nufftables.Expressions) (nufftables.Expressions, uint16)
PayloadPort returns the (transport) destination port number from a payload-cmp twin expression, together with the remaining expressions; otherwise, it returns nil expressions and a zero port.
Types ¶
This section is empty.