snet

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: 30 Imported by: 15

Documentation

Overview

Package snet implements interfaces net.Conn and net.PacketConn for SCION connections.

New networking contexts can be created using NewNetwork. Calling the Dial or Listen methods on the networking context yields connections that run in that context.

A connection can be created by calling Dial or Listen. For Dial, the remote address is fixed, meaning only Read and Write can be used. Attempting to ReadFrom or WriteTo a connection created by Dial is an invalid operation. For Listen, the remote address cannot be fixed. ReadFrom can be used to read from the connection and find out the sender's address; and WriteTo can be used to send a message to a chosen destination.

Multiple networking contexts can share the same SCIOND.

Write calls never return SCMP errors directly. If a write call caused an SCMP message to be received by the Conn, it can be inspected by calling Read. In this case, the error value is non-nil and can be type asserted to *OpError. Method SCMP() can be called on the error to extract the SCMP header.

Index

Constants

View Source
const (
	// SCMPIdentifierStart and SCMPIdentiferEnd define the range for Identifiers
	// that should be used for SCMPEchoRequest and SCMPTracerouteRequest,
	// in preparation for a dispatcher-less snet.
	// This range corresponds to the port range used for SCION/UDP by the
	// dispatcher. Using the same range for Identifiers in SCMP requests will
	// allow a router to dispatch SCMP requests based on the Identifier,
	// without risk of interfering with unaware endpoints.
	//
	// WARNING: transitional, this will be removed in the dispatcher-less snet.
	SCMPIdentifierStart = 32768
	SCMPIdentifierEnd   = 65535
)
View Source
const (
	// LatencyUnset is the default value for a Latency entry in PathMetadata for
	// which no latency was announced.
	LatencyUnset time.Duration = -1
)

Variables

This section is empty.

Functions

func CopyUDPAddr

func CopyUDPAddr(a *net.UDPAddr) *net.UDPAddr

func RandomSCMPIdentifer added in v0.11.0

func RandomSCMPIdentifer() uint16

RandomSCMPIdentifier returns a random SCMP identifier in the range [SCMPIdentifierStart, SCMPIdentifierEnd].

WARNING: This is a transitional helper function, which will be removed in the dispatcher-less snet; then, the underlay port must be used as identifier.

Types

type BaseRouter

type BaseRouter struct {
	Querier PathQuerier
}

func (*BaseRouter) AllRoutes

func (r *BaseRouter) AllRoutes(ctx context.Context, dst addr.IA) ([]Path, error)

AllRoutes is the same as Route except that it returns multiple paths.

func (*BaseRouter) Route

func (r *BaseRouter) Route(ctx context.Context, dst addr.IA) (Path, error)

Route uses the specified path resolver (if one exists) to obtain a path from the local AS to dst.

type Bytes

type Bytes []byte

Bytes contains the raw slices of data related to a packet. Most callers can safely ignore it. For performance-critical applications, callers should manually allocate/recycle the Bytes.

Prior to serialization/decoding, the internal slice is reset to its full capacity, so be careful about passing in slices that have runoff data after their length.

After a packet has been serialized/decoded, the length of Contents will be equal to the size of the entire packet data. The capacity remains unchanged.

If Bytes is not initialized, space will be allocated during serialization/decoding.

func (*Bytes) Prepare

func (b *Bytes) Prepare()

Prepare readies a layer's storage for use.

If the layer is not allocated, a backing buffer of maximum packet size is allocated.

If the layer is already allocated, its length is reset to its capacity.

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

func NewCookedConn added in v0.12.0

func NewCookedConn(
	pconn PacketConn,
	topo Topology,
	options ...ConnOption,
) (*Conn, error)

NewCookedConn returns a "cooked" Conn. The Conn object can be used to send/receive SCION traffic with the usual methods. It takes as arguments a non-nil PacketConn and a non-nil Topology parameter. Nil or unspecified addresses for the PacketConn object are not supported. This is an advanced API, that allows fine-tunning of the Conn underlay functionality. The general methods for obtaining a Conn object are still SCIONNetwork.Listen and SCIONNetwork.Dial.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

Read reads data into b from a connection with a fixed remote address. If the remote address for the connection is unknown, Read returns an error. If a message is too long to fit in the supplied buffer, excess bytes may be discarded.

