Documentation ¶
Index ¶
- Constants
- Variables
- type Cache
- type Circuit
- type CircuitEvent
- type CircuitEventHandler
- type CircuitEventType
- type Controller
- type Controllers
- type ForwardingFaultReport
- type InspectResult
- type InspectResultValue
- type InspectionsController
- type InvalidCircuitError
- type Link
- func (link *Link) CurrentState() *LinkState
- func (link *Link) GetCost() int64
- func (link *Link) GetDstLatency() int64
- func (link *Link) GetId() string
- func (link *Link) GetSrcLatency() int64
- func (link *Link) GetStaticCost() int32
- func (link *Link) IsDown() bool
- func (link *Link) IsUsable() bool
- func (link *Link) SetDown(down bool)
- func (link *Link) SetDstLatency(latency int64)
- func (link *Link) SetSrcLatency(latency int64)
- func (link *Link) SetStaticCost(cost int32)
- type LinkMode
- type LinkState
- type Listener
- type Network
- func (network *Network) AcceptMetrics(metrics *metrics_pb.MetricsMessage)
- func (network *Network) AddCapability(capability string)
- func (network *Network) AddRouterPresenceHandler(h RouterPresenceHandler)
- func (network *Network) AllConnectedRouters() []*Router
- func (network *Network) CircuitEvent(eventType CircuitEventType, circuit *Circuit, creationTimespan *time.Duration)
- func (network *Network) ConnectRouter(r *Router)
- func (network *Network) ConnectedRouter(id string) bool
- func (network *Network) CreateCircuit(srcR *Router, clientId *identity.TokenId, service string, ...) (*Circuit, error)
- func (network *Network) CreatePath(srcR, dstR *Router) (*Path, error)
- func (network *Network) CreatePathWithNodes(nodes []*Router) (*Path, error)
- func (network *Network) CreateRouter(router *Router) error
- func (network *Network) DisconnectRouter(r *Router)
- func (network *Network) GetAllCircuits() []*Circuit
- func (network *Network) GetAllLinks() []*Link
- func (network *Network) GetAllLinksForRouter(routerId string) []*Link
- func (network *Network) GetAppId() string
- func (network *Network) GetCapabilities() []string
- func (network *Network) GetCircuit(circuitId string) (*Circuit, bool)
- func (network *Network) GetConnectedRouter(routerId string) *Router
- func (network *Network) GetControllers() *Controllers
- func (network *Network) GetDb() boltz.Db
- func (network *Network) GetEventDispatcher() event.Dispatcher
- func (network *Network) GetLink(linkId string) (*Link, bool)
- func (network *Network) GetMetricsRegistry() metrics.Registry
- func (network *Network) GetOptions() *Options
- func (network *Network) GetRouter(routerId string) (*Router, error)
- func (network *Network) GetServiceEventsMetricsRegistry() metrics.UsageRegistry
- func (network *Network) GetStores() *db.Stores
- func (network *Network) GetTraceController() trace.Controller
- func (network *Network) InitServiceCounterDispatch(handler metrics.Handler)
- func (network *Network) Inspect(name string) *string
- func (network *Network) LinkChanged(l *Link)
- func (network *Network) LinkConnected(id string, connected bool) error
- func (network *Network) NotifyExistingLink(id, linkProtocol string, srcRouter *Router, dstRouterId string) (bool, error)
- func (network *Network) RemoveCircuit(circuitId string, now bool) error
- func (network *Network) ReportForwardingFaults(ffr *ForwardingFaultReport)
- func (network *Network) RouteResult(rs *RouteStatus) bool
- func (network *Network) RouterChanged(r *Router)
- func (network *Network) Run()
- func (network *Network) ServiceDialFail(serviceId, terminatorId string)
- func (network *Network) ServiceDialOtherError(serviceId string)
- func (network *Network) ServiceDialSuccess(serviceId, terminatorId string)
- func (network *Network) ServiceDialTimeout(serviceId, terminatorId string)
- func (network *Network) ServiceInvalidTerminator(serviceId, terminatorId string)
- func (network *Network) ServiceMisconfiguredTerminator(serviceId, terminatorId string)
- func (network *Network) ServiceTerminatorConnectionRefused(serviceId, terminatorId string)
- func (network *Network) ServiceTerminatorTimeout(serviceId, terminatorId string)
- func (network *Network) SnapshotDatabase() error
- func (network *Network) UpdatePath(path *Path) (*Path, error)
- func (network *Network) ValidateTerminators(r *Router)
- func (network *Network) VerifyLinkSource(targetRouter *Router, linkId string, fingerprints []string) error
- type Options
- type Path
- type PathAndCost
- type RouteStatus
- type Router
- type RouterController
- func (ctrl *RouterController) BaseList(query string) (*models.EntityListResult, error)
- func (ctrl *RouterController) BaseLoad(id string) (models.Entity, error)
- func (ctrl *RouterController) BaseLoadInTx(tx *bbolt.Tx, id string) (models.Entity, error)
- func (ctrl *RouterController) BasePreparedList(query ast.Query) (*models.EntityListResult, error)
- func (ctrl *RouterController) BasePreparedListAssociated(id string, typeLoader models.EntityRetriever, query ast.Query) (*models.EntityListResult, error)
- func (ctrl *RouterController) Create(router *Router) error
- func (ctrl *RouterController) Delete(id string) error
- func (ctrl *RouterController) HandleRouterDelete(id string)
- func (ctrl *RouterController) IsConnected(id string) bool
- func (ctrl *RouterController) Patch(r *Router, checker boltz.FieldChecker) error
- func (ctrl *RouterController) Read(id string) (entity *Router, err error)
- func (ctrl *RouterController) Update(r *Router) error
- func (ctrl *RouterController) UpdateCachedRouter(id string)
- type RouterLinks
- type RouterPresenceHandler
- type RoutingTerminator
- type Service
- type ServiceController
- func (ctrl *ServiceController) BaseList(query string) (*models.EntityListResult, error)
- func (ctrl *ServiceController) BaseLoad(id string) (models.Entity, error)
- func (ctrl *ServiceController) BaseLoadInTx(tx *bbolt.Tx, id string) (models.Entity, error)
- func (ctrl *ServiceController) BasePreparedList(query ast.Query) (*models.EntityListResult, error)
- func (ctrl *ServiceController) BasePreparedListAssociated(id string, typeLoader models.EntityRetriever, query ast.Query) (*models.EntityListResult, error)
- func (ctrl *ServiceController) Create(s *Service) error
- func (ctrl *ServiceController) Delete(id string) error
- func (ctrl *ServiceController) GetIdForName(id string) (string, error)
- func (ctrl *ServiceController) NotifyTerminatorChanged(terminator *db.Terminator) *db.Terminator
- func (ctrl *ServiceController) Patch(s *Service, checker boltz.FieldChecker) error
- func (ctrl *ServiceController) Read(id string) (entity *Service, err error)
- func (ctrl *ServiceController) RemoveFromCache(id string)
- func (ctrl *ServiceController) Update(s *Service) error
- type ServiceCounters
- type Terminator
- func (entity *Terminator) GetAddress() string
- func (entity *Terminator) GetBinding() string
- func (entity *Terminator) GetCost() uint16
- func (entity *Terminator) GetIdentity() string
- func (entity *Terminator) GetIdentitySecret() []byte
- func (entity *Terminator) GetPeerData() xt.PeerData
- func (entity *Terminator) GetPrecedence() xt.Precedence
- func (entity *Terminator) GetRouterId() string
- func (entity *Terminator) GetServiceId() string
- type TerminatorController
- func (ctrl *TerminatorController) BaseList(query string) (*models.EntityListResult, error)
- func (ctrl *TerminatorController) BaseLoad(id string) (models.Entity, error)
- func (ctrl *TerminatorController) BaseLoadInTx(tx *bbolt.Tx, id string) (models.Entity, error)
- func (ctrl *TerminatorController) BasePreparedList(query ast.Query) (*models.EntityListResult, error)
- func (ctrl *TerminatorController) BasePreparedListAssociated(id string, typeLoader models.EntityRetriever, query ast.Query) (*models.EntityListResult, error)
- func (ctrl *TerminatorController) Create(s *Terminator) (string, error)
- func (ctrl *TerminatorController) CreateInTx(ctx boltz.MutateContext, terminator *Terminator) (string, error)
- func (ctrl *TerminatorController) Delete(id string) error
- func (ctrl *TerminatorController) Patch(terminator *Terminator, checker boltz.FieldChecker) error
- func (ctrl *TerminatorController) Query(query string) (*TerminatorListResult, error)
- func (ctrl *TerminatorController) Read(id string) (entity *Terminator, err error)
- func (ctrl *TerminatorController) Update(terminator *Terminator) error
- type TerminatorListResult
Constants ¶
View Source
const ( DefaultNetworkOptionsCycleSeconds = 60 DefaultNetworkOptionsRouteTimeout = 10 * time.Second DefaultNetworkOptionsCreateCircuitRetries = 2 DefaultNetworkOptionsCtrlChanLatencyInterval = 10 * time.Second DefaultNetworkOptionsPendingLinkTimeout = 10 * time.Second DefaultNetworkOptionsSmartRerouteFraction = 0.02 DefaultNetworkOptionsSmartRerouteCap = 4 )
View Source
const SmartRerouteAttempt = 99969996
Variables ¶
View Source
var CircuitEventHandlerRegistry = cowslice.NewCowSlice(make([]CircuitEventHandler, 0))
View Source
var CircuitTypes = []CircuitEventType{CircuitCreated, CircuitUpdated, CircuitDeleted}
View Source
var DbSnapshotTooFrequentError = dbSnapshotTooFrequentError{}
Functions ¶
This section is empty.
Types ¶
type Circuit ¶
type Circuit struct { Id string ClientId string Service *Service Terminator xt.Terminator Path *Path Rerouting concurrenz.AtomicBoolean PeerData xt.PeerData }
type CircuitEvent ¶ added in v0.17.45
type CircuitEvent struct { Type CircuitEventType CircuitId string ClientId string ServiceId string CreationTimespan *time.Duration Path *Path }
func (*CircuitEvent) Handle ¶ added in v0.17.45
func (event *CircuitEvent) Handle()
type CircuitEventHandler ¶ added in v0.16.92
type CircuitEventHandler interface {
AcceptCircuitEvent(event *CircuitEvent)
}
type CircuitEventType ¶ added in v0.17.45
type CircuitEventType int
const ( CircuitCreated CircuitEventType = 1 CircuitUpdated CircuitEventType = 2 CircuitDeleted CircuitEventType = 3 )
func (CircuitEventType) String ¶ added in v0.17.45
func (self CircuitEventType) String() string
type Controller ¶
type Controller interface { models.EntityRetriever // contains filtered or unexported methods }
type Controllers ¶
type Controllers struct { Terminators *TerminatorController Routers *RouterController Services *ServiceController Inspections *InspectionsController // contains filtered or unexported fields }
func NewControllers ¶
func NewControllers(db boltz.Db, stores *db.Stores) *Controllers
type ForwardingFaultReport ¶ added in v0.15.24
type InspectResult ¶ added in v0.17.9
type InspectResult struct { Success bool Errors []string Results []*InspectResultValue }
type InspectResultValue ¶ added in v0.17.9
type InspectionsController ¶ added in v0.17.9
type InspectionsController struct {
// contains filtered or unexported fields
}
func (*InspectionsController) Inspect ¶ added in v0.17.9
func (self *InspectionsController) Inspect(appRegex string, values []string) *InspectResult
type InvalidCircuitError ¶ added in v0.16.92
type InvalidCircuitError struct {
// contains filtered or unexported fields
}
func (InvalidCircuitError) Error ¶ added in v0.16.92
func (err InvalidCircuitError) Error() string
type Link ¶
type Link struct { Id string Src *Router Dst *Router Protocol string StaticCost int32 SrcLatency int64 DstLatency int64 Cost int64 // contains filtered or unexported fields }
func (*Link) CurrentState ¶
func (*Link) GetDstLatency ¶ added in v0.13.0
func (*Link) GetSrcLatency ¶ added in v0.13.0
func (*Link) GetStaticCost ¶ added in v0.13.0
func (*Link) SetDstLatency ¶ added in v0.13.0
func (*Link) SetSrcLatency ¶ added in v0.13.0
func (*Link) SetStaticCost ¶ added in v0.13.0
type Network ¶
type Network struct { *Controllers VersionProvider common.VersionProvider // contains filtered or unexported fields }
func NewNetwork ¶
func (*Network) AcceptMetrics ¶
func (network *Network) AcceptMetrics(metrics *metrics_pb.MetricsMessage)
func (*Network) AddCapability ¶
func (*Network) AddRouterPresenceHandler ¶
func (network *Network) AddRouterPresenceHandler(h RouterPresenceHandler)
func (*Network) AllConnectedRouters ¶
func (*Network) CircuitEvent ¶ added in v0.17.45
func (network *Network) CircuitEvent(eventType CircuitEventType, circuit *Circuit, creationTimespan *time.Duration)
func (*Network) ConnectRouter ¶
func (*Network) ConnectedRouter ¶
func (*Network) CreateCircuit ¶
func (*Network) CreatePath ¶ added in v0.16.92
func (*Network) CreatePathWithNodes ¶ added in v0.16.92
func (*Network) CreateRouter ¶
func (*Network) DisconnectRouter ¶
func (*Network) GetAllCircuits ¶ added in v0.16.92
func (*Network) GetAllLinks ¶
func (*Network) GetAllLinksForRouter ¶
func (*Network) GetCapabilities ¶
func (*Network) GetCircuit ¶ added in v0.16.92
func (*Network) GetConnectedRouter ¶
func (*Network) GetControllers ¶
func (network *Network) GetControllers() *Controllers
func (*Network) GetEventDispatcher ¶ added in v0.12.1
func (network *Network) GetEventDispatcher() event.Dispatcher
func (*Network) GetMetricsRegistry ¶ added in v0.12.3
func (*Network) GetOptions ¶ added in v0.15.18
func (*Network) GetServiceEventsMetricsRegistry ¶ added in v0.16.41
func (network *Network) GetServiceEventsMetricsRegistry() metrics.UsageRegistry
func (*Network) GetTraceController ¶
func (network *Network) GetTraceController() trace.Controller
func (*Network) InitServiceCounterDispatch ¶ added in v0.16.23
func (*Network) LinkChanged ¶
func (*Network) LinkConnected ¶
func (*Network) NotifyExistingLink ¶ added in v0.17.60
func (*Network) RemoveCircuit ¶ added in v0.16.92
func (*Network) ReportForwardingFaults ¶ added in v0.15.24
func (network *Network) ReportForwardingFaults(ffr *ForwardingFaultReport)
func (*Network) RouteResult ¶ added in v0.16.0
func (network *Network) RouteResult(rs *RouteStatus) bool
func (*Network) RouterChanged ¶
func (*Network) ServiceDialFail ¶ added in v0.16.23
func (*Network) ServiceDialOtherError ¶ added in v0.16.23
func (*Network) ServiceDialSuccess ¶ added in v0.16.23
func (*Network) ServiceDialTimeout ¶ added in v0.16.23
func (*Network) ServiceInvalidTerminator ¶ added in v0.17.76
func (*Network) ServiceMisconfiguredTerminator ¶ added in v0.17.76
func (*Network) ServiceTerminatorConnectionRefused ¶ added in v0.17.76
func (*Network) ServiceTerminatorTimeout ¶ added in v0.17.76
func (*Network) SnapshotDatabase ¶ added in v0.11.40
func (*Network) UpdatePath ¶ added in v0.16.92
func (*Network) ValidateTerminators ¶
type Options ¶
type Options struct { CycleSeconds uint32 Smart struct { RerouteFraction float32 RerouteCap uint32 } RouteTimeout time.Duration CreateCircuitRetries uint32 CtrlChanLatencyInterval time.Duration PendingLinkTimeout time.Duration }
func DefaultOptions ¶
func DefaultOptions() *Options
func LoadOptions ¶
type Path ¶ added in v0.16.92
type Path struct { Nodes []*Router Links []*Link IngressId string EgressId string TerminatorLocalAddr string }
func (*Path) CreateRouteMessages ¶ added in v0.16.92
func (*Path) EgressRouter ¶ added in v0.16.92
type PathAndCost ¶
type PathAndCost struct {
// contains filtered or unexported fields
}
type RouteStatus ¶ added in v0.17.76
type Router ¶
type Router struct { models.BaseEntity Name string Fingerprint *string Listeners []Listener Control channel.Channel Connected concurrenz.AtomicBoolean VersionInfo *common.VersionInfo Cost uint16 NoTraversal bool // contains filtered or unexported fields }
func (*Router) AddLinkListener ¶ added in v0.17.60
type RouterController ¶
type RouterController struct {
// contains filtered or unexported fields
}
func (*RouterController) BaseList ¶
func (ctrl *RouterController) BaseList(query string) (*models.EntityListResult, error)
func (*RouterController) BaseLoadInTx ¶
func (*RouterController) BasePreparedList ¶
func (ctrl *RouterController) BasePreparedList(query ast.Query) (*models.EntityListResult, error)
func (*RouterController) BasePreparedListAssociated ¶
func (ctrl *RouterController) BasePreparedListAssociated(id string, typeLoader models.EntityRetriever, query ast.Query) (*models.EntityListResult, error)
func (*RouterController) Create ¶
func (ctrl *RouterController) Create(router *Router) error
func (*RouterController) Delete ¶
func (ctrl *RouterController) Delete(id string) error
func (*RouterController) HandleRouterDelete ¶ added in v0.17.42
func (ctrl *RouterController) HandleRouterDelete(id string)
func (*RouterController) IsConnected ¶
func (ctrl *RouterController) IsConnected(id string) bool
func (*RouterController) Patch ¶ added in v0.17.0
func (ctrl *RouterController) Patch(r *Router, checker boltz.FieldChecker) error
func (*RouterController) Read ¶
func (ctrl *RouterController) Read(id string) (entity *Router, err error)
func (*RouterController) Update ¶ added in v0.17.0
func (ctrl *RouterController) Update(r *Router) error
func (*RouterController) UpdateCachedRouter ¶ added in v0.17.42
func (ctrl *RouterController) UpdateCachedRouter(id string)
type RouterLinks ¶ added in v0.16.133
func (*RouterLinks) Add ¶ added in v0.16.133
func (self *RouterLinks) Add(link *Link, other *Router)
func (*RouterLinks) Clear ¶ added in v0.16.133
func (self *RouterLinks) Clear()
func (*RouterLinks) GetLinks ¶ added in v0.16.133
func (self *RouterLinks) GetLinks() []*Link
func (*RouterLinks) GetLinksByRouter ¶ added in v0.16.134
func (self *RouterLinks) GetLinksByRouter() map[string][]*Link
func (*RouterLinks) Remove ¶ added in v0.16.133
func (self *RouterLinks) Remove(link *Link, other *Router)
type RouterPresenceHandler ¶
type RoutingTerminator ¶
type RoutingTerminator struct { RouteCost uint32 *Terminator }
func (*RoutingTerminator) GetRouteCost ¶
func (r *RoutingTerminator) GetRouteCost() uint32
type Service ¶
type Service struct { models.BaseEntity Name string TerminatorStrategy string Terminators []*Terminator }
type ServiceController ¶
type ServiceController struct {
// contains filtered or unexported fields
}
func (*ServiceController) BaseList ¶
func (ctrl *ServiceController) BaseList(query string) (*models.EntityListResult, error)
func (*ServiceController) BaseLoadInTx ¶
func (*ServiceController) BasePreparedList ¶
func (ctrl *ServiceController) BasePreparedList(query ast.Query) (*models.EntityListResult, error)
func (*ServiceController) BasePreparedListAssociated ¶
func (ctrl *ServiceController) BasePreparedListAssociated(id string, typeLoader models.EntityRetriever, query ast.Query) (*models.EntityListResult, error)
func (*ServiceController) Create ¶
func (ctrl *ServiceController) Create(s *Service) error
func (*ServiceController) Delete ¶
func (ctrl *ServiceController) Delete(id string) error
func (*ServiceController) GetIdForName ¶ added in v0.17.51
func (ctrl *ServiceController) GetIdForName(id string) (string, error)
func (*ServiceController) NotifyTerminatorChanged ¶ added in v0.15.6
func (ctrl *ServiceController) NotifyTerminatorChanged(terminator *db.Terminator) *db.Terminator
func (*ServiceController) Patch ¶ added in v0.17.0
func (ctrl *ServiceController) Patch(s *Service, checker boltz.FieldChecker) error
func (*ServiceController) Read ¶
func (ctrl *ServiceController) Read(id string) (entity *Service, err error)
func (*ServiceController) RemoveFromCache ¶
func (ctrl *ServiceController) RemoveFromCache(id string)
func (*ServiceController) Update ¶
func (ctrl *ServiceController) Update(s *Service) error
type ServiceCounters ¶ added in v0.16.23
type ServiceCounters interface { ServiceDialSuccess(serviceId, terminatorId string) ServiceDialFail(serviceId, terminatorId string) ServiceDialTimeout(serviceId, terminatorId string) ServiceDialOtherError(serviceId string) ServiceTerminatorTimeout(serviceId, terminatorId string) ServiceTerminatorConnectionRefused(serviceId, terminatorId string) ServiceInvalidTerminator(serviceId, terminatorId string) ServiceMisconfiguredTerminator(serviceId, terminatorId string) }
type Terminator ¶
type Terminator struct { models.BaseEntity Service string Router string Binding string Address string Identity string IdentitySecret []byte Cost uint16 Precedence xt.Precedence PeerData map[uint32][]byte }
func (*Terminator) GetAddress ¶
func (entity *Terminator) GetAddress() string
func (*Terminator) GetBinding ¶
func (entity *Terminator) GetBinding() string
func (*Terminator) GetCost ¶
func (entity *Terminator) GetCost() uint16
func (*Terminator) GetIdentity ¶ added in v0.14.0
func (entity *Terminator) GetIdentity() string
func (*Terminator) GetIdentitySecret ¶ added in v0.14.0
func (entity *Terminator) GetIdentitySecret() []byte
func (*Terminator) GetPeerData ¶
func (entity *Terminator) GetPeerData() xt.PeerData
func (*Terminator) GetPrecedence ¶ added in v0.13.0
func (entity *Terminator) GetPrecedence() xt.Precedence
func (*Terminator) GetRouterId ¶
func (entity *Terminator) GetRouterId() string
func (*Terminator) GetServiceId ¶
func (entity *Terminator) GetServiceId() string
type TerminatorController ¶
type TerminatorController struct {
// contains filtered or unexported fields
}
func (*TerminatorController) BaseList ¶
func (ctrl *TerminatorController) BaseList(query string) (*models.EntityListResult, error)
func (*TerminatorController) BaseLoadInTx ¶
func (*TerminatorController) BasePreparedList ¶
func (ctrl *TerminatorController) BasePreparedList(query ast.Query) (*models.EntityListResult, error)
func (*TerminatorController) BasePreparedListAssociated ¶
func (ctrl *TerminatorController) BasePreparedListAssociated(id string, typeLoader models.EntityRetriever, query ast.Query) (*models.EntityListResult, error)
func (*TerminatorController) Create ¶
func (ctrl *TerminatorController) Create(s *Terminator) (string, error)
func (*TerminatorController) CreateInTx ¶ added in v0.16.58
func (ctrl *TerminatorController) CreateInTx(ctx boltz.MutateContext, terminator *Terminator) (string, error)
func (*TerminatorController) Delete ¶
func (ctrl *TerminatorController) Delete(id string) error
func (*TerminatorController) Patch ¶
func (ctrl *TerminatorController) Patch(terminator *Terminator, checker boltz.FieldChecker) error
func (*TerminatorController) Query ¶
func (ctrl *TerminatorController) Query(query string) (*TerminatorListResult, error)
func (*TerminatorController) Read ¶
func (ctrl *TerminatorController) Read(id string) (entity *Terminator, err error)
func (*TerminatorController) Update ¶
func (ctrl *TerminatorController) Update(terminator *Terminator) error
type TerminatorListResult ¶
type TerminatorListResult struct { Entities []*Terminator models.QueryMetaData // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.