Documentation ¶
Index ¶
- Constants
- func AutocertHandler(am *autocert.Manager)
- type Config
- type Controller
- func (c *Controller) AllocateIP() (string, error)
- func (c *Controller) ClosePeerUpdateChannels()
- func (c *Controller) DeletePeerUpdateChan(id uint32)
- func (c *Controller) EventPeerConnected(peerID uint32)
- func (c *Controller) EventPeerDisconnected(peerID uint32)
- func (c *Controller) EventPunchRequest(peerID uint32, endpoint string) error
- func (c *Controller) GetConnectedPeers() ([]types.Peer, error)
- func (c *Controller) GetPeerUpdateChan(id uint32) chan *controllerv1.UpdateResponse
- func (c *Controller) InitIPAM(prefix string) error
- func (c *Controller) LoginPeer(publicKey string) (*types.Peer, error)
- func (c *Controller) PeerConnected(id uint32) error
- func (c *Controller) PeerDisconnected(id uint32) error
- func (c *Controller) RegisterPeer(publicKey string) error
- func (c *Controller) SetPeerEndpoint(id uint32, endpoint string) error
- type Event
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 ¶
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"` } }
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
Click to show internal directories.
Click to hide internal directories.