network

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: Apache-2.0 Imports: 52 Imported by: 1

Documentation

Index

Constants

View Source
const SmartRerouteAttempt = 99969996

Variables

View Source
var DbSnapshotTooFrequentError = dbSnapshotTooFrequentError{}

Functions

This section is empty.

Types

type Cache

type Cache interface {
	RemoveFromCache(id string)
}

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"
)

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 ForwardingFaultReport

type ForwardingFaultReport struct {
	R            *model.Router
	CircuitIds   []string
	UnknownOwner bool
}

type InspectResult

type InspectResult struct {
	Success bool
	Errors  []string
	Results []*InspectResultValue
}

type InspectResultValue

type InspectResultValue struct {
	AppId string
	Name  string
	Value string
}

type InspectTarget added in v1.1.1

type InspectTarget func(string) (bool, *string, error)

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

type InvalidCircuitError

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

func (InvalidCircuitError) Error

func (err InvalidCircuitError) Error() string

type LinkValidationCallback added in v0.32.0

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 NewNetwork

func NewNetwork(config Config, env model.Env) (*Network, error)

func (*Network) AcceptMetricsMsg

func (network *Network) AcceptMetricsMsg(metrics *metrics_pb.MetricsMessage)

func (*Network) AddCapability

func (network *Network) AddCapability(capability string)

func (*Network) AddInspectTarget added in v1.1.1

func (network *Network) AddInspectTarget(target InspectTarget)

func (*Network) AddRouterPresenceHandler

func (network *Network) AddRouterPresenceHandler(h RouterPresenceHandler)

func (*Network) AllConnectedRouters

func (network *Network) AllConnectedRouters() []*model.Router

func (*Network) CircuitEvent

func (network *Network) CircuitEvent(eventType event.CircuitEventType, circuit *model.Circuit, creationTimespan *time.Duration)

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

func (network *Network) ConnectRouter(r *model.Router)

func (*Network) ConnectedRouter

func (network *Network) ConnectedRouter(id string) bool

func (*Network) CreateCircuit

func (network *Network) CreateCircuit(params model.CreateCircuitParams) (*model.Circuit, error)

func (*Network) CreatePath

func (network *Network) CreatePath(srcR, dstR *model.Router) (*model.Path, error)

func (*Network) CreatePathWithNodes

func (network *Network) CreatePathWithNodes(nodes []*model.Router) (*model.Path, CircuitError)

func (*Network) CreateRouteMessages added in v1.1.6

func (network *Network) CreateRouteMessages(path *model.Path, attempt uint32, circuitId string, terminator xt.Terminator, deadline time.Time) []*ctrl_pb.Route

func (*Network) DisconnectRouter

func (network *Network) DisconnectRouter(r *model.Router)

func (*Network) GetAllCircuits

func (network *Network) GetAllCircuits() []*model.Circuit
func (network *Network) GetAllLinks() []*model.Link

func (*Network) GetAllLinksForRouter

func (network *Network) GetAllLinksForRouter(routerId string) []*model.Link

func (*Network) GetAppId

func (network *Network) GetAppId() string

func (*Network) GetCapabilities

func (network *Network) GetCapabilities() []string

func (*Network) GetCircuit

func (network *Network) GetCircuit(circuitId string) (*model.Circuit, bool)

func (*Network) GetCircuitStore added in v0.31.1

func (network *Network) GetCircuitStore() *objectz.ObjectStore[*model.Circuit]

func (*Network) GetCloseNotify

func (network *Network) GetCloseNotify() <-chan struct{}

func (*Network) GetConnectedRouter

func (network *Network) GetConnectedRouter(routerId string) *model.Router

func (*Network) GetDb

func (network *Network) GetDb() boltz.Db

func (*Network) GetEventDispatcher

func (network *Network) GetEventDispatcher() event.Dispatcher
func (network *Network) GetLink(linkId string) (*model.Link, bool)

func (*Network) GetLinkStore added in v0.31.1

func (network *Network) GetLinkStore() *objectz.ObjectStore[*model.Link]

func (*Network) GetMetricsRegistry

func (network *Network) GetMetricsRegistry() metrics.Registry

func (*Network) GetOptions

func (network *Network) GetOptions() *config.NetworkConfig

func (*Network) GetReloadedRouter

func (network *Network) GetReloadedRouter(routerId string) (*model.Router, error)

func (*Network) GetRouter

func (network *Network) GetRouter(routerId string) (*model.Router, error)

func (*Network) GetServiceEventsMetricsRegistry

func (network *Network) GetServiceEventsMetricsRegistry() metrics.UsageRegistry

func (*Network) GetStores

func (network *Network) GetStores() *db.Stores

func (*Network) GetTraceController

