Documentation ¶
Index ¶
- Constants
- func PathSegmentToPB(ps *PathSegment) *cppb.PathSegment
- 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 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 ¶ added in v0.6.0
func PathSegmentToPB(ps *PathSegment) *cppb.PathSegment
PathSegmentToPB translates a path segment to the protobuf encoding.
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 }
type Extensions ¶ added in v0.6.0
type Extensions struct { HiddenPath HiddenPathExtension StaticInfo *staticinfo.Extension }
type HiddenPathExtension ¶ added in v0.6.0
type HiddenPathExtension struct {
IsHidden bool
}
type Info ¶ added in v0.6.0
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 ¶ added in v0.6.0
func BeaconFromPB(pb *cppb.PathSegment) (*PathSegment, error)
BeaconFromPB translates a protobuf path Beacon.
func CreateSegment ¶ added in v0.6.0
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 ¶ added in v0.6.0
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 ¶ added in v0.3.0
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 ¶ added in v0.6.0
func (ps *PathSegment) FullID() []byte
FullID returns a hash of the segment covering all hops including peerings.
func (*PathSegment) GetLoggingID ¶ added in v0.4.0
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 ¶ added in v0.3.0
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 ¶ added in v0.3.0
func (ps *PathSegment) MaxExpiry() time.Time
MaxExpiry returns the maximum expiry of all hop fields. Assumes segment is validated.
func (*PathSegment) MaxIdx ¶ added in v0.6.0
func (ps *PathSegment) MaxIdx() int
MaxIdx returns the index of the last AS entry.
func (*PathSegment) MinExpiry ¶ added in v0.3.0
func (ps *PathSegment) MinExpiry() time.Time
MinExpiry returns the minimum expiry of all hop fields. Assumes segment is validated.
func (*PathSegment) ShallowCopy ¶ added in v0.4.0
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 ¶ added in v0.6.0
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 ¶ added in v0.6.0
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 ¶ added in v0.3.0
type Segments []*PathSegment
Segments is just a helper type to have additional methods on top of a slice of PathSegments.
func (*Segments) FilterSegs ¶ added in v0.3.0
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 ¶ added in v0.4.0
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 ValidationMethod ¶ added in v0.4.0
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. |