infraenv

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package infraenv contains convenience function common to SCION infra services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTLSConfig added in v0.6.0

func GenerateTLSConfig() (*tls.Config, error)

GenerateTLSConfig generates a self-signed certificate.

func NewRouter added in v0.4.0

func NewRouter(localIA addr.IA, sd env.Daemon) (snet.Router, error)

NewRouter constructs a path router for paths starting from localIA.

Types

type AddressRewriter added in v0.7.0

type AddressRewriter struct {
	// Router obtains path information to fill in address paths, if they are
	// required and missing.
	Router snet.Router
	// SVCRouter builds underlay addresses for intra-AS SVC traffic, based on
	// information found in the topology.
	SVCRouter SVCResolver
	// Resolver performs SVC resolution if enabled.
	Resolver Resolver
	// SVCResolutionFraction enables SVC resolution for traffic to SVC
	// destinations in a way that is also compatible with control plane servers
	// that do not implement the SVC Resolution Mechanism. The value represents
	// the percentage of time, out of the total available context timeout,
	// spent attempting to perform SVC resolution. If SVCResolutionFraction is
	// 0 or less, SVC resolution is never attempted. If it is between 0 and 1,
	// the remaining context timeout is multiplied by the value, and that
	// amount of time is spent waiting for an SVC resolution reply from the
	// server. If this times out, the data packet is sent with an SVC
	// destination. If the value is 1 or more, then legacy behavior is
	// disabled, and data packets are never sent to SVC destinations unless the
	// resolution step is successful.
	SVCResolutionFraction float64
}

AddressRewriter is used to compute paths and replace SVC destinations with unicast addresses.

func (AddressRewriter) RedirectToQUIC added in v0.7.0

func (r AddressRewriter) RedirectToQUIC(ctx context.Context,
	address net.Addr) (net.Addr, bool, error)

RedirectToQUIC takes an address and adds a path (if one does not already exist but is required), and replaces SVC destinations with QUIC unicast ones, if possible.

The returned boolean value is set to true if the remote server is QUIC-compatible and we have successfully discovered its address.

If the address is already unicast, no redirection to QUIC is attempted.

type NetworkConfig added in v0.4.0

type NetworkConfig struct {
	// IA is the local AS number.
	IA addr.IA
	// Public is the Internet-reachable address in the case where the service
	// is behind NAT.
	Public *net.UDPAddr
	// ReconnectToDispatcher sets up sockets that automatically reconnect if
	// the dispatcher closes the connection (e.g., if the dispatcher goes
	// down).
	ReconnectToDispatcher bool
	// QUIC contains configuration details for QUIC servers. If the listening
	// address is the empty string, then no QUIC socket is opened.
	QUIC QUIC
	// SVCResolver is used to discover the underlay addresses of intra-AS SVC
	// servers.
	SVCResolver SVCResolver
	// SCMPHandler is the SCMP handler to use. This handler is only applied to
	// client connections. The connection the server listens on will always
	// ignore SCMP messages. Otherwise, the server will shutdown when receiving
	// an SCMP error message.
	SCMPHandler snet.SCMPHandler
	// Metrics injected into SCIONNetwork.
	SCIONNetworkMetrics snet.SCIONNetworkMetrics
	// Metrics injected into DefaultPacketDispatcherService.
	SCIONPacketConnMetrics snet.SCIONPacketConnMetrics
}

NetworkConfig describes the networking configuration of a SCION control-plane RPC endpoint.

func (*NetworkConfig) AddressRewriter added in v0.4.0

func (nc *NetworkConfig) AddressRewriter(
	connFactory snet.PacketDispatcherService) *AddressRewriter

AddressRewriter initializes path and svc resolvers for infra servers.

The connection factory is used to open sockets for SVC resolution requests. If the connection factory is nil, the default connection factory is used.

func (*NetworkConfig) QUICStack added in v0.6.0

func (nc *NetworkConfig) QUICStack() (*QUICStack, error)

func (*NetworkConfig) TCPStack added in v0.6.0

func (nc *NetworkConfig) TCPStack() (net.Listener, error)

type QUIC added in v0.4.0

type QUIC struct {
	// Address is the UDP address to start the QUIC server on.
	Address string
}

QUIC contains the QUIC configuration for control-plane speakers.

type QUICStack added in v0.6.0

type QUICStack struct {
	Listener       *squic.ConnListener
	Dialer         *squic.ConnDialer
	RedirectCloser func()
}

QUICStack contains everything to run a QUIC based RPC stack.

type Resolver added in v0.7.0

type Resolver interface {
	// LookupSVC resolves the SVC address for the AS terminating the path.
	LookupSVC(ctx context.Context, path snet.Path, svc addr.HostSVC) (*svc.Reply, error)
}

Resolver performs SVC resolution for a remote AS, thus converting an anycast SVC address to a unicast IP/UDP one.

type SVCResolver added in v0.7.0

type SVCResolver interface {
	// GetUnderlay returns the underlay address of a SVC server of the specified
	// type. When multiple servers are available, the choice is random. If no
	// servers are available an error should be returned.
	GetUnderlay(svc addr.HostSVC) (*net.UDPAddr, error)
}

SVCResolver is used to construct underlay information for SVC servers running in the local AS.

Directories

Path Synopsis
Package mock_infraenv is a generated GoMock package.
Package mock_infraenv is a generated GoMock package.

Jump to

Keyboard shortcuts

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