network1

package
v0.0.0-...-c5429dd Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	VpnEnabled bool
	Devices    map[string]*DeviceConfig
}

type DeviceConfig

type DeviceConfig struct {
	Enabled bool
}

type ICMP

type ICMP struct {
	Type        uint8
	Code        uint8
	CheckSum    uint16
	Identifier  uint16
	SequenceNum uint16
}

ICMP icmp protocol header

type IPHeader

type IPHeader struct {
	Version     uint8 // the first byte[0:4]
	Length      uint8 // the first byte[4:8]
	TOS         uint8 // type of service
	TotalLen    uint16
	Identifier  uint16
	Flag        uint8  // only has 3 bits
	Offset      uint16 // has 13 bits
	TTL         uint8
	Protocol    uint8 // ICMP: 1, TCP: 6, UDP: 7。 定义在 /etc/protocols
	CheckSum    uint16
	Source      [4]uint8
	Destination [4]uint8
	Options     [40]uint8 // 可选字段,根据 Length 来判断是否存在
}

IPHeader store ip header data

type Module

type Module struct {
	*loader.ModuleBase
	// contains filtered or unexported fields
}

func (*Module) GetDependencies

func (m *Module) GetDependencies() []string

func (*Module) Start

func (m *Module) Start() error

func (*Module) Stop

func (m *Module) Stop() error

type Network

type Network struct {
	VpnEnabled bool `prop:"access:rw"`
	// contains filtered or unexported fields
}

func (*Network) EnableDevice

func (n *Network) EnableDevice(pathOrIface string, enabled bool) (cpath dbus.ObjectPath, error *dbus.Error)

func (*Network) GetExportedMethods

func (v *Network) GetExportedMethods() dbusutil.ExportedMethods

func (*Network) GetInterfaceName

func (n *Network) GetInterfaceName() string

func (*Network) IsDeviceEnabled

func (n *Network) IsDeviceEnabled(pathOrIface string) (enabled bool, busErr *dbus.Error)

func (*Network) Ping

func (n *Network) Ping(host string) *dbus.Error

Ping ping remote host, blocked operation.

func (*Network) ToggleWirelessEnabled

func (n *Network) ToggleWirelessEnabled() (enabled bool, busErr *dbus.Error)

Jump to

Keyboard shortcuts

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