sciond

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 16 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 (
	// DefaultSCIONDPath contains the system default for a SCIOND socket.
	DefaultSCIONDPath = "/run/shm/sciond/default.sock"
	// DefaultSocketFileMode allows read/write to the user and group only.
	DefaultSocketFileMode = 0770
)

Variables

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

Errors for SCIOND API requests

Functions

func GetDefaultSCIONDPath

func GetDefaultSCIONDPath(ia *addr.IA) string

GetDefaultSCIONDPath return default sciond path for a given IA

Types

type ASInfoReply

type ASInfoReply struct {
	Entries []ASInfoReplyEntry
}

type ASInfoReplyEntry

type ASInfoReplyEntry struct {
	RawIsdas addr.IAInt `capnp:"isdas"`
	Mtu      uint16
	IsCore   bool
}

func (*ASInfoReplyEntry) ISD_AS

func (entry *ASInfoReplyEntry) ISD_AS() addr.IA

func (ASInfoReplyEntry) String

func (entry ASInfoReplyEntry) String() string

type ASInfoReq

type ASInfoReq struct {
	Isdas addr.IAInt
}

func (ASInfoReq) String added in v0.4.0

func (r ASInfoReq) String() string

type Adapter

type Adapter struct{}

func (*Adapter) MsgKey

func (a *Adapter) MsgKey(msg proto.Cerealizable) string

func (*Adapter) MsgToRaw

func (a *Adapter) MsgToRaw(msg proto.Cerealizable) (common.RawBytes, error)

func (*Adapter) RawToMsg

func (a *Adapter) RawToMsg(b common.RawBytes) (proto.Cerealizable, error)

type Connector

type Connector interface {
	// Paths requests from SCIOND a set of end to end paths between src and
	// dst. max specifies the maximum number of paths returned.
	Paths(ctx context.Context, dst, src addr.IA, max uint16, f PathReqFlags) (*PathReply, error)
	// ASInfo requests from SCIOND information about AS ia.
	ASInfo(ctx context.Context, ia addr.IA) (*ASInfoReply, error)
	// IFInfo requests from SCIOND 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) (*IFInfoReply, 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.
	SVCInfo(ctx context.Context, svcTypes []proto.ServiceType) (*ServiceInfoReply, error)
	// RevNotification sends a raw revocation to SCIOND, as contained in an
	// SCMP message.
	RevNotificationFromRaw(ctx context.Context, b []byte) (*RevReply, error)
	// RevNotification sends a RevocationInfo message to SCIOND.
	RevNotification(ctx context.Context, sRevInfo *path_mgmt.SignedRevInfo) (*RevReply, error)
	// Close shuts down the connection to a SCIOND server.
	Close(ctx context.Context) error
}

A Connector is used to query SCIOND. The connector maintains an internal cache for interface, service and AS information. All connector methods block until either an error occurs, or the method successfully returns.

type FwdPathMeta

type FwdPathMeta struct {
	FwdPath    []byte
	Mtu        uint16
	Interfaces []PathInterface
	ExpTime    uint32
}

func (*FwdPathMeta) Copy added in v0.4.0

func (fpm *FwdPathMeta) Copy() *FwdPathMeta

func (*FwdPathMeta) DstIA

func (fpm *FwdPathMeta) DstIA() addr.IA

func (*FwdPathMeta) Expiry

func (fpm *FwdPathMeta) Expiry() time.Time

func (*FwdPathMeta) SrcIA

func (fpm *FwdPathMeta) SrcIA() addr.IA

func (*FwdPathMeta) String

func (fpm *FwdPathMeta) String() string

type IFInfoReply

type IFInfoReply struct {
	RawEntries []IFInfoReplyEntry `capnp:"entries"`
}

func (*IFInfoReply) Entries

func (reply *IFInfoReply) Entries() map[common.IFIDType]hostinfo.Host

Entries maps IFIDs to their addresses and ports; the map is rebuilt each time.

type IFInfoReplyEntry

type IFInfoReplyEntry struct {
	IfID     common.IFIDType
	HostInfo hostinfo.Host
}

type IFInfoRequest

type IFInfoRequest struct {
	IfIDs []common.IFIDType
}

func (IFInfoRequest) String added in v0.4.0

