lib

package
v0.0.0-...-0b55b12 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = logging.MustGetLogger("driftd")

Functions

func BuildRawPacket

func BuildRawPacket(srcAddr *net.UDPAddr, dstAddr *net.UDPAddr, payload []byte) []byte

Constructs a raw UDP+IPv6 packet

func ConfigureDevice

func ConfigureDevice(devName string)

Configures the given serial device using AT commands TODO: Implement me!

func CreateTUN

func CreateTUN(ifaceName string, cidr net.IP) io.ReadCloser

Creates a named TUN device and configures the device to handle packets with the given 64-bit CIDR prefix

func InitLogging

func InitLogging(levelString string)

Initializes logging facilities at the given level

func SendRawPacket

func SendRawPacket(packet []byte) error

Sends a raw packet encoded as a byte array to the networking stack. Note that this may be platform dependent!

Types

type Exchange

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

The Drift packet exchange performs all vital protocol functions including routing, packet encapsulation and stripping, etc.

func NewExchange

func NewExchange(cfg ExchangeConfig) *Exchange

Creates a new Drift packet exchange

func (*Exchange) Shutdown

func (x *Exchange) Shutdown()

Gracefully shuts down the Drift exchange

func (*Exchange) Start

func (x *Exchange) Start()

Boots up the Drift exchange. Note that this function will block indefinitely until shutdown

type ExchangeConfig

type ExchangeConfig struct {
	// The serial device for the exchange to use
	// for all TX/RX operations
	DeviceName string
	// The name of the TUN interface to create
	InterfaceName string
	// The IPv6 CIDR block for routing. Note that
	// this should be a 64-bit prefix, as the
	// remaining 64 bits will be consumed by the
	// serial device's MAC address
	CIDR net.IP
}

Configuration for the Drift packet exchange

Jump to

Keyboard shortcuts

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