Documentation
¶
Index ¶
- Constants
- Variables
- func IsConnectRejected(err error) bool
- type Cache
- type CircuitError
- type CircuitFailureCause
- type Config
- type CtrlDialerValidator
- type ErtTerminatorValidationCallback
- type ForwardingFaultReport
- type InspectResult
- type InspectResultValue
- type InspectTarget
- type InspectionsManager
- type InvalidCircuitError
- type LinkValidationCallback
- type Network
- func (network *Network) AcceptMetricsMsg(metrics *metrics_pb.MetricsMessage)
- func (network *Network) AddCapability(capability string)
- func (network *Network) AddInspectTarget(target InspectTarget)
- func (network *Network) AddRouterPresenceHandler(h model.RouterPresenceHandler)
- func (network *Network) AllConnectedRouters() []*model.Router
- func (network *Network) CircuitEvent(eventType event.CircuitEventType, circuit *model.Circuit, ...)
- func (network *Network) CircuitFailedEvent(circuitId string, params model.CreateCircuitParams, startTime time.Time, ...)
- func (network *Network) ConnectRouter(r *model.Router) error
- func (network *Network) ConnectedRouter(id string) bool
- func (network *Network) CreateCircuit(params model.CreateCircuitParams) (*model.Circuit, error)
- func (network *Network) CreatePath(srcR, dstR *model.Router) (*model.Path, error)
- func (network *Network) CreatePathWithNodes(nodes []*model.Router) (*model.Path, CircuitError)
- func (network *Network) CreateRouteMessages(path *model.Path, attempt uint32, circuitId string, terminator xt.Terminator, ...) []*ctrl_pb.Route
- func (network *Network) DisconnectRouter(r *model.Router)
- func (network *Network) GetAllCircuits() []*model.Circuit
- func (network *Network) GetAllLinks() []*model.Link
- func (network *Network) GetAllLinksForRouter(routerId string) []*model.Link
- func (network *Network) GetAppId() string
- func (network *Network) GetCapabilities() []string
- func (network *Network) GetCircuit(circuitId string) (*model.Circuit, bool)
- func (network *Network) GetCircuitStore() *objectz.ObjectStore[*model.Circuit]
- func (network *Network) GetCloseNotify() <-chan struct{}
- func (network *Network) GetConnectedRouter(routerId string) *model.Router
- func (network *Network) GetCtrlDialerValidator() CtrlDialerValidator
- func (network *Network) GetDb() boltz.Db
- func (network *Network) GetEventDispatcher() event.Dispatcher
- func (network *Network) GetLink(linkId string) (*model.Link, bool)
- func (network *Network) GetLinkStore() *objectz.ObjectStore[*model.Link]
- func (network *Network) GetMetricsRegistry() metrics.Registry
- func (network *Network) GetOptions() *config.NetworkConfig
- func (network *Network) GetRouter(routerId string) (*model.Router, error)
- func (network *Network) GetServiceEventsMetricsRegistry() metrics.UsageRegistry
- func (network *Network) GetStores() *db.Stores
- func (network *Network) GetTraceController() trace.Controller
- func (self *Network) HandleRouterDelete(id string)
- func (network *Network) InitServiceCounterDispatch(handler metrics.Handler)
- func (network *Network) LinkFaulted(link *model.Link, dupe bool)
- func (network *Network) NewCtrlChanRouter(ch channel.Channel) (*model.Router, error)
- func (network *Network) NotifyExistingLink(srcRouter *model.Router, reportedLink *ctrl_pb.RouterLinks_RouterLink)
- func (network *Network) NotifyLinkEvent(link *model.Link, eventType event.LinkEventType)
- func (network *Network) NotifyLinkIdEvent(linkId string, eventType event.LinkEventType)
- func (network *Network) RemoveCircuit(circuitId string, now bool) error
- func (network *Network) RemoveLink(linkId string)
- func (network *Network) ReportForwardingFaults(ffr *ForwardingFaultReport)
- func (network *Network) RerouteLink(l *model.Link)
- func (network *Network) RestoreSnapshot(cmd *command.SyncSnapshotCommand, index uint64) error
- func (network *Network) RouteResult(rs *RouteStatus) bool
- 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) SetCtrlDialerValidator(validator CtrlDialerValidator)
- func (network *Network) SnapshotDatabase() error
- func (network *Network) SnapshotDatabaseToFile(path string) (string, error)
- func (network *Network) UpdatePath(path *model.Path) (*model.Path, error)
- func (n *Network) ValidateLinks(filter string, cb LinkValidationCallback) (int64, func(), error)
- func (n *Network) ValidateRouterErtTerminators(filter string, cb ErtTerminatorValidationCallback) (int64, func(), error)
- func (network *Network) ValidateRouterLinks(router *model.Router, cb LinkValidationCallback)
- func (n *Network) ValidateRouterSdkTerminators(filter string, cb SdkTerminatorValidationCallback) (int64, func(), error)
- func (network *Network) ValidateTerminators(r *model.Router)
- func (network *Network) VerifyRouter(routerId string, fingerprints []string) error
- type PathAndCost
- type RouteStatus
- type RouterMessaging
- func (self *RouterMessaging) Inspect() (*inspect.RouterMessagingState, error)
- func (self *RouterMessaging) NewValidationResponseHandler(n *Network, r *model.Router) channel.ReceiveHandlerF
- func (self *RouterMessaging) RouterConnected(r *model.Router)
- func (self *RouterMessaging) RouterDeleted(routerId string)
- func (self *RouterMessaging) RouterDisconnected(r *model.Router)
- func (self *RouterMessaging) TerminatorCreated(terminator *db.Terminator)
- func (self *RouterMessaging) ValidateRouterTerminators(terminators []*model.Terminator)
- type SdkTerminatorValidationCallback
- type ServiceCounters
Constants ¶
const SmartRerouteAttempt = 99969996
Variables ¶
var ( // ErrConnectRejected indicates a router connect was rejected because another connection for the same // router is already current. It is returned by ConnectRouter and propagated out of the bind handler so // NewChannel closes the rejected connection's underlay without starting rx or registering it; the // router then redials. ErrConnectRejected = errors.New("router connect rejected: another connection is already current") // ErrConnectChannelClosed indicates a router connect was refused because its control channel was // already closed by the time the connect decision was made, so the connection must not be registered. ErrConnectChannelClosed = errors.New("router connect rejected: control channel already closed") )
var DbSnapshotTooFrequentError = dbSnapshotTooFrequentError{}
Functions ¶
func IsConnectRejected ¶ added in v2.0.4
IsConnectRejected reports whether err is (or wraps) a connect refusal that the router recovers from by redialing, so the accept path can log it at info rather than treating it as a bind failure.
Types ¶
type CircuitError ¶
type CircuitError interface {
error
Cause() CircuitFailureCause
}
type CircuitFailureCause ¶
type CircuitFailureCause string
const ( CircuitFailureInvalidService CircuitFailureCause = "INVALID_SERVICE" CircuitFailureIdGenerationError CircuitFailureCause = "ID_GENERATION_ERR" CircuitFailureNoTerminators CircuitFailureCause = "NO_TERMINATORS" CircuitFailureNoOnlineTerminators CircuitFailureCause = "NO_ONLINE_TERMINATORS" CircuitFailureNoPath CircuitFailureCause = "NO_PATH" CircuitFailurePathMissingLink CircuitFailureCause = "PATH_MISSING_LINK" CircuitFailureInvalidStrategy CircuitFailureCause = "INVALID_STRATEGY" CircuitFailureStrategyError CircuitFailureCause = "STRATEGY_ERR" CircuitFailureRouterResponseTimeout CircuitFailureCause = "ROUTER_RESPONSE_TIMEOUT" CircuitFailureRouterErrGeneric CircuitFailureCause = "ROUTER_ERR_GENERIC" CircuitFailureRouterErrInvalidTerminator CircuitFailureCause = "ROUTER_ERR_INVALID_TERMINATOR" CircuitFailureRouterErrMisconfiguredTerminator CircuitFailureCause = "ROUTER_ERR_MISCONFIGURED_TERMINATOR" CircuitFailureRouterErrDialTimedOut CircuitFailureCause = "ROUTER_ERR_DIAL_TIMED_OUT" CircuitFailureRouterErrDialConnRefused CircuitFailureCause = "ROUTER_ERR_CONN_REFUSED" CircuitFailureRouterErrRejectedByApp CircuitFailureCause = "ROUTER_ERR_REJECTED_BY_APPLICATION" CircuitFailureRouterErrDnsResolutionFailed CircuitFailureCause = "ROUTER_ERR_DNS_RESOLUTION_FAILED" CircuitFailureRouterErrPortNotAllowed CircuitFailureCause = "ROUTER_ERR_PORT_NOT_ALLOWED" CircuitFailureRouterErrInvalidLinkDest CircuitFailureCause = "ROUTER_ERR_INVALID_LINK_DESTINATION" CircuitFailureRouterErrResourcesNotAvailable CircuitFailureCause = "ROUTER_ERR_RESOURCES_NOT_AVAILABLE" )
type Config ¶
type Config interface {
GetId() *identity.TokenId
GetMetricsRegistry() metrics.Registry
GetOptions() *config.NetworkConfig
GetCommandDispatcher() command.Dispatcher
GetDb() boltz.Db
GetVersionProvider() versions.VersionProvider
GetEventDispatcher() event.Dispatcher
GetCloseNotify() <-chan struct{}
}
Config provides the values needed to create a Network instance
type CtrlDialerValidator ¶
type CtrlDialerValidator func() ([]*mgmt_pb.ControllerDialerDetails, error)
CtrlDialerValidator is a function that validates ctrl dialer states and returns per-router details.
type ErtTerminatorValidationCallback ¶
type ErtTerminatorValidationCallback func(detail *mgmt_pb.RouterErtTerminatorsDetails)
type ForwardingFaultReport ¶
type InspectResult ¶
type InspectResult struct {
Success bool
Errors []string
Results []*InspectResultValue
}
type InspectResultValue ¶
type InspectionsManager ¶
type InspectionsManager struct {
// contains filtered or unexported fields
}
func NewInspectionsManager ¶
func NewInspectionsManager(network *Network) *InspectionsManager
func (*InspectionsManager) Inspect ¶
func (self *InspectionsManager) Inspect(appRegex string, values []string) *InspectResult
func (*InspectionsManager) InspectLocal ¶
func (self *InspectionsManager) InspectLocal(values []string) *InspectResult
InspectLocal runs inspect processing only on the local controller, without fanning out to routers or peer controllers.
type InvalidCircuitError ¶
type InvalidCircuitError struct {
// contains filtered or unexported fields
}
func (InvalidCircuitError) Error ¶
func (err InvalidCircuitError) Error() string
type LinkValidationCallback ¶
type LinkValidationCallback func(detail *mgmt_pb.RouterLinkDetails)
type Network ¶
type Network struct {
*model.Managers
VersionProvider versions.VersionProvider
Inspections *InspectionsManager
RouterMessaging *RouterMessaging
// contains filtered or unexported fields
}
func (*Network) AcceptMetricsMsg ¶
func (network *Network) AcceptMetricsMsg(metrics *metrics_pb.MetricsMessage)
func (*Network) AddCapability ¶
func (*Network) AddInspectTarget ¶
func (network *Network) AddInspectTarget(target InspectTarget)
func (*Network) AddRouterPresenceHandler ¶
func (network *Network) AddRouterPresenceHandler(h model.RouterPresenceHandler)
func (*Network) AllConnectedRouters ¶
func (*Network) CircuitEvent ¶
func (*Network) CircuitFailedEvent ¶
func (network *Network) CircuitFailedEvent( circuitId string, params model.CreateCircuitParams, startTime time.Time, path *model.Path, t xt.CostedTerminator, cause CircuitFailureCause)
func (*Network) ConnectRouter ¶
ConnectRouter registers r as the current connection for its router id, serialized per router. If the slot is already held by a different connection it rejects this one (returning ErrConnectRejected) and displaces the occupant so its teardown runs; the router redials into the freed slot. A connection whose channel is already closed is refused outright (ErrConnectChannelClosed) rather than registered. There is at most one connection per router in the connected map at a time.
func (*Network) ConnectedRouter ¶
func (*Network) CreateCircuit ¶
func (*Network) CreatePath ¶
func (*Network) CreatePathWithNodes ¶
func (*Network) CreateRouteMessages ¶
func (*Network) DisconnectRouter ¶
func (*Network) GetAllCircuits ¶
func (*Network) GetAllLinks ¶
func (*Network) GetAllLinksForRouter ¶
func (*Network) GetCapabilities ¶
func (*Network) GetCircuit ¶
func (*Network) GetCircuitStore ¶
func (network *Network) GetCircuitStore() *objectz.ObjectStore[*model.Circuit]
func (*Network) GetCloseNotify ¶
func (network *Network) GetCloseNotify() <-chan struct{}
func (*Network) GetConnectedRouter ¶
func (*Network) GetCtrlDialerValidator ¶
func (network *Network) GetCtrlDialerValidator() CtrlDialerValidator
GetCtrlDialerValidator returns the registered ctrl dialer validation function, or nil.
func (*Network) GetEventDispatcher ¶
func (network *Network) GetEventDispatcher() event.Dispatcher
func (*Network) GetLinkStore ¶
func (network *Network) GetLinkStore() *objectz.ObjectStore[*model.Link]
func (*Network) GetMetricsRegistry ¶
func (*Network) GetOptions ¶
func (network *Network) GetOptions() *config.NetworkConfig
func (*Network) GetServiceEventsMetricsRegistry ¶
func (network *Network) GetServiceEventsMetricsRegistry() metrics.UsageRegistry
func (*Network) GetTraceController ¶
func (network *Network) GetTraceController() trace.Controller
func (*Network) HandleRouterDelete ¶
func (*Network) InitServiceCounterDispatch ¶
func (*Network) NewCtrlChanRouter ¶ added in v2.0.4
NewCtrlChanRouter returns the Router instance representing a new control-channel connection, with the channel recorded on it. Each connection gets its own instance, which is what lets the connect and disconnect paths tell two racing connections for one router apart.
func (*Network) NotifyExistingLink ¶
func (network *Network) NotifyExistingLink(srcRouter *model.Router, reportedLink *ctrl_pb.RouterLinks_RouterLink)
func (*Network) NotifyLinkEvent ¶
func (network *Network) NotifyLinkEvent(link *model.Link, eventType event.LinkEventType)
func (*Network) NotifyLinkIdEvent ¶
func (network *Network) NotifyLinkIdEvent(linkId string, eventType event.LinkEventType)
func (*Network) RemoveCircuit ¶
func (*Network) RemoveLink ¶
func (*Network) ReportForwardingFaults ¶
func (network *Network) ReportForwardingFaults(ffr *ForwardingFaultReport)
func (*Network) RerouteLink ¶
func (*Network) RestoreSnapshot ¶
func (network *Network) RestoreSnapshot(cmd *command.SyncSnapshotCommand, index uint64) error
func (*Network) RouteResult ¶
func (network *Network) RouteResult(rs *RouteStatus) bool
func (*Network) ServiceDialFail ¶
func (*Network) ServiceDialOtherError ¶
func (*Network) ServiceDialSuccess ¶
func (*Network) ServiceDialTimeout ¶
func (*Network) ServiceInvalidTerminator ¶
func (*Network) ServiceMisconfiguredTerminator ¶
func (*Network) ServiceTerminatorConnectionRefused ¶
func (*Network) ServiceTerminatorTimeout ¶
func (*Network) SetCtrlDialerValidator ¶
func (network *Network) SetCtrlDialerValidator(validator CtrlDialerValidator)
SetCtrlDialerValidator registers the ctrl dialer's validation function with the network.
func (*Network) SnapshotDatabase ¶
func (*Network) SnapshotDatabaseToFile ¶
func (*Network) UpdatePath ¶
func (*Network) ValidateLinks ¶
func (n *Network) ValidateLinks(filter string, cb LinkValidationCallback) (int64, func(), error)
func (*Network) ValidateRouterErtTerminators ¶
func (n *Network) ValidateRouterErtTerminators(filter string, cb ErtTerminatorValidationCallback) (int64, func(), error)
func (*Network) ValidateRouterLinks ¶
func (network *Network) ValidateRouterLinks(router *model.Router, cb LinkValidationCallback)
func (*Network) ValidateRouterSdkTerminators ¶
func (n *Network) ValidateRouterSdkTerminators(filter string, cb SdkTerminatorValidationCallback) (int64, func(), error)
func (*Network) ValidateTerminators ¶
type PathAndCost ¶
type PathAndCost struct {
// contains filtered or unexported fields
}
type RouteStatus ¶
type RouterMessaging ¶
type RouterMessaging struct {
// contains filtered or unexported fields
}
func NewRouterMessaging ¶
func NewRouterMessaging(env model.Env, routerCommPool goroutines.Pool) *RouterMessaging
func (*RouterMessaging) Inspect ¶
func (self *RouterMessaging) Inspect() (*inspect.RouterMessagingState, error)
func (*RouterMessaging) NewValidationResponseHandler ¶
func (self *RouterMessaging) NewValidationResponseHandler(n *Network, r *model.Router) channel.ReceiveHandlerF
func (*RouterMessaging) RouterConnected ¶
func (self *RouterMessaging) RouterConnected(r *model.Router)
func (*RouterMessaging) RouterDeleted ¶
func (self *RouterMessaging) RouterDeleted(routerId string)
func (*RouterMessaging) RouterDisconnected ¶
func (self *RouterMessaging) RouterDisconnected(r *model.Router)
func (*RouterMessaging) TerminatorCreated ¶
func (self *RouterMessaging) TerminatorCreated(terminator *db.Terminator)
func (*RouterMessaging) ValidateRouterTerminators ¶
func (self *RouterMessaging) ValidateRouterTerminators(terminators []*model.Terminator)
type SdkTerminatorValidationCallback ¶
type SdkTerminatorValidationCallback func(detail *mgmt_pb.RouterSdkTerminatorsDetails)
type ServiceCounters ¶
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)
}