func (network *Network) GetTraceController() trace.Controller

func (*Network) HandleRouterDelete added in v1.1.6

func (self *Network) HandleRouterDelete(id string)

func (*Network) InitServiceCounterDispatch

func (network *Network) InitServiceCounterDispatch(handler metrics.Handler)

func (*Network) Inspect

func (network *Network) Inspect(name string) (*string, error)

func (*Network) LinkConnected

func (network *Network) LinkConnected(msg *ctrl_pb.LinkConnected) error

func (*Network) LinkFaulted

func (network *Network) LinkFaulted(l *model.Link, dupe bool) error
func (network *Network) NotifyExistingLink(id string, iteration uint32, linkProtocol, dialAddress string, srcRouter *model.Router, dstRouterId string)

func (*Network) NotifyLinkConnected

func (network *Network) NotifyLinkConnected(link *model.Link, msg *ctrl_pb.LinkConnected)

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 *Network) RemoveCircuit(circuitId string, now bool) error
func (network *Network) RemoveLink(linkId string)

func (*Network) ReportForwardingFaults

func (network *Network) ReportForwardingFaults(ffr *ForwardingFaultReport)
func (network *Network) RerouteLink(l *model.Link)

func (*Network) RestoreSnapshot

func (network *Network) RestoreSnapshot(cmd *command.SyncSnapshotCommand) error

func (*Network) RouteResult

func (network *Network) RouteResult(rs *RouteStatus) bool

func (*Network) Run

func (network *Network) Run()

func (*Network) ServiceDialFail

func (network *Network) ServiceDialFail(serviceId, terminatorId string)

func (*Network) ServiceDialOtherError

func (network *Network) ServiceDialOtherError(serviceId string)

func (*Network) ServiceDialSuccess

func (network *Network) ServiceDialSuccess(serviceId, terminatorId string)

func (*Network) ServiceDialTimeout

func (network *Network) ServiceDialTimeout(serviceId, terminatorId string)

func (*Network) ServiceInvalidTerminator

func (network *Network) ServiceInvalidTerminator(serviceId, terminatorId string)

func (*Network) ServiceMisconfiguredTerminator

func (network *Network) ServiceMisconfiguredTerminator(serviceId, terminatorId string)

func (*Network) ServiceTerminatorConnectionRefused

func (network *Network) ServiceTerminatorConnectionRefused(serviceId, terminatorId string)

func (*Network) ServiceTerminatorTimeout

func (network *Network) ServiceTerminatorTimeout(serviceId, terminatorId string)

func (*Network) SnapshotDatabase

func (network *Network) SnapshotDatabase() error

func (*Network) SnapshotDatabaseToFile

func (network *Network) SnapshotDatabaseToFile(path string) (string, error)

func (*Network) SnapshotToRaft

func (network *Network) SnapshotToRaft() error

func (*Network) UpdatePath

func (network *Network) UpdatePath(path *model.Path) (*model.Path, error)
func (n *Network) ValidateLinks(filter string, cb LinkValidationCallback) (int64, func(), error)
func (network *Network) ValidateRouterLinks(router *model.Router, cb LinkValidationCallback)

func (*Network) ValidateRouterSdkTerminators added in v0.33.0

func (n *Network) ValidateRouterSdkTerminators(filter string, cb SdkTerminatorValidationCallback) (int64, func(), error)

func (*Network) ValidateTerminators

func (network *Network) ValidateTerminators(r *model.Router)

func (*Network) VerifyRouter

func (network *Network) VerifyRouter(routerId string, fingerprints []string) error

type PathAndCost

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

type RouteStatus

type RouteStatus struct {
	Router    *model.Router
	CircuitId string
	Attempt   uint32
	Success   bool
	Err       string
	PeerData  xt.PeerData
	ErrorCode *byte
}

type RouterMessaging

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

func NewRouterMessaging

func NewRouterMessaging(env model.Env, routerCommPool goroutines.Pool) *RouterMessaging

func (*RouterMessaging) Inspect added in v0.33.0

func (self *RouterMessaging) Inspect() (*inspect.RouterMessagingState, error)

func (*RouterMessaging) NewValidationResponseHandler added in v0.33.0

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 added in v0.33.0

func (self *RouterMessaging) TerminatorCreated(terminator *db.Terminator)

func (*RouterMessaging) ValidateRouterTerminators added in v0.33.0

func (self *RouterMessaging) ValidateRouterTerminators(terminators []*model.Terminator)

type RouterPresenceHandler

type RouterPresenceHandler interface {
	RouterConnected(r *model.Router)
	RouterDisconnected(r *model.Router)
}

type SdkTerminatorValidationCallback added in v0.33.0

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)
}

Jump to

Keyboard shortcuts

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