segment

package
v0.0.0-...-e6529c4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(segment Segment) string

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) DstIA

func (l Literal) DstIA() addr.IA

func (Literal) Fingerprint

func (l Literal) Fingerprint() string

func (Literal) PathInterfaces

func (l Literal) PathInterfaces() []snet.PathInterface

func (Literal) SrcIA

func (l Literal) SrcIA() addr.IA

func (Literal) String

func (l Literal) String() string

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

func EncodeSegments(newsegs, oldsegs []Segment, srcIA, dstIA addr.IA) ([]byte, []Segment)

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

func FromSegments(segments ...Segment) Segment

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

func FromString(segstr string) Segment

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 SplitPath

func SplitPath(path snet.Path) ([]Segment, error)

SplitPath splits the given path into up-/core-/down-/peering segments.

func SplitPaths

func SplitPaths(paths []snet.Path) ([]Segment, error)

SplitPaths splits the given paths into up-/core-/down-/peering segments. Segments that occur multiple times are only returned once.

func SrcDstPaths

func SrcDstPaths(segments []Segment, srcIA, dstIA addr.IA) []Segment

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.

Jump to

Keyboard shortcuts

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