graph

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Code generated by graphupdater tool, DO NOT EDIT.

Package graph implements a multigraph model of a SCION network for use in tests. The default Mock SCIOND implementation uses the graph to simulate path lookups.

Note that the graph always returns the shortest paths, regardless whether they are valid SCION paths (e.g., the path might cross multiple peering links).

Index

Constants

This section is empty.

Variables

View Source
var (
	If_110_X_120_A  = uint16(1129)
	If_120_A_110_X  = uint16(2911)
	If_110_X_130_A  = uint16(1113)
	If_130_A_110_X  = uint16(1311)
	If_110_X_210_X  = uint16(1121)
	If_210_X_110_X  = uint16(2111)
	If_120_A_130_B  = uint16(2932)
	If_130_B_120_A  = uint16(3229)
	If_120_B_220_X  = uint16(3022)
	If_220_X_120_B  = uint16(2230)
	If_120_B1_220_X = uint16(3122)
	If_220_X_120_B1 = uint16(2231)
	If_120_B_121_X  = uint16(3015)
	If_121_X_120_B  = uint16(1530)
	If_120_X_111_B  = uint16(1227)
	If_111_B_120_X  = uint16(2712)
	If_130_A_131_X  = uint16(1316)
	If_131_X_130_A  = uint16(1613)
	If_130_B_111_A  = uint16(3214)
	If_111_A_130_B  = uint16(1432)
	If_130_A_112_X  = uint16(1317)
	If_112_X_130_A  = uint16(1713)
	If_111_C_121_X  = uint16(2815)
	If_121_X_111_C  = uint16(1528)
	If_111_B_211_A  = uint16(2723)
	If_211_A_111_B  = uint16(2327)
	If_111_C_211_A  = uint16(2823)
	If_211_A_111_C  = uint16(2328)
	If_111_A_112_X  = uint16(1417)
	If_112_X_111_A  = uint16(1714)
	If_121_X_131_X  = uint16(1516)
	If_131_X_121_X  = uint16(1615)
	If_121_X_122_X  = uint16(1518)
	If_122_X_121_X  = uint16(1815)
	If_122_X_133_X  = uint16(1810)
	If_133_X_122_X  = uint16(1018)
	If_131_X_132_X  = uint16(1619)
	If_132_X_131_X  = uint16(1916)
	If_132_X_133_X  = uint16(1910)
	If_133_X_132_X  = uint16(1019)
	If_210_X_220_X  = uint16(2122)
	If_220_X_210_X  = uint16(2221)
	If_210_X_211_A  = uint16(2123)
	If_211_A_210_X  = uint16(2321)
	If_210_X1_211_A = uint16(3323)
	If_211_A_210_X1 = uint16(2333)
	If_220_X_221_X  = uint16(2224)
	If_221_X_220_X  = uint16(2422)
	If_211_A_221_X  = uint16(2324)
	If_221_X_211_A  = uint16(2423)
	If_211_A_212_X  = uint16(2325)
	If_212_X_211_A  = uint16(2523)
	If_211_A1_212_X = uint16(3425)
	If_212_X_211_A1 = uint16(2534)
	If_211_A_222_X  = uint16(2326)
	If_222_X_211_A  = uint16(2623)
	If_221_X_222_X  = uint16(2426)
	If_222_X_221_X  = uint16(2624)
)
View Source
var DefaultGraphDescription = &Description{
	Nodes: []string{
		"1-ff00:0:110",
		"1-ff00:0:111",
		"1-ff00:0:112",
		"1-ff00:0:120",
		"1-ff00:0:121",
		"1-ff00:0:122",
		"1-ff00:0:130",
		"1-ff00:0:131",
		"1-ff00:0:132",
		"1-ff00:0:133",
		"2-ff00:0:210",
		"2-ff00:0:211",
		"2-ff00:0:212",
		"2-ff00:0:220",
		"2-ff00:0:221",
		"2-ff00:0:222",
	},
	Edges: []EdgeDesc{
		{"1-ff00:0:110", If_110_X_120_A, "1-ff00:0:120", If_120_A_110_X, false},
		{"1-ff00:0:110", If_110_X_130_A, "1-ff00:0:130", If_130_A_110_X, false},
		{"1-ff00:0:110", If_110_X_210_X, "2-ff00:0:210", If_210_X_110_X, false},
		{"1-ff00:0:120", If_120_A_130_B, "1-ff00:0:130", If_130_B_120_A, false},
		{"1-ff00:0:120", If_120_B_220_X, "2-ff00:0:220", If_220_X_120_B, false},
		{"1-ff00:0:120", If_120_B1_220_X, "2-ff00:0:220", If_220_X_120_B1, false},
		{"1-ff00:0:120", If_120_B_121_X, "1-ff00:0:121", If_121_X_120_B, false},
		{"1-ff00:0:120", If_120_X_111_B, "1-ff00:0:111", If_111_B_120_X, false},
		{"1-ff00:0:130", If_130_A_131_X, "1-ff00:0:131", If_131_X_130_A, false},
		{"1-ff00:0:130", If_130_B_111_A, "1-ff00:0:111", If_111_A_130_B, false},
		{"1-ff00:0:130", If_130_A_112_X, "1-ff00:0:112", If_112_X_130_A, false},
		{"1-ff00:0:111", If_111_C_121_X, "1-ff00:0:121", If_121_X_111_C, true},
		{"1-ff00:0:111", If_111_B_211_A, "2-ff00:0:211", If_211_A_111_B, true},
		{"1-ff00:0:111", If_111_C_211_A, "2-ff00:0:211", If_211_A_111_C, true},
		{"1-ff00:0:111", If_111_A_112_X, "1-ff00:0:112", If_112_X_111_A, false},
		{"1-ff00:0:121", If_121_X_131_X, "1-ff00:0:131", If_131_X_121_X, true},
		{"1-ff00:0:121", If_121_X_122_X, "1-ff00:0:122", If_122_X_121_X, false},
		{"1-ff00:0:122", If_122_X_133_X, "1-ff00:0:133", If_133_X_122_X, true},
		{"1-ff00:0:131", If_131_X_132_X, "1-ff00:0:132", If_132_X_131_X, false},
		{"1-ff00:0:132", If_132_X_133_X, "1-ff00:0:133", If_133_X_132_X, false},
		{"2-ff00:0:210", If_210_X_220_X, "2-ff00:0:220", If_220_X_210_X, false},
		{"2-ff00:0:210", If_210_X_211_A, "2-ff00:0:211", If_211_A_210_X, false},
		{"2-ff00:0:210", If_210_X1_211_A, "2-ff00:0:211", If_211_A_210_X1, false},
		{"2-ff00:0:220", If_220_X_221_X, "2-ff00:0:221", If_221_X_220_X, false},
		{"2-ff00:0:211", If_211_A_221_X, "2-ff00:0:221", If_221_X_211_A, true},
		{"2-ff00:0:211", If_211_A_212_X, "2-ff00:0:212", If_212_X_211_A, false},
		{"2-ff00:0:211", If_211_A1_212_X, "2-ff00:0:212", If_212_X_211_A1, false},
		{"2-ff00:0:211", If_211_A_222_X, "2-ff00:0:222", If_222_X_211_A, false},
		{"2-ff00:0:221", If_221_X_222_X, "2-ff00:0:222", If_222_X_221_X, false},
	},
}
View Source
var (
	StaticIfaceIdMapping = map[string]int{
		"110_X":  11,
		"111_A":  14,
		"111_B":  27,
		"111_C":  28,
		"112_X":  17,
		"120_X":  12,
		"120_A":  29,
		"120_B":  30,
		"120_B1": 31,
		"121_X":  15,
		"122_X":  18,
		"130_A":  13,
		"130_B":  32,
		"131_X":  16,
		"132_X":  19,
		"133_X":  10,
		"210_X":  21,
		"210_X1": 33,
		"211_A":  23,
		"211_A1": 34,
		"212_X":  25,
		"220_X":  22,
		"221_X":  24,
		"222_X":  26,
	}
)

