server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const AlivePeriod = 30 * time.Second

AlivePeriod is how often we send "I'm here" facts to peers

View Source
const ChunkPeriod = 5 * time.Second

ChunkPeriod is the max time to wait between processing chunks of received packets and expiring old ones TODO: set this based on TTL instead

View Source
const FactTTL = 255 * time.Second

FactTTL is the TTL we apply to any locally generated Facts This is only meaningful if it is <= 255 seconds, since we encode the TTL as a byte

View Source
const MaxChunk = 100

MaxChunk is the max number of packets to receive before processing them

Variables

This section is empty.

Functions

This section is empty.

Types

type LinkServer

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

LinkServer represents the server component of wirelink sending/receiving on a socket

func Create

func Create(ctrl *wgctrl.Client, config *config.Server) (*LinkServer, error)

Create starts the server up. Have to take a deviceFactory instead of a Device since you can't refresh a device. Will take ownership of the wg client and close it when the server is closed If port <= 0, will use the wireguard device's listen port plus one

func (*LinkServer) Address

func (s *LinkServer) Address() net.IP

Address returns the local IP address on which the server listens

func (*LinkServer) Close

func (s *LinkServer) Close()

Close stops the server and closes all resources

func (*LinkServer) OnStopped added in v0.0.2

func (s *LinkServer) OnStopped() <-chan bool

OnStopped creates and returns a channel that will emit a single bool when the server is stopped it will emit `true` if the server stopped by normal request, or `false` if it failed with an error

func (*LinkServer) Port

func (s *LinkServer) Port() int

Port returns the local UDP port on which the server listens and sends

func (*LinkServer) RequestPrint

func (s *LinkServer) RequestPrint()

RequestPrint asks the packet receiver to print out the full set of known facts (local and remote)

func (*LinkServer) Stop

func (s *LinkServer) Stop()

Stop halts the background goroutines and releases resources associated with them, but leaves open some resources associated with the local device so that final state can be inspected

type ReceivedFact

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

ReceivedFact is a tuple of a fact and its source. It is used for the queue of parsed packets received over the network, to hold them in a batch before evaluating them for acceptance

func (*ReceivedFact) String

func (rf *ReceivedFact) String() string

Jump to

Keyboard shortcuts

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