sciond

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: 19 Imported by: 0

Documentation

Overview

Package sciond queries local SCIOND servers for information.

To query SCIOND, initialize a Service object by passing in the path to the UNIX socket. It is then possible to establish connections to SCIOND by calling Connect or ConnectTimeout on the service. The connections implement interface Connector, whose methods can be used to talk to SCIOND.

Connector method calls return the entire answer of SCIOND.

Fields prefixed with Raw (e.g., RawErrorCode) contain data in the format received from SCIOND. These are used internally, and the accessors without the prefix (e.g., ErrorCode()) should be used instead.

Index

Constants

View Source
const (
	// DefaultAPIAddress contains the system default for a daemon API socket.
	DefaultAPIAddress = "127.0.0.1:30255"
	// DefaultAPIPort contains the default port for a daemon client API socket.
	DefaultAPIPort = 30255
)

Variables

View Source
var (
	ErrUnableToConnect = serrors.New("unable to connect to SCIOND")
)

Errors for SCIOND API requests

Functions

This section is empty.

Types

type ASInfo added in v0.6.0

type ASInfo struct {
	IA  addr.IA
	MTU uint16
}

ASInfo provides information about the local AS.

type Connector

type Connector interface {
	// LocalIA requests from SCIOND the local ISD-AS number.
	LocalIA(ctx context.Context) (addr.IA, error)
	// Paths requests from SCIOND a set of end to end paths between the source and destination.
	Paths(ctx context.Context, dst, src addr.IA, f PathReqFlags) ([]snet.Path, error)
	// ASInfo requests from SCIOND information about AS ia, the zero IA can be
	// use to detect the local IA.
	ASInfo(ctx context.Context, ia addr.IA) (ASInfo, error)
	// IFInfo requests from SCION Daemon addresses and ports of interfaces. Slice
	// ifs contains interface IDs of BRs. If empty, a fresh (i.e., uncached)
	// answer containing all interfaces is returned.
	IFInfo(ctx context.Context, ifs []common.IFIDType) (map[common.IFIDType]*net.UDPAddr, error)
	// SVCInfo requests from SCIOND information about addresses and ports of
	// infrastructure services.  Slice svcTypes contains a list of desired
	// service types. If unset, a fresh (i.e., uncached) answer containing all
	// service types is returned. The reply is a map from service type to URI of
	// the service.
	SVCInfo(ctx context.Context, svcTypes []addr.HostSVC) (map[addr.HostSVC]string, error)
	// RevNotification sends a raw revocation to SCIOND, as contained in an
	// SCMP message.
	RevNotificationFromRaw(ctx context.Context, b []byte) error
	// RevNotification sends a RevocationInfo message to SCIOND.
	RevNotification(ctx context.Context, sRevInfo *path_mgmt.SignedRevInfo) error
	// Close shuts down the connection to a SCIOND server.
	Close(ctx context.Context) error
}

A Connector is used to query SCIOND. All connector methods block until either an error occurs, or the method successfully returns.

type Metrics added in v0.6.0

type Metrics struct {
	Connects                   metrics.Counter
	PathsRequests              metrics.Counter
	ASRequests                 metrics.Counter
	InterfacesRequests         metrics.Counter
	ServicesRequests           metrics.Counter
	InterfaceDownNotifications metrics.Counter
}

Metrics can be used to inject metrics counters into the sciond API. Each counter may be set or unset.

type PathReqFlags

type PathReqFlags struct {
	Refresh bool
	Hidden  bool
}

type Querier added in v0.5.0

type Querier struct {
	Connector Connector
	IA        addr.IA
}

func (Querier) Query added in v0.5.0

func (q Querier) Query(ctx context.Context, dst addr.IA) ([]snet.Path, error)

type RevHandler added in v0.5.0

type RevHandler struct {
	Connector Connector
}

RevHandler is an adapter for sciond connector to implement snet.RevocationHandler.

func (RevHandler) RevokeRaw added in v0.5.0

func (h RevHandler) RevokeRaw(ctx context.Context, rawSRevInfo common.RawBytes)

type Service

type Service struct {
	// Address is the address of the SCION daemon to connect to.
	Address string
	// Metrics are the metric counters that should be incremented when using the
	// connector.
	Metrics Metrics
}

Service exposes the API to connect to a SCION daemon service.

func NewService

func NewService(name string) Service

NewService returns a SCIOND API connection factory. Deprecated: Use Service struct directly instead.

func (Service) Connect

func (s Service) Connect(ctx context.Context) (Connector, error)

type TopoQuerier added in v0.5.0

type TopoQuerier struct {
	Connector Connector
}

TopoQuerier can be used to get topology information from sciond.

func (TopoQuerier) UnderlayAnycast added in v0.6.0

func (h TopoQuerier) UnderlayAnycast(ctx context.Context, svc addr.HostSVC) (*net.UDPAddr, error)

UnderlayAnycast provides any address for the given svc type.

Directories

Path Synopsis
internal
Package mock_sciond is a generated GoMock package.
Package mock_sciond is a generated GoMock package.
Package pathprobe contains methods to probe scion paths.
Package pathprobe contains methods to probe scion paths.

Jump to

Keyboard shortcuts

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