func (*Conn) ReadFrom

func (c *Conn) ReadFrom(b []byte) (int, net.Addr, error)

ReadFrom reads data into b, returning the length of copied data and the address of the sender. If a message is too long to fit in the supplied buffer, excess bytes may be discarded.

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

Write sends b through a connection with fixed remote address. If the remote address for the connection is unknown, Write returns an error.

func (*Conn) WriteTo

func (c *Conn) WriteTo(b []byte, raddr net.Addr) (int, error)

WriteTo sends b to raddr.

type ConnOption added in v0.12.0

type ConnOption func(o *options)

ConnOption is a functional option type for configuring a Conn.

func WithRemote added in v0.12.0

func WithRemote(addr *UDPAddr) ConnOption

WithRemote sets the remote address for the connection.

func WithReplyPather added in v0.12.0

func WithReplyPather(replyPather ReplyPather) ConnOption

WithReplyPather sets the reply pather for the connection. The reply pather is responsible for determining the path to send replies to. If the provided replyPather is not nil, it will be set as the reply pather for the connection.

type DataplanePath

type DataplanePath interface {
	// SetPath sets the path in the SCION header. It assumes that all the fields
	// except the path and path type are set correctly.
	SetPath(scion *slayers.SCION) error
}

DataplanePath is an abstract representation of a SCION dataplane path.

type DefaultReplyPather

type DefaultReplyPather struct{}

DefaultReplyPather constructs dataplane reply paths.

func (DefaultReplyPather) ReplyPath

func (DefaultReplyPather) ReplyPath(rpath RawPath) (DataplanePath, error)

ReplyPath takes a RawPath and reverses it to a suitable dataplane reply path.

type DefaultSCMPHandler

type DefaultSCMPHandler struct {
	// RevocationHandler manages revocations received via SCMP. If nil, the
	// handler is not called.
	RevocationHandler RevocationHandler
	// SCMPErrors reports the total number of SCMP Errors encountered.
	SCMPErrors metrics.Counter
}

DefaultSCMPHandler handles SCMP messages received from the network. If a revocation handler is configured, it is informed of any received interface down messages.

func (DefaultSCMPHandler) Handle

func (h DefaultSCMPHandler) Handle(pkt *Packet) error

type EpicAuths

type EpicAuths struct {
	// AuthPHVF is the authenticator for the penultimate hop.
	AuthPHVF []byte
	// AuthLHVF is the authenticator for the last hop
	AuthLHVF []byte
}

EpicAuths is a container for the EPIC hop authenticators.

func (*EpicAuths) SupportsEpic

func (ea *EpicAuths) SupportsEpic() bool

type GeoCoordinates

type GeoCoordinates struct {
	// Latitude of the geographic coordinate, in the WGS 84 datum.
	Latitude float32
	// Longitude of the geographic coordinate, in the WGS 84 datum.
	Longitude float32
	// Civic address of the location.
	Address string
}

GeoCoordinates describes a geographical position (of a border router on the path).

type L4Header

type L4Header interface {
	// contains filtered or unexported methods
}

type LinkType

type LinkType uint8

LinkType describes the underlying network for inter-domain links.

const (
	// LinkTypeUnset represents an unspecified link type.
	LinkTypeUnset LinkType = iota
	// LinkTypeDirect represents a direct physical connection.
	LinkTypeDirect
	// LinkTypeMultihop represents a connection with local routing/switching.
	LinkTypeMultihop
	// LinkTypeOpennet represents a connection overlayed over publicly routed Internet.
	LinkTypeOpennet
)

LinkType values

func (LinkType) String

func (lt LinkType) String() string

type Network

type Network interface {
	OpenRaw(ctx context.Context, addr *net.UDPAddr) (PacketConn, error)
	Listen(ctx context.Context, network string, listen *net.UDPAddr) (*Conn, error)
	Dial(ctx context.Context, network string, listen *net.UDPAddr, remote *UDPAddr) (*Conn, error)
}

type OpError

type OpError struct {
	// contains filtered or unexported fields
}

func (*OpError) Error

func (e *OpError) Error() string

func (*OpError) RevInfo

func (e *OpError) RevInfo() *path_mgmt.RevInfo

type Packet