func (r IFInfoRequest) String() string

type PathErrorCode

type PathErrorCode uint16
const (
	ErrorOk PathErrorCode = iota
	ErrorNoPaths
	ErrorPSTimeout
	ErrorInternal
	ErrorBadSrcIA
	ErrorBadDstIA
)

func (PathErrorCode) String

func (c PathErrorCode) String() string

type PathInterface

type PathInterface struct {
	RawIsdas addr.IAInt `capnp:"isdas"`
	IfID     common.IFIDType
}

func NewPathInterface added in v0.4.0

func NewPathInterface(str string) (PathInterface, error)

func (*PathInterface) Equal added in v0.4.0

func (iface *PathInterface) Equal(other *PathInterface) bool

func (PathInterface) IA added in v0.4.0

func (iface PathInterface) IA() addr.IA

func (PathInterface) IfId added in v0.4.0

func (iface PathInterface) IfId() common.IFIDType

func (PathInterface) String

func (iface PathInterface) String() string

type PathReply

type PathReply struct {
	ErrorCode PathErrorCode
	Entries   []PathReplyEntry
}

func (*PathReply) String added in v0.4.0

func (r *PathReply) String() string

type PathReplyEntry

type PathReplyEntry struct {
	Path     *FwdPathMeta
	HostInfo hostinfo.Host
}

func (*PathReplyEntry) Copy added in v0.4.0

func (e *PathReplyEntry) Copy() *PathReplyEntry

func (*PathReplyEntry) String added in v0.4.0

func (e *PathReplyEntry) String() string

type PathReq

type PathReq struct {
	Dst      addr.IAInt
	Src      addr.IAInt
	MaxPaths uint16
	HPCfgs   []*path_mgmt.HPGroupId `capnp:"hpCfgs"`
	Flags    PathReqFlags
}

func (*PathReq) Copy

func (pathReq *PathReq) Copy() *PathReq

func (*PathReq) String added in v0.4.0

func (pathReq *PathReq) String() string

type PathReqFlags

type PathReqFlags struct {
	Refresh bool
	Hidden  bool
}

type Pld

type Pld struct {
	Id                 uint64
	Which              proto.SCIONDMsg_Which
	PathReq            *PathReq
	PathReply          *PathReply
	AsInfoReq          *ASInfoReq
	AsInfoReply        *ASInfoReply
	RevNotification    *RevNotification
	RevReply           *RevReply
	IfInfoRequest      *IFInfoRequest
	IfInfoReply        *IFInfoReply
	ServiceInfoRequest *ServiceInfoRequest
	ServiceInfoReply   *ServiceInfoReply
}

func NewPldFromRaw

func NewPldFromRaw(b common.RawBytes) (*Pld, error)

func (*Pld) ProtoId

func (p *Pld) ProtoId() proto.ProtoIdType

func (*Pld) String

func (p *Pld) String() string

type RevNotification

type RevNotification struct {
	SRevInfo *path_mgmt.SignedRevInfo
}

func (*RevNotification) String added in v0.4.0

func (rN *RevNotification) String() string

type RevReply

type RevReply struct {
	Result RevResult
}

type RevResult

type RevResult uint16
const (
	RevValid RevResult = iota
	RevStale
	RevInvalid
	RevUnknown
)

func (RevResult) String

func (c RevResult) String() string

type Service

type Service interface {
	// Connect connects to the SCIOND server described by Service. Future
	// method calls on the returned Connector request information from SCIOND.
	Connect(context.Context) (Connector, error)
}

Service describes a SCIOND endpoint. New connections to SCIOND can be initialized via Connect.

func NewService

func NewService(name string) Service

NewService returns a SCIOND API connection factory.

type ServiceInfoReply

type ServiceInfoReply struct {
	Entries []ServiceInfoReplyEntry
}

type ServiceInfoReplyEntry

type ServiceInfoReplyEntry struct {
	ServiceType proto.ServiceType
	Ttl         uint32
	HostInfos   []hostinfo.Host
}

type ServiceInfoRequest

type ServiceInfoRequest struct {
	ServiceTypes []proto.ServiceType
}

func (ServiceInfoRequest) String added in v0.4.0

func (r ServiceInfoRequest) String() string

Directories

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

Jump to

Keyboard shortcuts

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