Documentation ¶
Index ¶
- func Hash(segment Segment) string
- func ReadSegments(stream io.Reader, oldsegs []Segment) ([]Segment, []Segment, addr.IA, addr.IA, error)
- type Composition
- type Filter
- type Literal
- type Segment
- func EncodeSegments(newsegs, oldsegs []Segment, srcIA, dstIA addr.IA) ([]byte, []Segment)
- func FromInterfaces(interfaces ...snet.PathInterface) Segment
- func FromSegments(segments ...Segment) Segment
- func FromString(segstr string) Segment
- func SplitPath(path snet.Path) ([]Segment, error)
- func SplitPaths(paths []snet.Path) ([]Segment, error)
- func SrcDstPaths(segments []Segment, srcIA, dstIA addr.IA) []Segment
- func WriteSegments(stream io.Writer, newsegs, oldsegs []Segment, srcIA, dstIA addr.IA) ([]Segment, error)
- type SegmentSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Hash ¶
Hash creates a string that uniquely identifies a segment with high probability solely based on the sequence of its path interfaces.
func ReadSegments ¶
func ReadSegments(stream io.Reader, oldsegs []Segment) ([]Segment, []Segment, addr.IA, addr.IA, error)
ReadSegments reads from the given bytestream and decodes the bytes received from the other CONPASS agent into segments. This function also takes into account the “old” set of segments, which is already known to both agents. The first set of segments contains all segments that were transmitted, the second set contains only the accepted segments. This function also returns the source and destination ASes. If the decoding failed, an error is returned instead.
Types ¶
type Composition ¶
type Composition struct { // Segments are the subsegments of the segment composition. Segments []Segment // contains filtered or unexported fields }
Composition implements the Segment interface.
func (Composition) DstIA ¶
func (c Composition) DstIA() addr.IA
func (Composition) Fingerprint ¶
func (c Composition) Fingerprint() string
func (Composition) PathInterfaces ¶
func (c Composition) PathInterfaces() []snet.PathInterface
func (Composition) SrcIA ¶
func (c Composition) SrcIA() addr.IA
func (Composition) String ¶
func (c Composition) String() string
type Filter ¶
type Filter interface { // Filter maps the original to the resulting (accepted) SegmentSet. Filter(SegmentSet) SegmentSet }
Filter is the interface that CONPASS agents need to implement in order to apply their consent logic. In order to allow for all kinds of consent logic, a filter is simply a function from one SegmentSet to another SegmentSet. In most cases, the resulting SegmentSet is a subset of the original SegmentSet. It is, however, also possible to include new segments in the resulting SegmentSet or segments that are combinations of the original segments.
type Literal ¶
type Literal struct { // Interfaces is the sequence of ingress-egress interfaces of which the // segment literal consists. Interfaces []snet.PathInterface // contains filtered or unexported fields }
Literal implements the Segment interface.
func (Literal) Fingerprint ¶
func (Literal) PathInterfaces ¶
func (l Literal) PathInterfaces() []snet.PathInterface
type Segment ¶
type Segment interface { // PathInterfaces returns the sequence of path interfaces of which the // segment consists. PathInterfaces() []snet.PathInterface // SrcIA returns the segment's source ISD-AS address. SrcIA() addr.IA // DstIA returns the segment's destination ISD-AS address. DstIA() addr.IA // Fingerprint returns a string that uniquely identifies the segment. Fingerprint() string // Segment implements the fmt.Stringer interface. fmt.Stringer }
Segment is an abstraction for any type that represents a sequence of path interfaces between a source AS and a destination AS.
func EncodeSegments ¶
EncodeSegments encodes the segments to send to the other CONPASS segments in bytes. This function also takes into account the “old” set of segments, which is already known to both agents. The function returns the byte sequence and the encoded segments in the order of transmission.
func FromInterfaces ¶
func FromInterfaces(interfaces ...snet.PathInterface) Segment
FromInterfaces creates a new Segment from a sequence of interfaces. The interface slice is copied to prevent problems with shared slices.
func FromSegments ¶
FromSegments creates a new Segment from a sequence of pointers to segments. The segments slice is copied to prevent problems with shared slices.
func FromString ¶
FromString creates a new Segment from its string representation. This function is mainly intended for testing purposes and will panic if the provided string cannot be parsed into a valid segment.
func SplitPaths ¶
SplitPaths splits the given paths into up-/core-/down-/peering segments. Segments that occur multiple times are only returned once.
func SrcDstPaths ¶
SrcDstPaths enumerates all possible end-to-end segments between a source and destination ISD-AS pair from a given set of segments. For constant-bounded segment length, the runtime complexity is linear in the number of enumeratable segments starting at the source ISD-AS.
func WriteSegments ¶
func WriteSegments(stream io.Writer, newsegs, oldsegs []Segment, srcIA, dstIA addr.IA) ([]Segment, error)
WriteSegments encodes the segments to send to the other CONPASS segments in bytes and writes them to the given bytestream. This function also takes into account the “old” set of segments, which is already known to both agents. The function returns the encoded segments in the order of transmission.
type SegmentSet ¶
type SegmentSet struct { // Segments is the set of segments in the SegmentSet. Segments []Segment // SrcIA is the source ISD-AS address of the SegmentSet. SrcIA addr.IA // DstIA is the destination ISD-AS address of the SegmentSet. DstIA addr.IA }
SegmentSet is a data structure that combines a set of segments with the corresponding source and destination ISD-AS addresses.
func (SegmentSet) EnumeratePaths ¶
func (ss SegmentSet) EnumeratePaths() []Segment
EnumeratePaths enumerates all end-to-end paths from the given SegmentSet.
func (SegmentSet) MatchingPaths ¶
func (ss SegmentSet) MatchingPaths(paths []snet.Path) []snet.Path
MatchingPaths takes a set of SCION paths and returns the paths that are constructed from segments in the SegmentSet.