appnet

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 24 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

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

GenerateTLSConfig generates a self-signed certificate.

func NewRouter

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

NewRouter constructs a path router for paths starting from localIA.

Types

type AddressRewriter

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
}

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

func (AddressRewriter) RedirectToQUIC

func (r AddressRewriter) RedirectToQUIC(ctx context.Context,
	address net.Addr) (net.Addr, 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.

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

type IntraASPathQuerier added in v0.9.0

type IntraASPathQuerier struct {
	IA  addr.IA
	MTU uint16
}

IntraASPathQuerier implements the PathQuerier interface. It will only provide AS-internal paths, i.e., zero-hops paths with only the IA as destination. This should only be used in places where you know that you only need to communicate inside the AS. The type of Path returned is a complete implementation with proper metadata.

func (IntraASPathQuerier) Query added in v0.9.0

func (q IntraASPathQuerier) Query(_ context.Context, _ addr.IA) ([]snet.Path, error)

Query implements PathQuerier.

type NetworkConfig

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
	// QUIC contains configuration details for QUIC servers.
	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 SCIONPacketConn.
	SCIONPacketConnMetrics snet.SCIONPacketConnMetrics
	// MTU of the local AS
	MTU uint16
	// Topology is the helper class to get control-plane information for the
	// local AS.
	Topology snet.Topology
}

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

func (*NetworkConfig) AddressRewriter

func (nc *NetworkConfig) AddressRewriter() *AddressRewriter

AddressRewriter initializes path and svc resolvers for infra servers.

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

func (*NetworkConfig) QUICStack

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

func (*NetworkConfig) TCPStack

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

type QUIC

type QUIC struct {
	GetCertificate       func(*tls.ClientHelloInfo) (*tls.Certificate, error)
	GetClientCertificate func(*tls.CertificateRequestInfo) (*tls.Certificate, error)
	TLSVerifier          *trust.TLSCryptoVerifier
}

QUIC contains the QUIC configuration for control-plane speakers.

type QUICStack

type QUICStack struct {
	Listener       *squic.ConnListener
	InsecureDialer *squic.ConnDialer
	Dialer         *squic.ConnDialer
}

QUICStack contains everything to run a QUIC based RPC stack.

type Resolver

type Resolver interface {
	// LookupSVC resolves the SVC address for the AS terminating the path.
	LookupSVC(ctx context.Context, path snet.Path, svc addr.SVC) (*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

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.SVC) (*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