tuntable

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PeerHelloHandshakeTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

func PostTunnelCleanup

func PostTunnelCleanup(devName string)

func PostTunnelSetup

func PostTunnelSetup(localNet *netip.Prefix, devName string) error

Types

type LocalPeerInfo

type LocalPeerInfo struct {
	LocalNet netip.Prefix

	Hostname string

	ChannelRoot string
	MTU         int
}

type PeerConnection

type PeerConnection struct {
	PeerInfo atomic.Value
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(addr string, dialer func(string) (net.Conn, *LocalPeerInfo, error), receiveChan chan *bufferio.BufferArray, maxQueueSize int, localPeerInfo *LocalPeerInfo) *PeerConnection

func (*PeerConnection) ActiveConnectionCount

func (c *PeerConnection) ActiveConnectionCount() int

func (*PeerConnection) Close

func (c *PeerConnection) Close()

func (*PeerConnection) CloseActiveConnections

func (c *PeerConnection) CloseActiveConnections()

CloseActiveConnections closes active connections. If the connection is not marked as closed, it will trigger a reconnect.

func (*PeerConnection) InitiateConnection

func (c *PeerConnection) InitiateConnection() (net.Conn, error)

func (*PeerConnection) LastActive

func (t *PeerConnection) LastActive() time.Time

func (*PeerConnection) Send

func (c *PeerConnection) Send(p *bufferio.BufferArray)

Send takes the ownership of `p`.

func (*PeerConnection) ServeNewConnection

func (c *PeerConnection) ServeNewConnection(conn net.Conn)

func (*PeerConnection) Status

func (c *PeerConnection) Status() *PeerStatus

func (*PeerConnection) StatusText

func (c *PeerConnection) StatusText() string

type PeerStatus

type PeerStatus struct {
	Hostname                string
	LocalAddr               string
	SendBytes, RecevedBytes int64
	LastActive              int64
	PeerAddresses           []string
	LastFailure             string
}

type PeerTable

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

func NewPeerTable

func NewPeerTable(ctx context.Context, device tun.Device, listenerCreator func(context.Context) (net.Listener, error), dialer func(string) (net.Conn, error), gateway *netip.Addr, maxQueueSize int, localInfo *LocalPeerInfo) *PeerTable

func (*PeerTable) CloseActiveConnections

func (t *PeerTable) CloseActiveConnections()

CloseActiveConnections closes active connections. This is used for device events e.g. WIFI connection state changed where all connections become obsoleted.

func (*PeerTable) GetPeerStatus

func (t *PeerTable) GetPeerStatus() []*PeerStatus

func (*PeerTable) IsClosed

func (t *PeerTable) IsClosed() bool

func (*PeerTable) Serve

func (t *PeerTable) Serve() error

func (*PeerTable) ServeFunc

func (t *PeerTable) ServeFunc(w http.ResponseWriter, r *http.Request)

func (*PeerTable) Shutdown

func (t *PeerTable) Shutdown()

func (*PeerTable) Start

func (t *PeerTable) Start()

func (*PeerTable) WaitForShutdown

func (t *PeerTable) WaitForShutdown() error

Jump to

Keyboard shortcuts

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