native

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoEnvironment

type GoEnvironment struct {
}

GoEnvironment is a partial implementation of Environment which provides the methods and types that the go runtime can answer

func (*GoEnvironment) InterfaceByName

func (e *GoEnvironment) InterfaceByName(name string) (*GoInterface, error)

InterfaceByName implements Environment by wrapping net.InterfaceByName

func (*GoEnvironment) Interfaces

func (e *GoEnvironment) Interfaces() ([]*GoInterface, error)

Interfaces implements Environment

func (*GoEnvironment) ListenUDP added in v0.9.1

func (e *GoEnvironment) ListenUDP(network string, laddr *net.UDPAddr) (networking.UDPConn, error)

ListenUDP implements Environment by wrapping net.ListenUDP

func (*GoEnvironment) NewWgClient added in v0.10.0

func (e *GoEnvironment) NewWgClient() (internal.WgClient, error)

NewWgClient implements Environment by wrapping wgctrl.New()

type GoInterface

type GoInterface struct {
	net.Interface
}

GoInterface provides as much of Interface as the go runtime can

func (*GoInterface) Addrs

func (i *GoInterface) Addrs() ([]net.IPNet, error)

Addrs implements Interface, looks up the IP addresses for the interface

func (*GoInterface) IsUp

func (i *GoInterface) IsUp() bool

IsUp implements Interface, checks for FlagUp

func (*GoInterface) Name

func (i *GoInterface) Name() string

Name implements Interface, gets its name

type GoUDPConn added in v0.9.1

type GoUDPConn struct {
	net.UDPConn
}

GoUDPConn implements networking.UDPConn by wrapping net.UDPConn

func (*GoUDPConn) ReadPackets added in v0.9.1

func (c *GoUDPConn) ReadPackets(
	ctx context.Context,
	maxSize int,
	packets chan<- *networking.UDPPacket,
) error

ReadPackets implements networking.UDPConn. TODO: the cancellation context won't be obeyed very well. Methodology loosely adapted from: https://medium.com/@zombiezen/canceling-i-o-in-go-capn-proto-5ae8c09c5b29 via https://github.com/golang/go/issues/20280#issue-227074518 UDP makes this simpler however as partial reads are not a concern

Jump to

Keyboard shortcuts

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