Documentation ¶
Index ¶
- Constants
- func NativeEndian() binary.ByteOrder
- func Uint16Attr(v uint16) []byte
- func Uint32Attr(v uint32) []byte
- func Uint8Attr(v uint8) []byte
- func ZeroTerminated(s string) []byte
- type NetLink
- type NetlinkRequest
- type NetlinkRequestData
- type NfGenMsg
- type Option
- type Options
- type RtAttr
- type Uint32Attribute
Constants ¶
const ( IPSET_CMD_CREATE = 2 IPSET_CMD_DESTROY = 3 IPSET_CMD_FLUSH = 4 IPSET_CMD_ADD = 9 IPSET_CMD_DEL = 10 )
Message types and commands.
const ( IPSET_ATTR_PROTOCOL = 1 /* 1: Protocol version */ IPSET_ATTR_SETNAME = 2 /* 2: Name of the set */ IPSET_ATTR_TYPENAME = 3 /* 3: Typename */ IPSET_ATTR_REVISION = 4 /* 4: Settype revision */ IPSET_ATTR_FAMILY = 5 /* 5: Settype family */ IPSET_ATTR_DATA = 7 /* 7: Nested attributes */ )
Attributes at command level.
const ( IPSET_ATTR_IP = 1 IPSET_ATTR_CIDR = 3 IPSET_ATTR_TIMEOUT = 6 )
CADT specific attributes.
const ( IPSET_ATTR_IPADDR_IPV4 = 1 IPSET_ATTR_IPADDR_IPV6 = 2 )
IP specific attributes.
const ( NLA_F_NESTED = (1 << 15) NLA_F_NET_BYTEORDER = (1 << 14) )
ATTR flags.
const IPSET_MAXNAMELEN = 32
IPSET_MAXNAMELEN is the max length of strings including NUL: set and type identifiers.
const IPSET_PROTOCOL = 6
IPSET_PROTOCOL is the protocol version. http://git.netfilter.org/ipset/tree/include/libipset/linux_ip_set.h
const NFNL_SUBSYS_IPSET = 6
NFNL_SUBSYS_IPSET is netfilter netlink message type of ipset. https://github.com/torvalds/linux/blob/9e66317d3c92ddaab330c125dfe9d06eee268aff/include/uapi/linux/netfilter/nfnetlink.h#L56
Variables ¶
This section is empty.
Functions ¶
func NativeEndian ¶
NativeEndian get native endianness for the system
Types ¶
type NetLink ¶
type NetLink struct {
// contains filtered or unexported fields
}
NetLink struct.
func (*NetLink) DestroySet ¶ added in v0.3.0
DestroySet destroys a ipset.
type NetlinkRequest ¶
type NetlinkRequest struct { syscall.NlMsghdr Data []NetlinkRequestData RawData []byte }
NetlinkRequest is a netlink request.
func NewNetlinkRequest ¶
func NewNetlinkRequest(proto, flags int) *NetlinkRequest
NewNetlinkRequest create a new netlink request from proto and flags Note the Len value will be inaccurate once data is added until the message is serialized.
func (*NetlinkRequest) AddData ¶
func (req *NetlinkRequest) AddData(data NetlinkRequestData)
AddData add data to request.
func (*NetlinkRequest) AddRawData ¶
func (req *NetlinkRequest) AddRawData(data []byte)
AddRawData adds raw bytes to the end of the NetlinkRequest object during serialization.
func (*NetlinkRequest) Serialize ¶
func (req *NetlinkRequest) Serialize() []byte
Serialize the Netlink Request into a byte array.
type NetlinkRequestData ¶
NetlinkRequestData interface.
type NfGenMsg ¶
type NfGenMsg struct {
// contains filtered or unexported fields
}
NfGenMsg struct.
func NewNfGenMsg ¶
NewNfGenMsg returns a new NfGenMsg.
type RtAttr ¶
RtAttr Extend RtAttr to handle data and children.
func NewRtAttrChild ¶
NewRtAttrChild Create a new RtAttr obj anc add it as a child of an existing object.
func (*RtAttr) AddChild ¶ added in v0.4.0
func (a *RtAttr) AddChild(attr NetlinkRequestData)
AddChild adds an existing NetlinkRequestData as a child.
type Uint32Attribute ¶ added in v0.4.0
Uint32Attribute .
func (*Uint32Attribute) Serialize ¶ added in v0.4.0
func (a *Uint32Attribute) Serialize() []byte
Serialize .