type Packet struct {
	Bytes
	PacketInfo
}

Packet describes a SCION packet.

func (*Packet) Decode

func (p *Packet) Decode() error

Decode decodes the Bytes buffer into PacketInfo.

func (*Packet) Serialize

func (p *Packet) Serialize() error

Serialize serializes the PacketInfo into the raw buffer of the packet.

type PacketConn

type PacketConn interface {
	ReadFrom(pkt *Packet, ov *net.UDPAddr) error
	WriteTo(pkt *Packet, ov *net.UDPAddr) error
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error
	SetDeadline(t time.Time) error
	SyscallConn() (syscall.RawConn, error)
	LocalAddr() net.Addr
	Close() error
}

PacketConn gives applications easy access to writing and reading custom SCION packets.

type PacketInfo

type PacketInfo struct {
	// Destination contains the destination address.
	Destination SCIONAddress
	// Source contains the source address. If it is an SVC address, packet
	// serialization will return an error.
	Source SCIONAddress
	// Path contains a SCION forwarding path. This field must not be nil.
	Path DataplanePath
	// Payload is the Payload of the message.
	Payload Payload
}

PacketInfo contains the data needed to construct a SCION packet.

This is a high-level structure, and can only be used to create valid packets. The documentation for each field specifies cases where serialization might fail due to some violation of SCION protocol rules.

type Path

type Path interface {
	// UnderlayNextHop returns the address:port pair of a local-AS underlay
	// speaker. Usually, this is a border router that will forward the traffic.
	UnderlayNextHop() *net.UDPAddr
	// Dataplane returns a path that should be used in the dataplane. The
	// underlying dataplane path object is returned directly without any copy.
	// If you modify the raw data, you must ensure that there are no data races
	// or data corruption on your own.
	Dataplane() DataplanePath
	// Source is the AS the path starts from. Empty paths return the local
	// AS of the router that created them.
	Source() addr.IA
	// Destination is the AS the path points to. Empty paths return the local
	// AS of the router that created them.
	Destination() addr.IA
	// Metadata returns supplementary information about this path.
	// Returns nil if the metadata is not available.
	Metadata() *PathMetadata
}

Path is an abstract representation of a path. Most applications do not need access to the raw internals.

An empty path is a special kind of path that can be used for intra-AS traffic. Empty paths are valid return values for certain route calls (e.g., if the source and destination ASes match, or if a router was configured without a source of paths). An empty path only contains a Destination value, all other values are zero values.

type PathFingerprint

type PathFingerprint string

func Fingerprint

func Fingerprint(path Path) PathFingerprint

Fingerprint uniquely identifies the path based on the sequence of ASes and BRs, i.e. by its PathInterfaces. Other metadata, such as MTU or NextHop have no effect on the fingerprint. Returns empty string for paths where the interfaces list is not available.

func (PathFingerprint) String

func (pf PathFingerprint) String() string

type PathInterface

type PathInterface struct {
	// ID is the ID of the interface.
	ID iface.ID
	// IA is the ISD AS identifier of the interface.
	IA addr.IA
}

PathInterface is an interface of the path.

func (PathInterface) String

func (iface PathInterface) String() string

type PathMetadata

type PathMetadata struct {
	// Interfaces is a list of interfaces on the path.
	Interfaces []PathInterface

	// MTU is the maximum transmission unit for the path, in bytes.
	MTU uint16

	// Expiry is the expiration time of the path.
	Expiry time.Time

	// Latency lists the latencies between any two consecutive interfaces.
	// Entry i describes the latency between interface i and i+1.
	// Consequently, there are N-1 entries for N interfaces.
	// A negative value (LatencyUnset) indicates that the AS did not announce a
	// latency for this hop.
	Latency []time.Duration

	// Bandwidth lists the bandwidth between any two consecutive interfaces, in Kbit/s.
	// Entry i describes the bandwidth between interfaces i and i+1.
	// A 0-value indicates that the AS did not announce a bandwidth for this hop.
	Bandwidth []uint64

	// Geo lists the geographical position of the border routers along the path.
	// Entry i describes the position of the router for interface i.
	// A 0-value indicates that the AS did not announce a position for this router.
	Geo []GeoCoordinates

	// LinkType contains the announced link type of inter-domain links.
	// Entry i describes the link between interfaces 2*i and 2*i+1.
	LinkType []LinkType

	// InternalHops lists the number of AS internal hops for the ASes on path.
	// Entry i describes the hop between interfaces 2*i+1 and 2*i+2 in the same AS.
	// Consequently, there are no entries for the first and last ASes, as these
	// are not traversed completely by the path.
	InternalHops []uint32

	// Notes contains the notes added by ASes on the path, in the order of occurrence.
	// Entry i is the note of AS i on the path.
	Notes []string

	// EpicAuths contains the EPIC authenticators.
	EpicAuths EpicAuths
}

