# README
nfqueue-go
Nfqueue-go implements a go native implementation for the nfqueue netlink interface provided by Linux to process packets capture by a linux kernel filter.
The library implements a subset of the functionality provided by https://www.netfilter.org/projects/libnetfilter_queue/
The library implements the following APIs
- create queue
- process packets from the queue that are punted to it from the iptables match criteria.
It does not yet implememt parsing methods to get indev,physdev,outdev,outphysdev,indevnames,outdevnames,timestamp.
# Packages
No description provided by the author
# Functions
CreateAndStartNfQueue -- Wrapper to create/bind to queue set all its params and start listening for packets.queueID -- the queue to create/bindmaxPacketsInQueue -- max number of packets in QueuepacketSize -- The max expected packetsizeprivateData -- We will return this on NFpacket.Opaque data for this system.
GetPacketInfo -- Extract packet info from netlink responseReturns mark,packetid and packet payloadMark is uint32.
NewNFQueue -- create a new NfQueue handle.
QueueID return queueid.
# Constants
APUNSPEC -- PF_UNSPEC/AF_UNSPEC.
NfDefaultPacketSize the maximum size packet to expect on queue.
nfqnl_msg_config_cmd */.
value of these flags (__u32) */.
identify which flags to change */.
nfqnl_msg_config_params */.
u_int32_t */.
NfqaCfgUnspec -- Unspec.
nfqnl_msg_packet_hw */.
u_int32_t ifindex */.
u_int32_t ifindex */.
u_int32_t ifindex */.
u_int32_t ifindex */.
u_int32_t nfmark */.
NfqaPacketHdr Attr header for Packet payload.
opaque data payload */.
nfqnl_msg_packet_timestamp */.
NfqaUnspec unspecified.
nfqnlmsg_verdict_hrd */.
NfqnlCfgCmdBind -- queue bind command.
NfqnlCfgCmdnone -- None.
NfqnlCfgCmdPfBind -- bind family.
NfqnlCfgCmdPfUnbind -- unbind family.
NfqnlCfgCmdUnbind -- queue unbind command.
NfqnlCopyMeta -- Copy only metadata.
NfqnlCopyNone -- Copy no packet bytes to userspace.
NfqnlCopyPacket -- Copy packet bytes specified by Range.
No description provided by the author
No description provided by the author
SizeOfNfqMsgConfigQueueLen -- Sizeof NfqMsgConfigQueueLen.
SizeofNfqMsgMarkHdr -- sizeof mark hdr.
SizeofNfqMsgVerdictHdr -- Sizeof verdict hdr struct.
# Structs
NFPacket -- message format sent on channel.
NfqMsgConfigCommand -- config commandCommand -- the config commandpf -- family.
NfqMsgConfigParams -- Config paramscopyRange -- Range of bytes to copycopyMode -- copyMode meta/none/packet.
NfqMsgConfigQueueLen -- Queue lengthqueueLen -- The length of queue.
NfqMsgMarkHdr -- Mark Payloadmark -- markval.
NfqMsgVerdictHdr -- Verdict Hdr structverdict -- accept/dropid -- packetid.
NfqSockHandle -- Sock handle of netlink socketfd -- fd of socketrcvbufSize -- rcv buffer Sizelsa -- local address.
NfQueue Struct to hold global val for all instances of netlink socket.
# Interfaces
NFQueue -- Interface exposing internal Nfqueue functions.
SockHandle Opaque interface with unexported functions.
Verdict -- Interface exposing functionality to get a copy of the received packet and set a verdict.