daemon

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 21 Imported by: 6

Documentation

Overview

Package daemon provides APIs for querying SCION Daemons.

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 the SCION Daemon")
)

Errors for SCION Daemon API requests

Functions

This section is empty.

Types

type ASInfo

type ASInfo struct {
	IA  addr.IA
	MTU uint16
}

ASInfo provides information about the local AS.

type Connector

type Connector interface {
	// LocalIA requests from the daemon the local ISD-AS number.
	LocalIA(ctx context.Context) (addr.IA, error)
	// Paths requests from the daemon 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 the daemon 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 the daemon 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 a list
	// of URIs of the service in the local AS.
	SVCInfo(ctx context.Context, svcTypes []addr.SVC) (map[addr.SVC][]string, error)
	// RevNotification sends a RevocationInfo message to the daemon.
	RevNotification(ctx context.Context, revInfo *path_mgmt.RevInfo) error
	// DRKeyGetASHostKey requests a AS-Host Key from the daemon.
	DRKeyGetASHostKey(ctx context.Context, meta drkey.ASHostMeta) (drkey.ASHostKey, error)
	// DRKeyGetHostASKey requests a Host-AS Key from the daemon.
	DRKeyGetHostASKey(ctx context.Context, meta drkey.HostASMeta) (drkey.HostASKey, error)
	// DRKeyGetHostHostKey requests a Host-Host Key from the daemon.
	DRKeyGetHostHostKey(ctx context.Context, meta drkey.HostHostMeta) (drkey.HostHostKey, error)
	// Close shuts down the connection to the daemon.
	Close() error
}

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

type Metrics

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 SCION Daemon API. Each counter may be set or unset.

type PathReqFlags

type PathReqFlags struct {
	Refresh bool
	Hidden  bool
}

type Querier

type Querier struct {
	Connector Connector
	IA        addr.IA
}

func (Querier) Query

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

type RevHandler

type RevHandler struct {
	Connector Connector
}

RevHandler is an adapter for SCION Daemon connector to implement snet.RevocationHandler.

func (RevHandler) Revoke

func (h RevHandler) Revoke(ctx context.Context, revInfo *path_mgmt.RevInfo) error

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 SCION Daemon API connection factory. Deprecated: Use Service struct directly instead.

func (Service) Connect

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

type TopoQuerier

type TopoQuerier struct {
	Connector Connector
}

TopoQuerier can be used to get topology information from the SCION Daemon.

func (TopoQuerier) UnderlayAnycast

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

UnderlayAnycast provides any address for the given svc type.

Directories

Path Synopsis
internal
Package mock_daemon is a generated GoMock package.
Package mock_daemon is a generated GoMock package.

Jump to

Keyboard shortcuts

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