PathMetadata contains supplementary information about a path.

The information about MTU, Latency, Bandwidth etc. are based solely on data contained in the AS entries in the path construction beacons. These entries are signed/verified based on the control plane PKI. However, the *correctness* of this meta data has *not* been checked.

func (*PathMetadata) Copy

func (pm *PathMetadata) Copy() *PathMetadata

type PathQuerier

type PathQuerier interface {
	Query(context.Context, addr.IA) ([]Path, error)
}

type Payload

type Payload interface {
	// contains filtered or unexported methods
}

Payload is the payload of the message, use the different payload type to instantiate it.

type RawPath

type RawPath struct {
	PathType path.Type
	Raw      []byte
}

RawPath is the unprocessed path that is read from a received SCION packet

Packets that are received on the SCIONPacketConn contain a struct of this type in the Path field.

func (RawPath) SetPath

func (r RawPath) SetPath(s *slayers.SCION) error

SetPath is a dummy method to implement the DataplanePath interface. Consumers of SCIONPacketConn need to extract the path and handle it appropriately.

type RawReplyPath

type RawReplyPath struct {
	Path path.Path
}

RawReplyPath is a wrapper that implements the DataplanePath interface for any slayer path.

func (RawReplyPath) SetPath

func (p RawReplyPath) SetPath(s *slayers.SCION) error

type ReplyPather

type ReplyPather interface {
	// ReplyPath takes the RawPath of an incoming packet and creates a path
	// that can be used in a reply.
	ReplyPath(RawPath) (DataplanePath, error)
}

ReplyPather creates reply paths based on the incoming RawPath.

type RevocationHandler

type RevocationHandler interface {
	// RevokeRaw handles a revocation received as raw bytes.
	Revoke(ctx context.Context, revInfo *path_mgmt.RevInfo) error
}

RevocationHandler is called by the default SCMP Handler whenever revocations are encountered.

type Router

type Router interface {
	// Route returns a path from the local AS to dst. If dst matches the local
	// AS, an empty path is returned.
	Route(ctx context.Context, dst addr.IA) (Path, error)
	// AllRoutes is similar to Route except that it returns multiple paths.
	AllRoutes(ctx context.Context, dst addr.IA) ([]Path, error)
}

Router performs path resolution for SCION-speaking applications.

Most applications backed by SCIOND can use the default router implementation in this package. Applications that run SCIOND-less (PS, SD, BS) might be interested in spinning their own implementations.

type SCIONAddress

type SCIONAddress = addr.Addr

SCIONAddress is the fully-specified address of a host.

type SCIONNetwork

type SCIONNetwork struct {
	// Topology provides local AS information, needed to handle sockets and
	// traffic.
	Topology Topology
	// ReplyPather is used to create reply paths when reading packets on Conn
	// (that implements net.Conn). If unset, the default reply pather is used,
	// which parses the incoming path as a path.Path and reverses it.
	ReplyPather ReplyPather
	// Metrics holds the metrics emitted by the network.
	Metrics SCIONNetworkMetrics
	// SCMPHandler describes the network behaviour upon receiving SCMP traffic.
	SCMPHandler       SCMPHandler
	PacketConnMetrics SCIONPacketConnMetrics
}

SCIONNetwork is the SCION networking context.

func (*SCIONNetwork) Dial

func (n *SCIONNetwork) Dial(ctx context.Context, network string, listen *net.UDPAddr,
	remote *UDPAddr) (*Conn, error)

Dial returns a SCION connection to remote. Parameter network must be "udp". The returned connection's Read and Write methods can be used to receive and send SCION packets. Remote address requires a path and the underlay next hop to be set if the destination is in a remote AS.

