ctrl

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: 15 Imported by: 0

Documentation

Overview

Package ctrl handles SCION control-plane payloads, which are encoded as capnp proto messages. Each ctrl payload has a 4B length field prefixed to the start of the capnp message.

Index

Constants

View Source
const (
	// SrcDefaultPrefix is the default prefix for proto.SignS.Src.
	SrcDefaultPrefix = "DEFAULT: "
	// SrcDefaultFmt is the default format for proto.SignS.Src.
	SrcDefaultFmt = `^` + SrcDefaultPrefix + `IA: (\S+) CHAIN: (\d+) TRC: (\d+)$`
)
View Source
const LenSize = 4

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ReqId   uint64
	TraceId common.RawBytes
}

Data holds all non-union entries from CtrlPld

type Pld

type Pld struct {
	*Data
	// contains filtered or unexported fields
}

func NewCertMgmtPld

func NewCertMgmtPld(u proto.Cerealizable, certD *cert_mgmt.Data, ctrlD *Data) (*Pld, error)

NewCertMgmtPld creates a new control payload, containing a new cert_mgmt payload, which in turn contains the supplied Cerealizable instance.

func NewPathMgmtPld

func NewPathMgmtPld(u proto.Cerealizable, pathD *path_mgmt.Data, ctrlD *Data) (*Pld, error)

NewPathMgmtPld creates a new control payload, containing a new path_mgmt payload, which in turn contains the supplied Cerealizable instance.

func NewPld

func NewPld(u proto.Cerealizable, d *Data) (*Pld, error)

NewPld creates a new control payload, containing the supplied Cerealizable instance.

func NewPldFromRaw

func NewPldFromRaw(b common.RawBytes) (*Pld, error)

func (*Pld) Copy

func (p *Pld) Copy() (*Pld, error)

func (*Pld) GetCertMgmt

func (p *Pld) GetCertMgmt() (*cert_mgmt.Pld, *Data, error)

GetCertMgmt returns the CertMgmt payload and the CtrlPld's non-union Data. If the union type is not CertMgmt, an error is returned.

func (*Pld) GetPathMgmt

func (p *Pld) GetPathMgmt() (*path_mgmt.Pld, *Data, error)

GetPathMgmt returns the PathMgmt payload and the CtrlPld's non-union Data. If the union type is not PathMgmt, an error is returned.

func (*Pld) Len

func (p *Pld) Len() int

func (*Pld) ProtoId

func (p *Pld) ProtoId() proto.ProtoIdType

func (*Pld) SignedPld

func (p *Pld) SignedPld(signer Signer) (*SignedPld, error)

func (*Pld) String

func (p *Pld) String() string

func (*Pld) Union

func (p *Pld) Union() (proto.Cerealizable, error)

func (*Pld) Write

func (p *Pld) Write(b common.RawBytes) (int, error)

type SignSrcDef

type SignSrcDef struct {
	IA       addr.IA
	ChainVer scrypto.Version
	TRCVer   scrypto.Version
}

SignSrcDef is the default format for signature source. It states the signing entity, and the certificate chain authenticating the public key. The TRC version is a hint for the TRC that can currently be used to verify the chain.

func NewSignSrcDefFromRaw

func NewSignSrcDefFromRaw(b common.RawBytes) (SignSrcDef, error)

func (*SignSrcDef) IsUninitialized added in v0.4.0

func (s *SignSrcDef) IsUninitialized() bool

IsUninitialized indicates whether the source is equal to the zero value.

func (*SignSrcDef) Pack

func (s *SignSrcDef) Pack() common.RawBytes

func (*SignSrcDef) String

func (s *SignSrcDef) String() string

type SignedPld

type SignedPld struct {
	Blob common.RawBytes
	Sign *proto.SignS
	// contains filtered or unexported fields
}

func NewSignedPld added in v0.4.0

func NewSignedPld(cpld *Pld, signer Signer) (*SignedPld, error)

func NewSignedPldFromRaw

func NewSignedPldFromRaw(b common.RawBytes) (*SignedPld, error)

func (*SignedPld) Copy

func (sp *SignedPld) Copy() (common.Payload, error)

func (*SignedPld) GetVerifiedPld added in v0.4.0

func (sp *SignedPld) GetVerifiedPld(ctx context.Context, verifier Verifier) (*Pld, error)

GetVerifiedPld extracts the control payload and verifies it. If verification fails, an error is returned instead.

func (*SignedPld) Len

func (sp *SignedPld) Len() int

func (*SignedPld) PackPld

func (sp *SignedPld) PackPld() (common.RawBytes, error)

func (*SignedPld) ProtoId

func (sp *SignedPld) ProtoId() proto.ProtoIdType

func (*SignedPld) String

func (sp *SignedPld) String() string

func (*SignedPld) UnsafePld added in v0.4.0

func (sp *SignedPld) UnsafePld() (*Pld, error)

UnsafePld extracts the control payload without verifying the payload.

func (*SignedPld) WritePld

func (sp *SignedPld) WritePld(b common.RawBytes) (int, error)

type Signer

type Signer interface {
	Sign(msg common.RawBytes) (*proto.SignS, error)
}

Signer takes a message and signs it, producing the signature metadata.

type Verifier added in v0.4.0

type Verifier interface {
	VerifyPld(context.Context, *SignedPld) (*Pld, error)
}

Verifier verifies the signature of a signed payload.

Directories

Path Synopsis
Package ctrl_msg implements a layer for sending SCION Ctrl payload requests/notifications via the infra dispatcher, including integrated signing and signature verification of ctrl payloads.
Package ctrl_msg implements a layer for sending SCION Ctrl payload requests/notifications via the infra dispatcher, including integrated signing and signature verification of ctrl payloads.
Package ifid contains the Go representation of an IFID keepalive packet.
Package ifid contains the Go representation of an IFID keepalive packet.
seg
mock_seg
Package mock_seg is a generated GoMock package.
Package mock_seg is a generated GoMock package.

Jump to

Keyboard shortcuts

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