infra

package
v0.0.0-...-c8fc2fc Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: Apache-2.0 Imports: 6 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

View Source
var (
	// MessengerContextKey is a context key. It can be used in SCION infra
	// request handlers to access the messaging layer the message arrived on.
	MessengerContextKey = &contextKey{"infra-messenger"}
)

Functions

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
	AddHandler(msgType string, h Handler)
	ListenAndServe()
	CloseServer() error
}

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 TrustDescriptor

type TrustDescriptor struct {
}

type TrustStore

type TrustStore interface {
	StartResolvers(messenger Messenger) error
	NewTRCReqHandler() Handler
	NewChainReqHandler() Handler
	NewPushTRCHandler() Handler
	NewPushChainHandler() Handler
	GetCertificate(ctx context.Context, trail []TrustDescriptor, hint net.Addr) (*cert.Certificate, error)
}

Directories

Path Synopsis
Package disp implements a generic message dispatcher for request/reply protocols.
Package disp implements a generic message dispatcher for request/reply protocols.
Package messenger contains the default implementation for interface infra.Messenger.
Package messenger contains the default implementation for interface infra.Messenger.

Jump to

Keyboard shortcuts

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