infra

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package infra contains common definitions for the SCION infrastructure messaging layer.

Index

Constants

View Source
const (
	StrCtxDoneError   = "context canceled"
	StrClosedError    = "layer closed"
	StrAdapterError   = "msg adapter error"
	StrInternalError  = "internal error"
	StrTransportError = "transport error"
)

Variables

This section is empty.

Functions

func NewContextWithMessenger

func NewContextWithMessenger(ctx context.Context, msger Messenger) context.Context

func NewCtxDoneError

func NewCtxDoneError(ctx ...interface{}) error

Types

type Handler

type Handler interface {
	Handle(*Request)
}

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

type HandlerFunc

type HandlerFunc func(r *Request)

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)

type Messenger

type Messenger interface {
	GetTRC(ctx context.Context, msg *cert_mgmt.TRCReq, a net.Addr,
		id uint64) (*cert_mgmt.TRC, error)
	SendTRC(ctx context.Context, msg *cert_mgmt.TRC, a net.Addr, id uint64) error
	GetCertChain(ctx context.Context, msg *cert_mgmt.ChainReq, a net.Addr,
		id uint64) (*cert_mgmt.Chain, error)
	SendCertChain(ctx context.Context, msg *cert_mgmt.Chain, a net.Addr, id uint64) error
	GetPathSegs(ctx context.Context, msg *path_mgmt.SegReq, a net.Addr,
		id uint64) (*path_mgmt.SegReply, error)
	AddHandler(msgType string, h Handler)
	ListenAndServe()
	CloseServer() error
}

func MessengerFromContext

func MessengerFromContext(ctx context.Context) (Messenger, bool)

type Request

type Request struct {
	// 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
	// The top-level SignedCtrlPld message read from the wire
	FullMessage proto.Cerealizable
	// The node that sent this request
	Peer net.Addr

	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 Transport

type Transport interface {
	// Send an unreliable message. Unreliable transport layers do not request
	// an ACK. For reliable transport layers, this is the same as SendMsgTo.
	SendUnreliableMsgTo(context.Context, common.RawBytes, net.Addr) error
	// Send a reliable message. Unreliable transport layers block here waiting
	// for the message to be ACK'd. Reliable transport layers return
	// immediately.
	SendMsgTo(context.Context, common.RawBytes, net.Addr) error
	// Receive a message.
	RecvFrom(context.Context) (common.RawBytes, net.Addr, error)
	// Clean up.
	Close(context.Context) error
}

Interface Transport wraps around low-level networking objects to provide reliable and unreliable delivery of network packets, together with context-aware networking that can be used to construct handlers with timeouts.

Transport layers must be safe for concurrent use by multiple goroutines.

type TrustStore

type TrustStore interface {
	GetValidChain(ctx context.Context, ia addr.IA, trail ...addr.ISD) (*cert.Chain, error)
	GetValidTRC(ctx context.Context, isd addr.ISD, trail ...addr.ISD) (*trc.TRC, error)
	GetChain(ctx context.Context, ia addr.IA, version uint64) (*cert.Chain, error)
	GetTRC(ctx context.Context, isd addr.ISD, version uint64) (*trc.TRC, error)
	NewTRCReqHandler(recurseAllowed bool) Handler
	NewChainReqHandler(recurseAllowed bool) Handler
	SetMessenger(msger Messenger)
}

Directories

Path Synopsis
Package dedupe implements a generic request/response proxy that issues a single request instead of multiple redundant requests.
Package dedupe implements a generic request/response proxy that issues a single request instead of multiple redundant requests.
Package disp implements a generic message dispatcher for request/reply protocols.
Package disp implements a generic message dispatcher for request/reply protocols.
Example infrastructure service that does nothing except service some requests using default handlers.
Example infrastructure service that does nothing except service some requests using default handlers.
Package messenger contains the default implementation for interface infra.Messenger.
Package messenger contains the default implementation for interface infra.Messenger.
modules
combinator
Package combinator contains methods for constructing SCION forwarding paths.
Package combinator contains methods for constructing SCION forwarding paths.
segverifier
Package segverifier implements primitives for verifying path segments.
Package segverifier implements primitives for verifying path segments.
trust
Package trust defines type Store, a unified interface for TRC and Certificate retrieval.
Package trust defines type Store, a unified interface for TRC and Certificate retrieval.
trust/trustdb
Package trustdb provides wrappers for SQL calls for managing a database containing TRCs and Certificate Chains.
Package trustdb provides wrappers for SQL calls for managing a database containing TRCs and Certificate Chains.

Jump to

Keyboard shortcuts

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