Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Recv ¶
Recv this function receives the array of bytes. It doesn't need to be called on a supersocket structure. This functions creates the supersocket automatically, allowing to have a more abstract usage.
func Send ¶
Send this function sends the array of bytes. It doesn't need to be called on a supersocket structure. This functions creates the supersocket automatically, allowing to have a more abstract usage.
func SendMultiplePackets ¶
SendMultiplePackets sends multiple packets concurrently. It doesn't need to be called on a supersocket structure. This functions creates the supersocket automatically, allowing to have a more abstract usage.
Types ¶
type SuperSocket ¶
type SuperSocket struct {
// contains filtered or unexported fields
}
SuperSocket structure contains the pointer to pcap.Handle and the interface to be used
func NewSuperSocket ¶
func NewSuperSocket(device string, bpfFilter string) (*SuperSocket, error)
NewSuperSocket Given the interface and the filter opens the socket connection
func (*SuperSocket) GetHandle ¶
func (ss *SuperSocket) GetHandle() *pcap.Handle
GetHandle returns the pointer to the pcap.Handle
func (*SuperSocket) Recv ¶
func (ss *SuperSocket) Recv() (gopacket.Packet, error)
Recv receives the bytes and transforms it into a gopacket.packet using the function NewPacket
func (*SuperSocket) Send ¶
func (ss *SuperSocket) Send(packetBytes []byte) error
Send sends the array of bytes through the supersocket
func (*SuperSocket) SendMultiplePackets ¶
func (ss *SuperSocket) SendMultiplePackets(packets [][]byte, maxConcurrentSends int) error
SendMultiplePackets Given an array of bytes, sends them using goroutines. The maxConcurrentSends defines the maximum number of threads to be created