The context is used for connection setup, it doesn't affect the returned connection.

func (*SCIONNetwork) Listen

func (n *SCIONNetwork) Listen(
	ctx context.Context,
	network string,
	listen *net.UDPAddr,
) (*Conn, error)

Listen opens a Conn. The returned connection's ReadFrom and WriteTo methods can be used to receive and send SCION packets with per-packet addressing. Parameter network must be "udp". Nil or unspecified addresses are not supported.

The context is used for connection setup, it doesn't affect the returned connection.

func (*SCIONNetwork) OpenRaw added in v0.12.0

func (n *SCIONNetwork) OpenRaw(ctx context.Context, addr *net.UDPAddr) (PacketConn, error)

OpenRaw returns a PacketConn which listens on the specified address. Nil or unspecified addresses are not supported. If the address port is 0 a valid and free SCION/UDP port is automatically chosen. Otherwise, the specified port must be a valid SCION/UDP port.

type SCIONNetworkMetrics

type SCIONNetworkMetrics struct {
	// Dials records the total number of Dial calls received by the network.
	Dials metrics.Counter
	// Listens records the total number of Listen calls received by the network.
	Listens metrics.Counter
}

type SCIONPacketConn

type SCIONPacketConn struct {
	// Conn is the connection to send/receive serialized packets on.
	Conn *net.UDPConn
	// SCMPHandler is invoked for packets that contain an SCMP L4. If the
	// handler is nil, errors are returned back to applications every time an
	// SCMP message is received.
	SCMPHandler SCMPHandler
	// Metrics are the metrics exported by the conn.
	Metrics SCIONPacketConnMetrics
	// contains filtered or unexported fields
}

SCIONPacketConn gives applications full control over the content of valid SCION packets.

func (*SCIONPacketConn) Close

func (c *SCIONPacketConn) Close() error

func (*SCIONPacketConn) LocalAddr added in v0.12.0

func (c *SCIONPacketConn) LocalAddr() net.Addr

func (*SCIONPacketConn) ReadFrom

func (c *SCIONPacketConn) ReadFrom(pkt *Packet, ov *net.UDPAddr) error

func (*SCIONPacketConn) SetDeadline

func (c *SCIONPacketConn) SetDeadline(d time.Time) error

func (*SCIONPacketConn) SetReadBuffer added in v0.12.0

func (c *SCIONPacketConn) SetReadBuffer(bytes int) error

func (*SCIONPacketConn) SetReadDeadline

func (c *SCIONPacketConn) SetReadDeadline(d time.Time) error

func (*SCIONPacketConn) SetWriteBuffer added in v0.12.0

func (c *SCIONPacketConn) SetWriteBuffer(bytes int) error

func (*SCIONPacketConn) SetWriteDeadline

func (c *SCIONPacketConn) SetWriteDeadline(d time.Time) error

func (*SCIONPacketConn) SyscallConn added in v0.12.0

func (c *SCIONPacketConn) SyscallConn() (syscall.RawConn, error)

func (*SCIONPacketConn) WriteTo

func (c *SCIONPacketConn) WriteTo(pkt *Packet, ov *net.UDPAddr) error

type SCIONPacketConnMetrics

type SCIONPacketConnMetrics struct {
	// Closes records the total number of Close calls on the connection.
	Closes metrics.Counter
	// ReadBytes records the total number of bytes read on the connection.
	ReadBytes metrics.Counter
	// WriteBytes records the total number of bytes written on the connection.
	WriteBytes metrics.Counter
	// ReadPackets records the total number of packets read on the connection.
	ReadPackets metrics.Counter
	// WritePackets records the total number of packets written on the connection.
	WritePackets metrics.Counter
	// ParseErrors records the total number of parse errors encountered.
	ParseErrors metrics.Counter
	// SCMPErrors records the total number of SCMP Errors encountered.
	SCMPErrors metrics.Counter
	// UnderlayConnectionErrors records the number of underlay connection errors encountered.
	UnderlayConnectionErrors metrics.Counter
}

type SCMPDestinationUnreachable

type SCMPDestinationUnreachable struct {
	Payload []byte
	// contains filtered or unexported fields
}

SCMPDestinationUnreachable is the message that a destination is not reachable.

