device

package
v0.0.0-...-7897c6d Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device interface {
	// Read data packets from network device
	Read([]byte) (int, error)
	// Write data packets to network device
	Write([]byte) (int, error)
	// Close device
	Close() error
	// MTU return device's mtu
	MTU() (int, error)
	// Name return device's name
	Name() (string, error)
	// AddAddress add a address
	AddAddress(addr netip.Prefix) error
	// FlushAddress clear all address
	FlushAddress() error
	// Up make the network card status up
	Up() error
	// Down make the network card status down
	Down() error
	// State return the status of the network card, true means up, false means down
	State() bool
}

func CreateTUN

func CreateTUN(name string, mtu int) (Device, error)

Jump to

Keyboard shortcuts

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