scion

package
v0.5.0 Latest Latest
Warning

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

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

Documentation

Overview

Package connection/scion provides a simplified and functionally extended wrapper interface to the scionproto/scion package snet.

NOTE: this is identical with github.com/netsec-ethz/scion-apps/pkg/appnet, with some omissions

Dispatcher and SCION daemon connections

During the hidden initialisation of this package, the dispatcher and sciond connections are opened. The sciond connection determines the local IA. The dispatcher and sciond sockets are assumed to be at default locations, but this can be overridden using environment variables:

SCION_DISPATCHER_SOCKET: /run/shm/dispatcher/default.sock
SCION_DAEMON_ADDRESS: 127.0.0.1:30255

This is convenient for the normal use case of running the endhost stack for a single SCION AS. When running multiple local ASes, e.g. during development, the address of the sciond corresponding to the desired AS needs to be specified in the SCION_DAEMON_ADDRESS environment variable.

Wildcard IP Addresses

snet does not currently support binding to wildcard addresses. This will hopefully be added soon-ish, but in the meantime, this package emulates this functionality. There is one restriction, that applies to hosts with multiple IP addresses in the AS: the behaviour will be that of binding to one specific local IP address, which means that the application will not be reachable using any of the other IP addresses. Traffic sent will always appear to originate from this specific IP address, even if that's not the correct route to a destination in the local AS.

This restriction will very likely not cause any issues, as a fairly contrived network setup would be required. Also, sciond has a similar restriction (binds to one specific IP address).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialAddr

func DialAddr(raddr *snet.UDPAddr) (*snet.Conn, error)

DialAddr connects to the address (on the SCION/UDP network).

If no path is specified in raddr, DialAddr will choose the first available path. This path is never updated during the lifetime of the conn. This does not support long lived connections well, as the path *will* expire. This is all that snet currently provides, we'll need to add a layer on top that updates the paths in case they expire or are revoked.

func Listen

func Listen(listen *net.UDPAddr) (*snet.Conn, error)

Listen acts like net.ListenUDP in a SCION network. The listen address or parts of it may be nil or unspecified, signifying to listen on a wildcard address.

See note on wildcard addresses in the package documentation.

func ListenPort

func ListenPort(port uint16) (*snet.Conn, error)

ListenPort is a shortcut to Listen on a specific port with a wildcard IP address.

See note on wildcard addresses in the package documentation.

func QueryPaths

func QueryPaths(ia addr.IA) ([]snet.Path, error)

QueryPaths queries the DefNetwork's sciond PathQuerier connection for paths to addr If addr is in the local IA, an empty slice and no error is returned.

func SetDefaultPath

func SetDefaultPath(addr *snet.UDPAddr) error

SetDefaultPath sets the first path returned by a query to sciond. This is a no-op if if remote is in the local AS.

Types

type Network

type Network struct {
	snet.Network
	IA          addr.IA
	PathQuerier snet.PathQuerier
	// contains filtered or unexported fields
}

Network extends the snet.Network interface by making the local IA and common sciond connections public. The default singleton instance of this type is obtained by the DefNetwork function.

func DefNetwork

func DefNetwork() *Network

DefNetwork initialises and returns the singleton default Network. Typically, this will not be needed for applications directly, as they can use the simplified Dial/Listen functions provided here.

Jump to

Keyboard shortcuts

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