func (SCMPDestinationUnreachable) Code

Code returns the SCMP code.

func (SCMPDestinationUnreachable) Type

Type returns the SCMP type.

type SCMPEchoReply

type SCMPEchoReply struct {
	Identifier uint16
	SeqNumber  uint16
	Payload    []byte
}

SCMPEchoReply is the SCMP echo reply payload.

func (SCMPEchoReply) Code

Code returns the SCMP code.

func (SCMPEchoReply) Type

Type returns the SCMP type.

type SCMPEchoRequest

type SCMPEchoRequest struct {
	Identifier uint16
	SeqNumber  uint16
	Payload    []byte
}

SCMPEchoRequest is the SCMP echo request payload.

func (SCMPEchoRequest) Code

Code returns the SCMP code.

func (SCMPEchoRequest) Type

Type returns the SCMP type.

type SCMPExternalInterfaceDown

type SCMPExternalInterfaceDown struct {
	IA        addr.IA
	Interface uint64
	Payload   []byte
}

SCMPExternalInterfaceDown is the message that indicates that an interface is down.

func (SCMPExternalInterfaceDown) Code

Code returns the SCMP code.

func (SCMPExternalInterfaceDown) Type

Type returns the SCMP type.

type SCMPExternalInterfaceDownL4

type SCMPExternalInterfaceDownL4 struct {
	slayers.SCMPExternalInterfaceDown
}

type SCMPHandler

type SCMPHandler interface {
	// Handle processes the packet as an SCMP packet. If packet is not SCMP, it
	// returns an error.
	//
	// If the handler returns an error value, snet will propagate the error
	// back to the caller. If the return value is nil, snet will reattempt to
	// read a data packet from the underlying connection.
	//
	// Handlers that wish to ignore SCMP can just return nil.
	//
	// If the handler mutates the packet, the changes are seen by snet
	// connection method callers.
	Handle(pkt *Packet) error
}

SCMPHandler customizes the way snet connections deal with SCMP.

type SCMPInternalConnectivityDown

type SCMPInternalConnectivityDown struct {
	IA              addr.IA
	Ingress, Egress uint64
	Payload         []byte
}

SCMPInternalConnectivityDown is the message that an internal interface is down.

func (SCMPInternalConnectivityDown) Code

Code returns the SCMP code.

func (SCMPInternalConnectivityDown) Type

Type returns the SCMP type.

type SCMPPacketTooBig

type SCMPPacketTooBig struct {
	MTU     uint16
	Payload []byte
}

SCMPPacketTooBig indicates that a packet was too big.

func (SCMPPacketTooBig) Code

Code returns the SCMP code.

func (SCMPPacketTooBig) Type

Type returns the SCMP type.

type SCMPParameterProblem

type SCMPParameterProblem struct {
	Pointer uint16
	Payload []byte
	// contains filtered or unexported fields
}

SCMPParameterProblem is the SCMP parameter problem message.

func (SCMPParameterProblem) Code

Code returns the SCMP code.

func (SCMPParameterProblem) Type

Type returns the SCMP type.

type SCMPPayload

type SCMPPayload interface {
	Payload
	// Type returns the type of the SCMP message as defined in slayers.
	Type() slayers.SCMPType
	// Code returns the code of the SCMP message as defined in slayers.
	Code() slayers.SCMPCode
}

SCMPPayload is the interface that all SCMP payloads must implement. It can be used to quickly check facts about an SCMP message.

type SCMPPropagationStopper added in v0.9.0

type SCMPPropagationStopper struct {
	// Handler is the wrapped handler.
	Handler SCMPHandler
	// Log is an optional function that is called when the wrapped handler
	// returns an error and propagation is stopped.
	Log func(msg string, ctx ...any)
}

SCMPPropagationStopper wraps an SCMP handler and stops propagation of the SCMP errors up the stack. This can be necessary if the client code aborts on unexpected errors. This is a temporary solution until we address https://github.com/scionproto/scion/issues/4389.

EXPERIMENTAL: This handler is experimental and may be removed in the future.

func (SCMPPropagationStopper) Handle added in v0.9.0

func (h SCMPPropagationStopper) Handle(pkt *Packet) error

type SCMPTracerouteReply

