rawsocket

package
v0.28.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllPackets    = syscall.ETH_P_ALL
	OnlyIPPackets = syscall.ETH_P_IP
)

Protocols to receive

Variables

This section is empty.

Functions

This section is empty.

Types

type RawSocket

type RawSocket struct {
	// contains filtered or unexported fields
}

RawSocket describes a raw socket C implemenation

func NewRawSocket

func NewRawSocket(ifName string, protocol int) (*RawSocket, error)

NewRawSocket creates a raw socket for the network interface ifName

func NewRawSocketInNs

func NewRawSocketInNs(nsPath string, ifName string, protocol int) (*RawSocket, error)

NewRawSocketInNs create/open a socket in the namespace nsPath for the network interface ifName

func (*RawSocket) Close

func (s *RawSocket) Close() error

Close the file descriptor

func (*RawSocket) GetFd

func (s *RawSocket) GetFd() int

GetFd returns the file descriptor

func (*RawSocket) Write

func (s *RawSocket) Write(data []byte) (int, error)

Write outputs some bytes to the file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL