Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( IPPROTO_TCP = ProtocolType(syscall.IPPROTO_TCP) IPPROTO_UDP = ProtocolType(syscall.IPPROTO_UDP) IPPROTO_ICMP = ProtocolType(syscall.IPPROTO_ICMP) IPPROTO_RAW = ProtocolType(syscall.IPPROTO_RAW) IPPROTO_IP = ProtocolType(syscall.IPPROTO_IP) )
Functions ¶
Types ¶
type ICMP ¶
type ICMP struct { Type layers.ICMPv4TypeCode Payload []byte RandomizedPayloadLength int }
type IPIterator ¶
type IPIterator struct {
// contains filtered or unexported fields
}
IPIterator represents an iterator over a collection of IP addresses.
func ToIPIterator ¶
func ToIPIterator(data ...string) *IPIterator
ToIPIterator creates a new instance of IPIterator with the given data.
func (*IPIterator) HasNext ¶
func (it *IPIterator) HasNext() bool
HasNext returns true if there is a next IP address in the iterator.
func (*IPIterator) Next ¶
func (it *IPIterator) Next() net.IP
Next returns the next IP in the iterator.
func (*IPIterator) SetSkipLocal ¶
func (it *IPIterator) SetSkipLocal(b bool)
SetSkipLocal sets the skipLocal flag to the given value.
func (*IPIterator) Shuffle ¶
func (it *IPIterator) Shuffle()
type ProtocolType ¶
type ProtocolType int
func (ProtocolType) LinkType ¶
func (t ProtocolType) LinkType() gopacket.Decoder
LinkType returns the corresponding gopacket.Decoder for the given ProtocolType.
type RawSocket ¶
type RawSocket interface { Write([]byte, net.Addr) (int, error) Read([]byte) (int, net.Addr, error) NextPacket() (gopacket.Packet, *net.IPAddr, error) Iter() chan WrappedPacket Close() error }
func OpenRawSocket ¶
func OpenRawSocket(protocol ProtocolType) (RawSocket, error)
OpenRawSocket opens a raw socket for the specified protocol. It returns a pointer to RawSocket and an error, if any.
type TCP ¶
type UnixSocket ¶
type UnixSocket struct {
// contains filtered or unexported fields
}
func (*UnixSocket) Close ¶
func (u *UnixSocket) Close() error
Close closes the UnixSocket connection. It returns an error if there was an issue closing the connection.
func (*UnixSocket) Iter ¶
func (u *UnixSocket) Iter() chan WrappedPacket
Iter returns a channel that will receive gopacket.Packet objects.
func (*UnixSocket) NextPacket ¶
NextPacket reads the next packet from the UnixSocket. It returns the packet as a gopacket.Packet and any error encountered.