socket

package module
v0.0.0-...-462ec1e Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 7 Imported by: 2

README

Wrap over Linux raw socket

High level implementation of raw linux socket with pure Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Interface

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

func New

func New(opts ...InterfaceOption) (*Interface, error)

func (*Interface) Close

func (i *Interface) Close() error

func (*Interface) GetHardwareAddr

func (i *Interface) GetHardwareAddr() net.HardwareAddr

func (*Interface) Read

func (i *Interface) Read(buf []byte) (int, error)

func (*Interface) Write

func (i *Interface) Write(buf []byte) (int, error)

type InterfaceOption

type InterfaceOption func(*Interface)

func WithCIDR

func WithCIDR(cidr string) InterfaceOption

Option for IP address with mask, `10.58.0.1/24` by default

func WithDefaultGateway

func WithDefaultGateway() InterfaceOption

Option for setting default gateway

func WithDevice

func WithDevice(dev string) InterfaceOption

Option for network device, `tap_netstack` by deafult

func WithTimeout

func WithTimeout(t time.Duration) InterfaceOption

Option to set timeout for read and write for interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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