cs

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTracer

func InitTracer(tracing env.Tracing, id string) (io.Closer, error)

InitTracer initializes the global tracer.

func LoadClientChains

func LoadClientChains(db renewal.DB, configDir string) error

LoadClientChains loads the client certificate chains.

func LoadCorePolicies

func LoadCorePolicies(cfg config.Policies) (beacon.CorePolicies, error)

LoadCorePolicies loads the policies for beaconing in a core CS.

func LoadNonCorePolicies

func LoadNonCorePolicies(cfg config.Policies) (beacon.Policies, error)

LoadNonCorePolicies loads the policies for beaconing in a non-core CS.

func LoadTrustMaterial

func LoadTrustMaterial(configDir string, db trust.DB, logger log.Logger) error

LoadTrustMaterial loads the trust material from disk. The logger must not be nil.

func MACGenFactory

func MACGenFactory(configDir string) (func() hash.Hash, error)

MACGenFactory creates a MAC factory

func NewChainBuilder

func NewChainBuilder(ia addr.IA, db trust.DB, maxVal time.Duration,
	configDir string) cstrust.ChainBuilder

NewChainBuilder creates a renewing chain builder.

func NewOneHopConn

func NewOneHopConn(ia addr.IA, pub *net.UDPAddr, disp string,
	reconnecting bool) (*snet.SCIONPacketConn, error)

NewOneHopConn registers a new connection that should be used with one hop paths.

func NewSigner

func NewSigner(ia addr.IA, db trust.DB, cfgDir string) (cstrust.RenewingSigner, error)

NewSigner creates a renewing signer backed by a certificate chain..

func StartHTTPEndpoints

func StartHTTPEndpoints(elemId string, cfg interface{}, signer cstrust.RenewingSigner,
	ca cstrust.ChainBuilder, metrics env.Metrics) error

StartHTTPEndpoints starts the HTTP endpoints that expose the metrics and additional information.

Types

type Metrics

type Metrics struct {
	BeaconingOriginatedTotal               *prometheus.CounterVec
	BeaconingPropagatedTotal               *prometheus.CounterVec
	BeaconingPropagatorInternalErrorsTotal *prometheus.CounterVec
	BeaconingReceivedTotal                 *prometheus.CounterVec
	BeaconingRegisteredTotal               *prometheus.CounterVec
	BeaconingRegistrarInternalErrorsTotal  *prometheus.CounterVec
	DiscoveryRequestsTotal                 *prometheus.CounterVec
	SegmentLookupRequestsTotal             *prometheus.CounterVec
	SegmentLookupSegmentsSentTotal         *prometheus.CounterVec
	SegmentRegistrationsTotal              *prometheus.CounterVec
}

Metrics defines the metrics exposed by the control server.

XXX(roosd): Currently, most counters are created in the packages. The will eventually be moved here.

func NewMetrics

func NewMetrics() *Metrics

type RevocationHandler

type RevocationHandler struct {
	RevCache revcache.RevCache
}

RevocationHandler handles raw revocations from the snet stack and inserts them into the

func (RevocationHandler) RevokeRaw

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

type Store

type Store interface {
	// PreFilter indicates whether the beacon will be filtered on insert by
	// returning an error with the reason. This allows the caller to drop
	// ignored beacons.
	PreFilter(beacon beacon.Beacon) error
	// BeaconsToPropagate returns a channel that provides all beacons to
	// propagate at the time of the call. The selection is based on the
	// configured propagation policy.
	BeaconsToPropagate(ctx context.Context) (<-chan beacon.BeaconOrErr, error)
	// SegmentsToRegister returns a channel that provides all beacons to
	// register at the time of the call. The selections is based on the
	// configured propagation policy for the requested segment type.
	SegmentsToRegister(ctx context.Context, segType seg.Type) (
		<-chan beacon.BeaconOrErr, error)
	// InsertBeacon adds a verified beacon to the store, ignoring revocations.
	InsertBeacon(ctx context.Context, beacon beacon.Beacon) (beacon.InsertStats, error)
	// InsertRevocations inserts the revocation into the BeaconDB.
	// The provided revocation must be verified by the caller.
	InsertRevocations(ctx context.Context, revocations ...*path_mgmt.SignedRevInfo) error
	// DeleteRevocation deletes the revocation from the BeaconDB.
	DeleteRevocation(ctx context.Context, ia addr.IA, ifid common.IFIDType) error
	// UpdatePolicy updates the policy. Beacons that are filtered by all
	// policies after the update are removed.
	UpdatePolicy(ctx context.Context, policy beacon.Policy) error
	// MaxExpTime returns the segment maximum expiration time for the given policy.
	MaxExpTime(policyType beacon.PolicyType) uint8
	// DeleteExpired deletes expired Beacons from the store.
	DeleteExpiredBeacons(ctx context.Context) (int, error)
	// DeleteExpiredRevocations deletes expired Revocations from the store.
	DeleteExpiredRevocations(ctx context.Context) (int, error)
	// Close closes the store.
	Close() error
}

Store is the interface to interact with the beacon store.

type Tasks

type Tasks struct {
	Originator *periodic.Runner
	Propagator *periodic.Runner
	Registrars []*periodic.Runner

	BeaconCleaner *periodic.Runner
	PathCleaner   *periodic.Runner
}

Tasks keeps track of the running tasks.

func StartTasks

func StartTasks(cfg TasksConfig) (*Tasks, error)

func (*Tasks) Kill

func (t *Tasks) Kill()

Kill stops all running tasks immediately.

type TasksConfig

type TasksConfig struct {
	Public          *net.UDPAddr
	Intfs           *ifstate.Interfaces
	OneHopConn      snet.PacketConn
	TrustDB         trust.DB
	PathDB          pathdb.PathDB
	RevCache        revcache.RevCache
	BeaconSender    beaconing.BeaconSender
	SegmentRegister beaconing.RPC
	BeaconStore     Store
	Signer          seg.Signer
	Inspector       trust.Inspector
	Metrics         *Metrics

	MACGen       func() hash.Hash
	TopoProvider topology.Provider
	StaticInfo   func() *beaconing.StaticInfoCfg

	OriginationInterval  time.Duration
	PropagationInterval  time.Duration
	RegistrationInterval time.Duration

	AllowIsdLoop bool
}

TasksConfig holds the necessary configuration to start the periodic tasks a CS is expected to run.

func (*TasksConfig) Originator

func (t *TasksConfig) Originator() *periodic.Runner

Originator starts a periodic beacon origination task. For non-core ASes, no periodic runner is started.

func (*TasksConfig) Propagator

func (t *TasksConfig) Propagator() *periodic.Runner

Propagator starts a periodic beacon propagation task.

func (*TasksConfig) SegmentWriters

func (t *TasksConfig) SegmentWriters() []*periodic.Runner

SegmentWriters starts periodic segment registration tasks.

Directories

Path Synopsis
grpc/mock_grpc
Package mock_grpc is a generated GoMock package.
Package mock_grpc is a generated GoMock package.
mock_trust
Package mock_trust is a generated GoMock package.
Package mock_trust is a generated GoMock package.

Jump to

Keyboard shortcuts

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