type SCMPTracerouteReply struct {
	Identifier uint16
	Sequence   uint16
	IA         addr.IA
	Interface  uint64
}

SCMPTracerouteReply is the SCMP traceroute reply payload.

func (SCMPTracerouteReply) Code

Code returns the SCMP code.

func (SCMPTracerouteReply) Type

Type returns the SCMP type.

type SCMPTracerouteRequest

type SCMPTracerouteRequest struct {
	Identifier uint16
	Sequence   uint16
}

SCMPTracerouteRequest is the SCMP traceroute request payload.

func (SCMPTracerouteRequest) Code

Code returns the SCMP code.

func (SCMPTracerouteRequest) Type

Type returns the SCMP type.

type SVCAddr

type SVCAddr struct {
	IA      addr.IA
	Path    DataplanePath
	NextHop *net.UDPAddr
	SVC     addr.SVC
}

SVCAddr is the address type for SVC destinations.

func (*SVCAddr) Copy

func (a *SVCAddr) Copy() *SVCAddr

Copy creates a deep copy of the address.

func (*SVCAddr) GetPath

func (a *SVCAddr) GetPath() (Path, error)

GetPath returns a path with attached metadata.

func (*SVCAddr) Network

func (a *SVCAddr) Network() string

Network implements net.Addr interface.

func (*SVCAddr) String

func (a *SVCAddr) String() string

String implements net.Addr interface.

type SerializationOptions

type SerializationOptions struct {
	// If ComputeChecksums is true, the checksums in sent Packets are
	// recomputed. Otherwise, the checksum value is left intact.
	ComputeChecksums bool
	// If FixLengths is true, any lengths in sent Packets are recomputed
	// to match the data contained in payloads/inner layers. This currently
	// concerns extension headers and the L4 header.
	FixLengths bool
	// If InitializePaths is set to true, then forwarding paths are reset to
	// their starting InfoField/HopField during serialization, irrespective of
	// previous offsets. If it is set to false, then the fields are left
	// unchanged.
	InitializePaths bool
}

type Topology added in v0.12.0

type Topology interface {
	LocalIA(ctx context.Context) (addr.IA, error)
	PortRange(ctx context.Context) (uint16, uint16, error)
	Interfaces(ctx context.Context) (map[uint16]netip.AddrPort, error)
}

Topology provides local-IA topology information

type UDPAddr

type UDPAddr struct {
	IA      addr.IA
	Path    DataplanePath
	NextHop *net.UDPAddr
	Host    *net.UDPAddr
}

UDPAddr to be used when UDP host.

func ParseUDPAddr

func ParseUDPAddr(s string) (*UDPAddr, error)

ParseUDPAddr converts an address string to a SCION address.

func (*UDPAddr) Copy

func (a *UDPAddr) Copy() *UDPAddr

Copy creates a deep copy of the address.

func (*UDPAddr) GetPath

func (a *UDPAddr) GetPath() (Path, error)

GetPath returns a path with attached metadata.

func (*UDPAddr) Network

func (a *UDPAddr) Network() string

Network implements net.Addr interface.

func (*UDPAddr) Set

func (a *UDPAddr) Set(s string) error

Set is used to satisfy the flag.Value and pflag.Value interface.

func (*UDPAddr) String

func (a *UDPAddr) String() string

String implements net.Addr interface.

func (*UDPAddr) Type

func (a *UDPAddr) Type() string

Type is used to satisfy the pflag.Value interface.

type UDPL4

type UDPL4 struct {
	slayers.UDP
}

type UDPPayload

type UDPPayload struct {
	SrcPort, DstPort uint16
	Payload          []byte
}

UDPPayload is a simple UDP payload.

Directories

Path Synopsis
Package metrics defines default initializers for the metrics structs that are used in the snet package.
Package metrics defines default initializers for the metrics structs that are used in the snet package.
Package mock_snet is a generated GoMock package.
Package mock_snet is a generated GoMock package.
Package path implements snet.Path with full metadata This is used by libraries that provide paths for applications to use, such as the path combinator and the SCION Daemon API.
Package path implements snet.Path with full metadata This is used by libraries that provide paths for applications to use, such as the path combinator and the SCION Daemon API.

Jump to

Keyboard shortcuts

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