Functions

func MustParseIA

func MustParseIA(ia string) addr.IA

Types

type AS

type AS struct {
	IFIDs map[uint16]struct{}
}

AS contains a list of all the IFIDs in an AS.

func (*AS) Delete

func (as *AS) Delete(ifid uint16)

Delete removes ifid from as.

type Description

type Description struct {
	Nodes []string
	Edges []EdgeDesc
}

Description contains the entire specification of a graph. It is useful for one shot initilizations.

type EdgeDesc

type EdgeDesc struct {
	Xia   string
	Xifid uint16
	Yia   string
	Yifid uint16
	Peer  bool
}

EdgeDesc is used in Descriptions to describe the links between ASes.

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

Graph implements a graph of ASes and IFIDs for testing purposes. IFIDs must be globally unique.

Nodes are represented by ASes.

Edges are represented by pairs of IFIDs.

func New

func New(ctrl *gomock.Controller) *Graph

New allocates a new empty graph.

func NewDefaultGraph

func NewDefaultGraph(ctrl *gomock.Controller) *Graph

func NewFromDescription

func NewFromDescription(ctrl *gomock.Controller, desc *Description) *Graph

NewFromDescription initializes a new graph from description desc.

func (*Graph) Add

func (g *Graph) Add(ia string)

Add adds a new node to the graph. If ia is not a valid string representation of an ISD-AS, Add panics.

