Documentation ¶
Index ¶
- Constants
- func PathSegmentToPB(ps *PathSegment) *cppb.PathSegment
- func UnsignedExtensionsToPB(ue UnsignedExtensions) *cppb.PathSegmentUnsignedExtensions
- type ASEntry
- type Extensions
- type HiddenPathExtension
- type HopEntry
- type HopField
- type Info
- type Meta
- type PathSegment
- func (ps *PathSegment) AddASEntry(ctx context.Context, asEntry ASEntry, signer Signer) error
- func (ps *PathSegment) FirstIA() addr.IA
- func (ps *PathSegment) FullID() []byte
- func (ps *PathSegment) GetLoggingID() string
- func (ps *PathSegment) ID() []byte
- func (ps *PathSegment) LastIA() addr.IA
- func (ps *PathSegment) MaxExpiry() time.Time
- func (ps *PathSegment) MaxIdx() int
- func (ps *PathSegment) MinExpiry() time.Time
- func (ps *PathSegment) ShallowCopy() *PathSegment
- func (ps *PathSegment) String() string
- func (ps *PathSegment) Validate(validationMethod ValidationMethod) error
- func (ps *PathSegment) Verify(ctx context.Context, verifier Verifier) error
- func (ps *PathSegment) VerifyASEntry(ctx context.Context, verifier Verifier, idx int) error
- type PeerEntry
- type Segments
- type Signer
- type Type
- type UnsignedExtensions
- type ValidationMethod
- type Verifier
Constants ¶
const ( TypeUp = Type(cppb.SegmentType_SEGMENT_TYPE_UP) TypeDown = Type(cppb.SegmentType_SEGMENT_TYPE_DOWN) TypeCore = Type(cppb.SegmentType_SEGMENT_TYPE_CORE) )
Path segment types.
Variables ¶
This section is empty.
Functions ¶
func PathSegmentToPB ¶
func PathSegmentToPB(ps *PathSegment) *cppb.PathSegment
PathSegmentToPB translates a path segment to the protobuf encoding.
func UnsignedExtensionsToPB ¶
func UnsignedExtensionsToPB(ue UnsignedExtensions) *cppb.PathSegmentUnsignedExtensions
Types ¶
type ASEntry ¶
type ASEntry struct { // Signed contains the signed ASentry. It is used for signature input. Signed *cryptopb.SignedMessage // Local is the ISD-AS of the AS correspoding to this entry. Local addr.IA // Next is the ISD-AS of the downstream AS. Next addr.IA // HopEntry is the entry to create regular data plane paths. HopEntry HopEntry // PeerEntries is a list of entries to create peering data plane paths. PeerEntries []PeerEntry // MTU is the AS internal MTU. MTU int // Extensions holds all the beaconing extensions. Extensions Extensions // UnsignedExtensions holds all the unsigned beaconing extensions. UnsignedExtensions UnsignedExtensions }
type Extensions ¶
type Extensions struct { HiddenPath HiddenPathExtension StaticInfo *staticinfo.Extension Digests *digest.Extension }
type HiddenPathExtension ¶
type HiddenPathExtension struct {
IsHidden bool
}
type Info ¶
type Info struct { // Raw contains the encoded path segment information. It is used for // signature input and must not be modified. Raw []byte // Timestamp is the path segment creation time. Timestamp time.Time // SegmentID is the segment ID used in data plane hop field computation. SegmentID uint16 }
Info represents the path segment information.
type Meta ¶
type Meta struct { Segment *PathSegment Type Type }
Meta holds the path segment with its type.
type PathSegment ¶
type PathSegment struct { Info Info // ASEntries is the list of AS entries. Call AddASEntry to extend the list. ASEntries []ASEntry }
func BeaconFromPB ¶
func BeaconFromPB(pb *cppb.PathSegment) (*PathSegment, error)
BeaconFromPB translates a protobuf path Beacon.
func CreateSegment ¶
func CreateSegment(timestamp time.Time, segID uint16) (*PathSegment, error)
CreateSegment creates a new path segment. The AS entries should be added using AddASEntry.
func SegmentFromPB ¶
func SegmentFromPB(pb *cppb.PathSegment) (*PathSegment, error)
SegmentFromPB translates a protobuf path segment.
func (*PathSegment) AddASEntry ¶
AddASEntry adds the AS entry and signs the resulting path segment. The signature is created and does not need to be attached to the input AS entry.
func (*PathSegment) FirstIA ¶
func (ps *PathSegment) FirstIA() addr.IA
FirstIA returns the IA of the first ASEntry. Note that if the path segment contains no ASEntries this method will panic.
func (*PathSegment) FullID ¶
func (ps *PathSegment) FullID() []byte
FullID returns a hash of the segment covering all hops including peerings.
func (*PathSegment) GetLoggingID ¶
func (ps *PathSegment) GetLoggingID() string
func (*PathSegment) ID ¶
func (ps *PathSegment) ID() []byte
ID returns a hash of the segment covering all hops, except for peerings.
func (*PathSegment) LastIA ¶
func (ps *PathSegment) LastIA() addr.IA
LastIA returns the IA of the last ASEntry. Note that if the path segment contains no ASEntries this method will panic.
func (*PathSegment) MaxExpiry ¶
func (ps *PathSegment) MaxExpiry() time.Time
MaxExpiry returns the maximum expiry of all hop fields. Assumes segment is validated.
func (*PathSegment) MaxIdx ¶
func (ps *PathSegment) MaxIdx() int
MaxIdx returns the index of the last AS entry.
func (*PathSegment) MinExpiry ¶
func (ps *PathSegment) MinExpiry() time.Time
MinExpiry returns the minimum expiry of all hop fields. Assumes segment is validated.
func (*PathSegment) ShallowCopy ¶
func (ps *PathSegment) ShallowCopy() *PathSegment
ShallowCopy creates a shallow copy of the path segment.
func (*PathSegment) String ¶
func (ps *PathSegment) String() string
func (*PathSegment) Validate ¶
func (ps *PathSegment) Validate(validationMethod ValidationMethod) error
Validate validates that remote ingress and egress ISD-AS for each AS entry are consistent with the segment. In case a beacon is validated, the egress ISD-AS of the last AS entry is ignored.
func (*PathSegment) Verify ¶
func (ps *PathSegment) Verify(ctx context.Context, verifier Verifier) error
Verify verifies each AS entry.
func (*PathSegment) VerifyASEntry ¶
VerifyASEntry verifies the AS Entry at the specified index.
type PeerEntry ¶
type PeerEntry struct { // HopField contains the necessary information to create a data-plane hop. HopField HopField // Peer is the ISD-AS of the peering AS. Peer addr.IA // PeerInterface is the interface ID of the peering link on the remote // peering AS side. PeerInterface uint16 // PeerMTU is the MTU on the peering link. PeerMTU int }
type Segments ¶
type Segments []*PathSegment
Segments is just a helper type to have additional methods on top of a slice of PathSegments.
func (*Segments) FilterSegs ¶
FilterSegs filters the given segs and only keeps the segments for which keep returns true. Modifies segs in-place. Returns the number of segments filtered out. If keep returns an error the method is aborted and the error is returned, segs might have been modified.
type Signer ¶
type Signer interface { // Sign signs the AS entry and returns the signature meta data. Sign(ctx context.Context, msg []byte, associatedData ...[]byte) (*cryptopb.SignedMessage, error) }
Signer signs path segments.
type UnsignedExtensions ¶
type UnsignedExtensions struct { // EpicDetached contains the detachable epic authenticators. It is nil // if it was detached (or never added). EpicDetached *epic.Detached }
func UnsignedExtensionsFromPB ¶
func UnsignedExtensionsFromPB(ue *cppb.PathSegmentUnsignedExtensions) UnsignedExtensions
type ValidationMethod ¶
type ValidationMethod bool
ValidationMethod is the method that is used during validation.
const ( // ValidateSegment validates that remote ingress and egress ISD-AS for // each AS entry are consistent with the segment. The ingress ISD-AS of // the first entry, and the egress ISD-AS of the last entry must be the // zero value. Additionally, it is validated that each hop field is // parsable. ValidateSegment ValidationMethod = false // ValidateBeacon validates the segment in the same manner as // ValidateSegment, except for the last AS entry. The egress values for // the last AS entry are ignored, since they are under construction in // a beacon. ValidateBeacon ValidationMethod = true )
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
extensions
|
|
staticinfo
Package staticinfo contains the internal representation of the StaticInfoExtension path segment extension, and conversion from and to the corresponding protobuf representation.
|
Package staticinfo contains the internal representation of the StaticInfoExtension path segment extension, and conversion from and to the corresponding protobuf representation. |
Package mock_seg is a generated GoMock package.
|
Package mock_seg is a generated GoMock package. |