infra

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PromSrcASLocal   = "as_local"
	PromSrcISDLocal  = "isd_local"
	PromSrcISDRemote = "isd_remote"
	PromSrcUnknown   = "unknown"
)
View Source
const (
	// DefaultRPCTimeout is the default silent time SCION RPC Clients will wait
	// for before declaring a timeout. Most RPCs will be subject to an
	// additional context, and the timeout will be the minimum value allowed by
	// the context and this timeout. RPC clients are free to use a different
	// timeout if they have special requirements.
	DefaultRPCTimeout time.Duration = 10 * time.Second
)

Variables

View Source
var (
	MetricsErrInternal = &HandlerResult{Result: "err_internal", Status: prom.StatusErr}
	MetricsErrInvalid  = &HandlerResult{Result: "err_invalid_req", Status: prom.StatusErr}

	MetricsResultOk = &HandlerResult{Result: prom.Success, Status: prom.StatusOk}
)

Functions

func NewContextWithResponseWriter added in v0.4.0

func NewContextWithResponseWriter(ctx context.Context, rw ResponseWriter) context.Context

Types

type Error added in v0.4.0

type Error struct {
	Message *ack.Ack
}

func (*Error) Error added in v0.4.0

func (e *Error) Error() string

type Handler

type Handler interface {
	Handle(*Request) *HandlerResult
}

Handler is implemented by objects that can handle a request coming from a remote SCION network node.

type HandlerFunc

type HandlerFunc func(r *Request) *HandlerResult

Constructs a handler for request r. Handle() can be called on the resulting object to process the message.

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(r *Request) *HandlerResult

type HandlerResult added in v0.4.0

type HandlerResult struct {
	// Result is the label used for the result metric.
	Result string
	// Status is one of prom.StatusOk, prom.StatusErr, prom.StatusTimeout it is used for the latency
	// histogram. This is a reduced view of the result, so that we don't get too many timeseries on
	// the histogram.
	Status string
}

HandlerResult contains a result label and a status label.

func MetricsErrMsger added in v0.4.0

func MetricsErrMsger(err error) *HandlerResult

func MetricsErrRevCache added in v0.4.0

func MetricsErrRevCache(err error) *HandlerResult

func MetricsErrTrustDB added in v0.4.0

func MetricsErrTrustDB(err error) *HandlerResult

func MetricsErrTrustStore added in v0.4.0

func MetricsErrTrustStore(err error) *HandlerResult

func MetricsErrWithTimeout added in v0.4.0

func MetricsErrWithTimeout(err error, timeoutResult, result *HandlerResult) *HandlerResult

MetricsErrWithTimeout checks if the error is a timeout and if so returns timeoutResult otherwise returns result.

type MessageType added in v0.1.1

type MessageType int
const (
	None MessageType = iota
	IfId
	Ack
	HPSegReg
	HPSegRequest
	HPSegReply
	HPCfgRequest
	HPCfgReply
)

func (MessageType) MetricLabel added in v0.4.0

func (mt MessageType) MetricLabel() string

MetricLabel returns the label for metrics for a given message type. The postfix for requests is always "req" and for replies and push messages it is always "push".

func (MessageType) String added in v0.1.1

func (mt MessageType) String() string

type Request

type Request struct {
	// Message is the inner proto.Cerealizable message, as supported by
	// messenger.Messenger (e.g., a *cert_mgmt.ChainReq). For information about
	// possible messages, see the package documentation for that package.
	Message proto.Cerealizable
	// FullMessage is the top-level SignedCtrlPld message read from the wire
	FullMessage proto.Cerealizable
	// Peer is the node that sent this request
	Peer net.Addr
	// ID is the CtrlPld top-level ID.
	ID uint64
	// contains filtered or unexported fields
}

Request describes an object received from the network that is not part of an exchange initiated by the local node. A Request includes its associated context.

func NewRequest

func NewRequest(ctx context.Context, msg, fullMsg proto.Cerealizable, peer net.Addr,
	id uint64) *Request

func (*Request) Context

func (r *Request) Context() context.Context

Context returns the request's context.

type ResponseWriter added in v0.4.0

type ResponseWriter interface {
	SendAckReply(ctx context.Context, msg *ack.Ack) error
	SendHPSegReply(ctx context.Context, msg *path_mgmt.HPSegReply) error
	SendHPCfgReply(ctx context.Context, msg *path_mgmt.HPCfgReply) error
}

func ResponseWriterFromContext added in v0.4.0

func ResponseWriterFromContext(ctx context.Context) (ResponseWriter, bool)

type Verifier added in v0.4.0

type Verifier interface {
	seg.Verifier
	// WithServer returns a verifier that fetches the necessary crypto
	// objects from the specified server.
	WithServer(server net.Addr) Verifier
	// WithIA returns a verifier that only accepts signatures from the
	// specified IA.
	WithIA(ia addr.IA) Verifier
}

Verifier is used to verify payloads signed with control-plane PKI certificates.

Directories

Path Synopsis
Package infraenv contains convenience function common to SCION infra services.
Package infraenv contains convenience function common to SCION infra services.
mock_messenger
Package mock_messenger is a generated GoMock package.
Package mock_messenger is a generated GoMock package.
Package mock_infra is a generated GoMock package.
Package mock_infra is a generated GoMock package.
modules
combinator
Package combinator contains methods for constructing SCION forwarding paths.
Package combinator contains methods for constructing SCION forwarding paths.
db
Package db contains common database abstractions for our infra.
Package db contains common database abstractions for our infra.
itopo
Package itopo stores topology state and manages topology updates for an application.
Package itopo stores topology state and manages topology updates for an application.
segfetcher
Package segfetcher contains all the logic that is needed to fetch segments, verify and store segments in an efficient manner.
Package segfetcher contains all the logic that is needed to fetch segments, verify and store segments in an efficient manner.
segfetcher/mock_segfetcher
Package mock_segfetcher is a generated GoMock package.
Package mock_segfetcher is a generated GoMock package.
seghandler/mock_seghandler
Package mock_seghandler is a generated GoMock package.
Package mock_seghandler is a generated GoMock package.
segverifier
Package segverifier implements primitives for verifying path segments.
Package segverifier implements primitives for verifying path segments.

Jump to

Keyboard shortcuts

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