controller

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MonitorMap = map[string]MonitorType{"port": Monitor_PORT, "exec": Monitor_EXEC, "consul": Monitor_CONSUL}

Functions

This section is empty.

Types

type App

type App struct {
	Name      string
	Vip       *Route
	VipConfig config.VipConfig
	Monitors  Monitors
	Nats      []string
	Source    string
}

func NewApp

func NewApp(appName, vip string, vipConfig config.VipConfig, monitors []string, nats []string, source string) (*App, error)

func (*App) Equal

func (a *App) Equal(other *App) bool

func (*App) String added in v1.1.1

func (a *App) String() string

type Client

type Client struct {
	*http.Client
}

type Clienter

type Clienter interface {
	Get(url string) (*http.Response, error)
}

type ConsulMon

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

func NewConsulMon

func NewConsulMon(addr string) (*ConsulMon, error)

type ConsulServiceData

type ConsulServiceData struct {
	Services map[string]struct {
		ID      string
		Service string
		Tags    []string
	}
}

type Controller

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

func NewController

func NewController(config c.BgpConfig) (*Controller, error)

func (*Controller) AddPeer

func (c *Controller) AddPeer(peer string) error

func (*Controller) Announce

func (c *Controller) Announce(route *Route) error

func (*Controller) PeerInfo

func (c *Controller) PeerInfo() (*api.Peer, error)

func (*Controller) Shutdown

func (c *Controller) Shutdown() error

func (*Controller) Withdraw

func (c *Controller) Withdraw(route *Route) error

type Monitor

type Monitor struct {
	Type     MonitorType
	Port     string
	Protocol string
	Cmd      string
}

func (*Monitor) Equal

func (m *Monitor) Equal(other *Monitor) bool

type MonitorMgr

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

MonitorMgr manages the lifecycle of registered apps

func NewMonitor

func NewMonitor(config *c.Config) *MonitorMgr

func (*MonitorMgr) Add

func (m *MonitorMgr) Add(app *App)

Add adds a new app into monitor manager

func (*MonitorMgr) Cleanup

func (m *MonitorMgr) Cleanup(app string, exit chan bool)

CleanUp periodically monitors for stale apps and cleans them up

func (*MonitorMgr) CloseAll

func (m *MonitorMgr) CloseAll()

CloseAll shuts down all BGP sessions removes state

func (*MonitorMgr) GetInfo

func (m *MonitorMgr) GetInfo() (*api.Peer, error)

GetInfo returns basic BGP info for established peers

func (*MonitorMgr) Remove

func (m *MonitorMgr) Remove(appName string)

Remove removes an app from monitor manager, stops BGP / announcement and cleans up state

type MonitorType

type MonitorType int
const (
	Monitor_PORT   MonitorType = 1
	Monitor_EXEC   MonitorType = 2
	Monitor_CONSUL MonitorType = 3
)

func (MonitorType) String

func (m MonitorType) String() string

type Monitors

type Monitors []*Monitor

func (Monitors) Contains

func (m Monitors) Contains(elem *Monitor) bool

type Route added in v1.1.1

type Route struct {
	Net         *net.IPNet
	Communities []string
}

Jump to

Keyboard shortcuts

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