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
- func GetDefaultSCIONDPath(ia *addr.IA) string
- type ASInfoReply
- type ASInfoReplyEntry
- type ASInfoReq
- type Adapter
- type Connector
- type FwdPathMeta
- type HostInfo
- type IFInfoReply
- type IFInfoReplyEntry
- type IFInfoRequest
- type MockConn
- func (m *MockConn) ASInfo(ia addr.IA) (*ASInfoReply, error)
- func (m *MockConn) ASInfoCtx(ctx context.Context, ia addr.IA) (*ASInfoReply, error)
- func (m *MockConn) Close() error
- func (m *MockConn) CloseCtx(ctx context.Context) error
- func (m *MockConn) IFInfo(ifs []common.IFIDType) (*IFInfoReply, error)
- func (m *MockConn) IFInfoCtx(ctx context.Context, ifs []common.IFIDType) (*IFInfoReply, error)
- func (m *MockConn) Paths(dst, src addr.IA, max uint16, f PathReqFlags) (*PathReply, error)
- func (m *MockConn) PathsCtx(ctx context.Context, dst, src addr.IA, max uint16, f PathReqFlags) (*PathReply, error)
- func (m *MockConn) RevNotification(sRevInfo *path_mgmt.SignedRevInfo) (*RevReply, error)
- func (m *MockConn) RevNotificationCtx(ctx context.Context, sRevInfo *path_mgmt.SignedRevInfo) (*RevReply, error)
- func (m *MockConn) RevNotificationFromRaw(b []byte) (*RevReply, error)
- func (m *MockConn) RevNotificationFromRawCtx(ctx context.Context, b []byte) (*RevReply, error)
- func (m *MockConn) SVCInfo(svcTypes []proto.ServiceType) (*ServiceInfoReply, error)
- func (m *MockConn) SVCInfoCtx(ctx context.Context, svcTypes []proto.ServiceType) (*ServiceInfoReply, error)
- func (m *MockConn) SetDeadline(t time.Time) error
- type MockService
- type PathErrorCode
- type PathInterface
- type PathReply
- type PathReplyEntry
- type PathReq
- type PathReqFlags
- type Pld
- type RevNotification
- type RevReply
- type RevResult
- type Service
- type ServiceInfoReply
- type ServiceInfoReplyEntry
- type ServiceInfoRequest
Constants ¶
const ( ASInfoTTL = time.Hour IFInfoTTL = time.Hour SVCInfoTTL = 10 * time.Second // DefaultSCIONDPath contains the system default for a SCIOND socket. DefaultSCIONDPath = "/run/shm/sciond/default.sock" )
Time to live for cache entries
Variables ¶
This section is empty.
Functions ¶
func GetDefaultSCIONDPath ¶
GetDefaultSCIONDPath return default sciond path for a given IA
Types ¶
type ASInfoReply ¶
type ASInfoReply struct {
Entries []ASInfoReplyEntry
}
type ASInfoReplyEntry ¶
func (*ASInfoReplyEntry) ISD_AS ¶
func (entry *ASInfoReplyEntry) ISD_AS() addr.IA
func (ASInfoReplyEntry) String ¶
func (entry ASInfoReplyEntry) String() string
type Connector ¶
type Connector interface { // Paths requests from SCIOND a set of end to end paths between src and // dst. max specifices the maximum number of paths returned. Paths(dst, src addr.IA, max uint16, f PathReqFlags) (*PathReply, error) PathsCtx(ctx context.Context, dst, src addr.IA, max uint16, f PathReqFlags) (*PathReply, error) // ASInfo requests from SCIOND information about AS ia. ASInfo(ia addr.IA) (*ASInfoReply, error) ASInfoCtx(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(ifs []common.IFIDType) (*IFInfoReply, error) IFInfoCtx(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(svcTypes []proto.ServiceType) (*ServiceInfoReply, error) SVCInfoCtx(ctx context.Context, svcTypes []proto.ServiceType) (*ServiceInfoReply, error) // RevNotification sends a raw revocation to SCIOND, as contained in an // SCMP message. RevNotificationFromRaw(b []byte) (*RevReply, error) RevNotificationFromRawCtx(ctx context.Context, b []byte) (*RevReply, error) // RevNotification sends a RevocationInfo message to SCIOND. RevNotification(sRevInfo *path_mgmt.SignedRevInfo) (*RevReply, error) RevNotificationCtx(ctx context.Context, sRevInfo *path_mgmt.SignedRevInfo) (*RevReply, error) // Close shuts down the connection to a SCIOND server. Close() error CloseCtx(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) 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 HostInfo ¶
type IFInfoReply ¶
type IFInfoReply struct {
RawEntries []IFInfoReplyEntry `capnp:"entries"`
}
type IFInfoReplyEntry ¶
type IFInfoRequest ¶
type MockConn ¶
type MockConn struct {
// contains filtered or unexported fields
}
MockConn represents a mock SCIOND Connector. See the documentation of MockService for more information about how to use MockConn. MockConn is safe for use from multiple goroutines.
func (*MockConn) ASInfo ¶
func (m *MockConn) ASInfo(ia addr.IA) (*ASInfoReply, error)
ASInfo is not implemented.
func (*MockConn) IFInfo ¶
func (m *MockConn) IFInfo(ifs []common.IFIDType) (*IFInfoReply, error)
IFInfo is not implemented.
func (*MockConn) Paths ¶
Paths returns the minimum-length paths from src to dst. If no path exists, the error code in the PathReply is set to ErrorNoPaths. If more than one minimum-length path exists, all minimum-length paths are returned.
Paths does not guarantee to represent a consistent snapshot of the SCION network if the backing multigraph is modified while Paths is running.
func (*MockConn) PathsCtx ¶ added in v0.2.0
func (m *MockConn) PathsCtx(ctx context.Context, dst, src addr.IA, max uint16, f PathReqFlags) (*PathReply, error)
PathsCtx is not implemented.
func (*MockConn) RevNotification ¶
func (m *MockConn) RevNotification(sRevInfo *path_mgmt.SignedRevInfo) (*RevReply, error)
RevNotification deletes the edge containing revInfo.IfID from the multigraph. RevNotification does not perform any validation of revInfo.
func (*MockConn) RevNotificationCtx ¶ added in v0.2.0
func (m *MockConn) RevNotificationCtx(ctx context.Context, sRevInfo *path_mgmt.SignedRevInfo) (*RevReply, error)
RevNotificationCtx is not implemented.
func (*MockConn) RevNotificationFromRaw ¶
RevNotificationFromRaw is not implemented.
func (*MockConn) RevNotificationFromRawCtx ¶ added in v0.2.0
RevNotificationFromRawCtx is not implemented.
func (*MockConn) SVCInfo ¶
func (m *MockConn) SVCInfo(svcTypes []proto.ServiceType) (*ServiceInfoReply, error)
SVCInfo is not implemented.
func (*MockConn) SVCInfoCtx ¶ added in v0.2.0
func (m *MockConn) SVCInfoCtx(ctx context.Context, svcTypes []proto.ServiceType) (*ServiceInfoReply, error)
SVCInfoCtx is not implemented.
type MockService ¶
type MockService struct {
// contains filtered or unexported fields
}
MockService represents a mock SCIOND service for use in testing, backed by an undirected multigraph. Connectors returned by method Connect will respond to Paths queries by exploring the graph. The graph does not care about AS types, so any connected sequence of ASes is a valid path. The shortest path is always returned. If multiple shortest paths exist, they are all returned. Cycles are not allowed in returned paths.
Revocations are supported. The mock considers all revocations valid without checking, and revoking an IFID results in its corresponding edge being deleted from the graph.
The graph is concurrency safe, so it is also possible to directly add or delete edges as the test is running (e.g., to manually force path changes or revocations).
For an example, see go/lib/pathmgr/pathmgr_test.go.
func NewMockService ¶
func NewMockService(g *graph.Graph) *MockService
NewMockService returns a mock SCIOND service on top of a SCION network graph.
func (*MockService) Connect ¶
func (m *MockService) Connect() (Connector, error)
func (*MockService) ConnectTimeout ¶
func (m *MockService) ConnectTimeout(timeout time.Duration) (Connector, error)
type PathErrorCode ¶
type PathErrorCode uint16
const ( ErrorOk PathErrorCode = iota ErrorNoPaths ErrorPSTimeout ErrorInternal ErrorBadSrcIA ErrorBadDstIA )
func (PathErrorCode) String ¶
func (c PathErrorCode) String() string
type PathInterface ¶
func (*PathInterface) ISD_AS ¶
func (iface *PathInterface) ISD_AS() addr.IA
func (PathInterface) String ¶
func (iface PathInterface) String() string
type PathReply ¶
type PathReply struct { ErrorCode PathErrorCode Entries []PathReplyEntry }
type PathReplyEntry ¶
type PathReplyEntry struct { Path *FwdPathMeta HostInfo HostInfo }
type PathReqFlags ¶
type PathReqFlags struct {
Refresh 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 (*Pld) ProtoId ¶
func (p *Pld) ProtoId() proto.ProtoIdType
type RevNotification ¶
type RevNotification struct {
SRevInfo *path_mgmt.SignedRevInfo
}
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. // The information is not guaranteed to be fresh, as the returned connector // caches ASInfo replies for ASInfoTTL time, IFInfo replies for IFInfoTTL // time and SVCInfo for SVCInfoTTL time. Connect() (Connector, error) // ConnectTimeout acts like Connect but takes a timeout. // // A negative timeout means infinite timeout. // // To check for timeout errors, type assert the returned error to // *net.OpError and call method Timeout(). ConnectTimeout(timeout time.Duration) (Connector, error) }
Service describes a SCIOND endpoint. New connections to SCIOND can be initialized via Connect and ConnectTimeout.
func NewService ¶
type ServiceInfoReply ¶
type ServiceInfoReply struct {
Entries []ServiceInfoReplyEntry
}
type ServiceInfoReplyEntry ¶
type ServiceInfoReplyEntry struct { ServiceType proto.ServiceType Ttl uint32 HostInfos []HostInfo }
type ServiceInfoRequest ¶
type ServiceInfoRequest struct {
ServiceTypes []proto.ServiceType
}