func (g *Graph) AddLink(xIA string, xIFID uint16,
	yIA string, yIFID uint16, peer bool)

AddLink adds a new edge between the ASes described by xIA and yIA, with xIFID in xIA and yIFID in yIA. If xIA or yIA are not valid string representations of an ISD-AS, AddLink panics.

func (*Graph) Bandwidth added in v0.6.0

func (g *Graph) Bandwidth(a, b uint16) uint64

Bandwidth returns an arbitrary test bandwidth value between two interfaces. Analogous to Latency.

func (*Graph) Beacon

func (g *Graph) Beacon(ifids []uint16) *seg.PathSegment

Beacon constructs path segments across a series of egress ifids. The parent AS of the first IFID is the origin of the beacon, and the beacon propagates down to the parent AS of the remote counterpart of the last IFID. The constructed segment includes peering links. The hop fields in the returned segment do not contain valid MACs.

func (*Graph) BeaconWithStaticInfo added in v0.6.0

func (g *Graph) BeaconWithStaticInfo(ifids []uint16) *seg.PathSegment

func (*Graph) DeleteInterface

func (g *Graph) DeleteInterface(ifid uint16)

DeleteInterface removes ifid from the graph without deleting its remote counterpart. This is useful for testing IFID misconfigurations.

func (*Graph) GeoCoordinates added in v0.6.0

func (g *Graph) GeoCoordinates(ifid uint16) staticinfo.GeoCoordinates

GeoCoordinates returns an arbitrary test GeoCoordinate for the interface

func (*Graph) GetParent

func (g *Graph) GetParent(ifid uint16) addr.IA

GetParent returns the parent AS of ifid.

func (*Graph) GetPaths

func (g *Graph) GetPaths(xIA string, yIA string) [][]uint16

GetPaths returns all the minimum-length paths. If xIA = yIA, a 1-length slice containing an empty path is returned. If no path exists between xIA and yIA, a 0-length slice is returned.

Note that this always returns shortest length paths, even if they might not be valid SCION paths.

func (*Graph) GetSigner added in v0.7.0

func (g *Graph) GetSigner(ia string) *Signer

GetSigner returns the signer for the ISD-AS.

func (*Graph) InternalHops added in v0.6.0

func (g *Graph) InternalHops(a, b uint16) uint32

InternalHops returns an arbitrary number of internal hops value between two interfaces of an AS.

func (*Graph) Latency added in v0.6.0

func (g *Graph) Latency(a, b uint16) time.Duration

Latency returns an arbitrary test latency value between two interfaces. The interfaces should either be part of the same AS, in which case the intra-AS latency is returned, or they should form a link of the graph. Otherwise, this panics. The value returned is symmetric, i.e. g.Latency(a, b) == g.Latency(b, a)

func (*Graph) LinkType added in v0.6.0

func (g *Graph) LinkType(a, b uint16) staticinfo.LinkType

LinkType returns an arbitrary test link type value for an inter-AS link. Only for inter-AS links, otherwise analogous to Latency.

func (g *Graph) RemoveLink(ifid uint16)

RemoveLink deletes the edge containing ifid from the graph.

type Signer added in v0.6.0

type Signer struct {
	PrivateKey crypto.Signer
	// Timestamp is the timestamp that this signer is bound to. If it is set,
	// all signatures are created with this timestamp. If it is not set, the
	// current time is used for the signature timestamp.
	Timestamp time.Time
	IA        addr.IA
	TRCID     cppki.TRCID
}

func NewSigner added in v0.6.0

func NewSigner(opts ...SignerOption) *Signer

func (Signer) Sign added in v0.6.0

func (s Signer) Sign(ctx context.Context, msg []byte,
	associatedData ...[]byte) (*cryptopb.SignedMessage, error)

type SignerOption added in v0.7.0

type SignerOption func(o *Signer)

SignerOption allows customizing the generated Signer.

func WithIA added in v0.7.0

func WithIA(ia addr.IA) SignerOption

WithIA customizes the ISD-AS for the Signer.

func WithPrivateKey added in v0.7.0

func WithPrivateKey(key crypto.Signer) SignerOption

WithPrivateKey customizes the private key for the Signer.

func WithTRCID added in v0.7.0

func WithTRCID(trcID cppki.TRCID) SignerOption

WithTRCID customizes the TRCID for the Signer.

func WithTimestamp added in v0.7.0

func WithTimestamp(ts time.Time) SignerOption

WithTimestamp customizes the signature timestamp for the Signer.

Jump to

Keyboard shortcuts

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