segreq

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package segreq contains everything that is needed to handle segment requests in the path server. It relies on the segfetcher module and therefore has many helper types to use the segfetcher module.

Index

Constants

View Source
const ErrNoConnectivity common.ErrMsg = "no connectivity to remote PS"

ErrNoConnectivity indicates that connectivity to the remote PS is not available.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(args handlers.HandlerArgs) infra.Handler

Types

type BaseValidator

type BaseValidator struct {
	CoreChecker
}

BaseValidator is the base validation for all PSes.

func (*BaseValidator) Validate

func (v *BaseValidator) Validate(ctx context.Context, r segfetcher.Request) error

Validate validates the request.

type CoreChecker

type CoreChecker struct {
	Inspector infra.ASInspector
}

CoreChecker checks whether a given ia is core.

func (*CoreChecker) IsCore

func (c *CoreChecker) IsCore(ctx context.Context, ia addr.IA) (bool, error)

type CoreLocalInfo

type CoreLocalInfo struct {
	CoreChecker CoreChecker
	LocalIA     addr.IA
}

CoreLocalInfo implements local info for core PSes.

func (*CoreLocalInfo) IsParamsLocal

func (i *CoreLocalInfo) IsParamsLocal(params *query.Params) bool

IsParamsLocal returns whether params is a core segment request.

func (*CoreLocalInfo) IsSegLocal

func (i *CoreLocalInfo) IsSegLocal(ctx context.Context, src, dst addr.IA) (bool, error)

IsSegLocal returns whether the segments described by src and dst would be a core segments or a local down segment.

type CoreValidator

type CoreValidator struct {
	BaseValidator
}

CoreValidator is the validator for core PSes.

func (*CoreValidator) Validate

func (v *CoreValidator) Validate(ctx context.Context, r segfetcher.Request) error

Validate validates the request.

type LocalInfo

type LocalInfo interface {
	IsSegLocal(ctx context.Context, src, dst addr.IA) (bool, error)
	IsParamsLocal(*query.Params) bool
}

LocalInfo indicates whether something is always local.

type NonCoreLocalInfo

type NonCoreLocalInfo struct {
	LocalIA addr.IA
}

NonCoreLocalInfo is the local info for non core PSes.

func (*NonCoreLocalInfo) IsParamsLocal

func (i *NonCoreLocalInfo) IsParamsLocal(params *query.Params) bool

IsParamsLocal returns whether params is a up segments request.

func (*NonCoreLocalInfo) IsSegLocal

func (i *NonCoreLocalInfo) IsSegLocal(ctx context.Context, src, dst addr.IA) (bool, error)

IsSegLocal checks if the segment described by src and dst is an up segment to the local core.

type PathDB

type PathDB struct {
	pathdb.PathDB
	LocalInfo  LocalInfo
	RetrySleep time.Duration
}

PathDB is a wrapper around the path db that handles retries and changes GetNextQuery behavior for usage in segfetcher.

func (*PathDB) Get

func (db *PathDB) Get(ctx context.Context, params *query.Params) (query.Results, error)

Get implements the path db's get function. It retries the underlying connection for local segments. For example a non-core path server will retry for local up segments since there is a chance it will receive them from the beacon server. A core path server will retry on core segments since there is a chance it receives them from the beacon server.

func (*PathDB) GetNextQuery

func (db *PathDB) GetNextQuery(ctx context.Context, src, dst addr.IA,
	policy pathdb.PolicyHash) (time.Time, error)

type SegSelector

type SegSelector struct {
	PathDB   pathdb.PathDB
	RevCache revcache.RevCache
}

SegSelector selects segments to use for a connection to a remote server.

func (*SegSelector) SelectSeg

func (s *SegSelector) SelectSeg(ctx context.Context,
	params *query.Params) (*seg.PathSegment, error)

SelectSeg selects a suitable segment for the given path db query.

type Splitter

type Splitter struct {
	ASInspector infra.ASInspector
}

Splitter splits requests for the PS.

func (*Splitter) Split

Directories

Path Synopsis
Package mock_segreq is a generated GoMock package.
Package mock_segreq is a generated GoMock package.

Jump to

Keyboard shortcuts

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