fake

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(script *Script) sciond.Connector

New creates a new fake SCIOND implementation using the data in the script.

New also initializes path expiry times according to the expiry seconds in the script.

func NewFromFile

func NewFromFile(file string) (sciond.Connector, error)

NewFromFile creates a new fake SCIOND implementation using the JSON representation in the file.

Types

type Entry

type Entry struct {
	// ReplyStartTimestamp describes the number of seconds that should pass after a fake SCIOND has
	// been created before serving paths from the entry. The last entry whose timestamp has passed
	// is selected. (so, if the seconds timestamps are 0, 4, 6, the paths selected at 5 seconds from
	// creation would be the ones associated with timestamp 4)
	ReplyStartTimestamp int `json:"reply_start_timestamp"`
	// Paths contains the paths for a fake SCIOND reply.
	Paths []*Path `json:"paths"`
}

Entry describes a path reply.

type Path

type Path struct {
	// JSONInterfaces encodes a list of interfaces
	JSONInterfaces []PathInterface `json:"interfaces,omitempty"`
	JSONNextHop    *UDPAddr        `json:"next_hop,omitempty"`
	// JSONExpirationTimestamp contains the point in time when the path expires, in seconds,
	// relative to the time of fake connector creation. Negative timestamps are also supported, and
	// would mean SCIOND served a path that expired in the past.
	JSONExpirationTimestamp int `json:"expiration_timestamp"`
}

func (Path) Path

func (p Path) Path(creationTime time.Time) snet.Path

type PathInterface added in v0.6.0

type PathInterface struct {
	IA addr.IA         `json:"ia"`
	ID common.IFIDType `json:"id"`
}

type Script

type Script struct {
	IA      addr.IA  `json:"ia"`
	Entries []*Entry `json:"entries"`
}

Script describes the path entries a fake SCIOND should respond with.

type UDPAddr

type UDPAddr net.UDPAddr

UDPAddr decorates net.UDPAddr with custom JSON marshaling logic.

func (*UDPAddr) MarshalText

func (u *UDPAddr) MarshalText() ([]byte, error)

func (*UDPAddr) UnmarshalText

func (u *UDPAddr) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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