controller

package
v0.0.0-...-69b9976 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NONE       = 0
	CONNECT    = 1
	DISCONNECT = 2
)
View Source
const (
	Prefix = "100.70.0.0/24"
)

Variables

This section is empty.

Functions

func AutocertHandler

func AutocertHandler(am *autocert.Manager)

Types

type Config

type Config struct {
	GrpcPort      uint16 `env:"GRPC_PORT,default=9000"`
	HttpPort      uint16 `env:"HTTP_PORT,default=443"`
	DiscoveryPort uint16 `env:"DISCOVERY_PORT,default=5050"`
	DbEnabled     bool   `env:"DB_ENABLED"`
	DbPath        string `env:"DB_PATH,required"`
	AutoCert      struct {
		Enabled  bool   `env:"AUTOCERT_ENABLED,default=false"`
		Domain   string `env:"AUTOCERT_DOMAIN"`
		CacheDir string `enc:"AUTOCERT_CACHEDIR"`
	}
}

func GetConfig

func GetConfig() (*Config, error)

type Controller

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

func NewController

func NewController(store *store.Store) *Controller

func (*Controller) AllocateIP

func (c *Controller) AllocateIP() (string, error)

TODO Write real IPAM functions

func (*Controller) ClosePeerUpdateChannels

func (c *Controller) ClosePeerUpdateChannels()

func (*Controller) DeletePeerUpdateChan

func (c *Controller) DeletePeerUpdateChan(id uint32)

func (*Controller) EventPeerConnected

func (c *Controller) EventPeerConnected(peerID uint32)

func (*Controller) EventPeerDisconnected

func (c *Controller) EventPeerDisconnected(peerID uint32)

func (*Controller) EventPunchRequest

func (c *Controller) EventPunchRequest(peerID uint32, endpoint string) error

func (*Controller) GetConnectedPeers

func (c *Controller) GetConnectedPeers() ([]types.Peer, error)

func (*Controller) GetPeerUpdateChan

func (c *Controller) GetPeerUpdateChan(id uint32) chan *controllerv1.UpdateResponse

func (*Controller) InitIPAM

func (c *Controller) InitIPAM(prefix string) error

func (*Controller) LoginPeer

func (c *Controller) LoginPeer(publicKey string) (*types.Peer, error)

LoginPeer logs in an existing peer by public key If peer exists, returns peer configuration If the peer is not registered or does not exist, returns nil peer and ErrNotFound

func (*Controller) PeerConnected

func (c *Controller) PeerConnected(id uint32) error

func (*Controller) PeerDisconnected

func (c *Controller) PeerDisconnected(id uint32) error

TODO: Still notify peers if store update fails???

func (*Controller) RegisterPeer

func (c *Controller) RegisterPeer(publicKey string) error

func (*Controller) SetPeerEndpoint

func (c *Controller) SetPeerEndpoint(id uint32, endpoint string) error

type Event

type Event struct {
	EventType int
	PeerID    uint32
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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