snet

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

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; both functions register an address-port pair with the local dispatcher. 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 and/or dispatcher.

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.

Important: not draining SCMP errors via Read calls can cause the dispatcher to shutdown the socket (see https://github.com/scionproto/scion/pull/1356). To prevent this on a Conn object with only Write calls, run a separate goroutine that continuously calls Read on the Conn.

Index

Constants

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 added in v0.5.0

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

Types

type BaseRouter added in v0.4.0

type BaseRouter struct {
	Querier PathQuerier
}

func (*BaseRouter) AllRoutes added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

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

func (c *Conn) SVC() addr.HostSVC

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 DataplanePath added in v0.7.0

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 DefaultPacketDispatcherService added in v0.4.0

type DefaultPacketDispatcherService struct {
	// Dispatcher is used to get packets from the local SCION Dispatcher process.
	Dispatcher reliable.Dispatcher
	// 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 injected into SCIONPacketConn.
	SCIONPacketConnMetrics SCIONPacketConnMetrics
}

DefaultPacketDispatcherService parses/serializes packets received from / sent to the dispatcher.

func (*DefaultPacketDispatcherService) Register added in v0.5.0

func (s *DefaultPacketDispatcherService) Register(ctx context.Context, ia addr.IA,
	registration *net.UDPAddr, svc addr.HostSVC) (PacketConn, uint16, error)

type DefaultReplyPather added in v0.7.0

type DefaultReplyPather struct{}

DefaultReplyPather constructs dataplane reply paths.

func (DefaultReplyPather) ReplyPath added in v0.7.0

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

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

type DefaultSCMPHandler added in v0.6.0

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 added in v0.6.0

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

type EpicAuths added in v0.7.0

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 added in v0.7.0

func (ea *EpicAuths) SupportsEpic() bool

type GeoCoordinates added in v0.6.0

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 IntraASPathQuerier added in v0.5.0

type IntraASPathQuerier struct {
	IA addr.IA
}

IntraASPathQuerier implements the PathQuerier interface. It will only provide AS internal paths, i.e., empty 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.

func (IntraASPathQuerier) Query added in v0.5.0

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

Query implements PathQuerier.

type L4Header added in v0.6.0

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

type LinkType added in v0.6.0

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 added in v0.7.0

func (lt LinkType) String() string

type Network

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

type OpError

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

func (*OpError) Error

func (e *OpError) Error() string

func (*OpError) RevInfo added in v0.4.0

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

type Packet added in v0.5.0

type Packet struct {
	Bytes
	PacketInfo
}

Packet describes a SCION packet.

func (*Packet) Decode added in v0.6.0

func (p *Packet) Decode() error

Decode decodes the Bytes buffer into PacketInfo.

func (*Packet) Serialize added in v0.6.0

func (p *Packet) Serialize() error

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

type PacketConn added in v0.4.0

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
	Close() error
}

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

type PacketDispatcherService added in v0.4.0

type PacketDispatcherService interface {
	Register(ctx context.Context, ia addr.IA, registration *net.UDPAddr,
		svc addr.HostSVC) (PacketConn, uint16, error)
}

PacketDispatcherService constructs SCION sockets where applications have fine-grained control over header fields.

type PacketInfo added in v0.5.0

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 added in v0.4.0

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 added in v0.5.0

type PathFingerprint string

func Fingerprint added in v0.6.0

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 added in v0.5.0

func (pf PathFingerprint) String() string

type PathInterface added in v0.5.0

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

PathInterface is an interface of the path.

func (PathInterface) String added in v0.6.0

func (iface PathInterface) String() string

type PathMetadata added in v0.6.0

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 added in v0.6.0

func (pm *PathMetadata) Copy() *PathMetadata

type PathQuerier added in v0.5.0

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

type Payload added in v0.6.0

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 added in v0.7.0

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 added in v0.7.0

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 added in v0.7.0

type RawReplyPath struct {
	Path path.Path
}

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

func (RawReplyPath) SetPath added in v0.7.0

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

type ReplyPather added in v0.7.0

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 added in v0.4.0

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 added in v0.4.0

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 added in v0.4.0

type SCIONAddress struct {
	IA   addr.IA
	Host addr.HostAddr
}

SCIONAddress is the fully-specified address of a host.

func (SCIONAddress) String added in v0.6.0

func (a SCIONAddress) String() string

type SCIONNetwork added in v0.3.0

type SCIONNetwork struct {
	LocalIA    addr.IA
	Dispatcher PacketDispatcherService
	// 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
}

SCIONNetwork is the SCION networking context.

func (*SCIONNetwork) Dial added in v0.5.0

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

Dial returns a SCION connection to remote. Nil values for listen are not supported yet. 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 net 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 added in v0.5.0

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

Listen registers listen with the dispatcher. Nil values for listen are not supported yet. 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".

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

type SCIONNetworkMetrics added in v0.7.0

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 added in v0.4.0

type SCIONPacketConn struct {
	// Conn is the connection to send/receive serialized packets on.
	Conn net.PacketConn
	// 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
}

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

func (*SCIONPacketConn) Close added in v0.4.0

func (c *SCIONPacketConn) Close() error

func (*SCIONPacketConn) ReadFrom added in v0.4.0

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

func (*SCIONPacketConn) SetDeadline added in v0.4.0

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

func (*SCIONPacketConn) SetReadDeadline added in v0.4.0

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

func (*SCIONPacketConn) SetWriteDeadline added in v0.4.0

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

func (*SCIONPacketConn) WriteTo added in v0.4.0

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

type SCIONPacketConnMetrics added in v0.7.0

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
	// DispatcherErrors records the number of dispatcher errors encountered.
	DispatcherErrors metrics.Counter
}

type SCMPDestinationUnreachable added in v0.6.0

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

SCMPDestinationUnreachable is the message that a destination is not reachable.

func (SCMPDestinationUnreachable) Code added in v0.6.0

Code returns the SCMP code.

func (SCMPDestinationUnreachable) Type added in v0.6.0

Type returns the SCMP type.

type SCMPEchoReply added in v0.6.0

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

SCMPEchoReply is the SCMP echo reply payload.

func (SCMPEchoReply) Code added in v0.6.0

Code returns the SCMP code.

func (SCMPEchoReply) Type added in v0.6.0

Type returns the SCMP type.

type SCMPEchoRequest added in v0.6.0

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

SCMPEchoRequest is the SCMP echo request payload.

func (SCMPEchoRequest) Code added in v0.6.0

Code returns the SCMP code.

func (SCMPEchoRequest) Type added in v0.6.0

Type returns the SCMP type.

type SCMPExternalInterfaceDown added in v0.6.0

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

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

func (SCMPExternalInterfaceDown) Code added in v0.6.0

Code returns the SCMP code.

func (SCMPExternalInterfaceDown) Type added in v0.6.0

Type returns the SCMP type.

type SCMPExternalInterfaceDownL4 added in v0.6.0

type SCMPExternalInterfaceDownL4 struct {
	slayers.SCMPExternalInterfaceDown
}

type SCMPHandler added in v0.4.0

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 dispatcher 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 added in v0.6.0

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

SCMPInternalConnectivityDown is the message that an internal interface is down.

func (SCMPInternalConnectivityDown) Code added in v0.6.0

Code returns the SCMP code.

func (SCMPInternalConnectivityDown) Type added in v0.6.0

Type returns the SCMP type.

type SCMPPacketTooBig added in v0.7.0

type SCMPPacketTooBig struct {
	MTU     uint16
	Payload []byte
}

SCMPPacketTooBig indicates that a packet was too big.

func (SCMPPacketTooBig) Code added in v0.7.0

Code returns the SCMP code.

func (SCMPPacketTooBig) Type added in v0.7.0

Type returns the SCMP type.

type SCMPParameterProblem added in v0.7.0

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

SCMPParameterProblem is the SCMP parameter problem message.

func (SCMPParameterProblem) Code added in v0.7.0

Code returns the SCMP code.

func (SCMPParameterProblem) Type added in v0.7.0

Type returns the SCMP type.

type SCMPPayload added in v0.6.0

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 SCMPTracerouteReply added in v0.6.0

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

SCMPTracerouteReply is the SCMP traceroute reply payload.

func (SCMPTracerouteReply) Code added in v0.6.0

Code returns the SCMP code.

func (SCMPTracerouteReply) Type added in v0.6.0

Type returns the SCMP type.

type SCMPTracerouteRequest added in v0.6.0

type SCMPTracerouteRequest struct {
	Identifier uint16
	Sequence   uint16
}

SCMPTracerouteRequest is the SCMP traceroute request payload.

func (SCMPTracerouteRequest) Code added in v0.6.0

Code returns the SCMP code.

func (SCMPTracerouteRequest) Type added in v0.6.0

Type returns the SCMP type.

type SVCAddr added in v0.5.0

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

SVCAddr is the address type for SVC destinations.

func (*SVCAddr) Copy added in v0.5.0

func (a *SVCAddr) Copy() *SVCAddr

Copy creates a deep copy of the address.

func (*SVCAddr) GetPath added in v0.5.0

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

GetPath returns a path with attached metadata.

func (*SVCAddr) Network added in v0.5.0

func (a *SVCAddr) Network() string

Network implements net.Addr interface.

func (*SVCAddr) String added in v0.5.0

func (a *SVCAddr) String() string

String implements net.Addr interface.

type SerializationOptions added in v0.4.0

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 UDPAddr added in v0.5.0

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

UDPAddr to be used when UDP host.

func ParseUDPAddr added in v0.5.0

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

ParseUDPAddr converts an address string to a SCION address. The supported formats are:

Recommended:

  • isd-as,ipv4:port (e.g., 1-ff00:0:300,192.168.1.1:8080)
  • isd-as,[ipv6]:port (e.g., 1-ff00:0:300,[f00d::1337]:8080)
  • isd-as,[ipv6%zone]:port (e.g., 1-ff00:0:300,[f00d::1337%zone]:8080)

Others:

  • isd-as,[ipv4]:port (e.g., 1-ff00:0:300,[192.168.1.1]:8080)
  • isd-as,[ipv4] (e.g., 1-ff00:0:300,[192.168.1.1])
  • isd-as,[ipv6] (e.g., 1-ff00:0:300,[f00d::1337])
  • isd-as,[ipv6%zone] (e.g., 1-ff00:0:300,[f00d::1337%zone])
  • isd-as,ipv4 (e.g., 1-ff00:0:300,192.168.1.1)
  • isd-as,ipv6 (e.g., 1-ff00:0:300,f00d::1337)
  • isd-as,ipv6%zone (e.g., 1-ff00:0:300,f00d::1337%zone)

Not supported:

  • isd-as,ipv6:port (caveat if ipv6:port builds a valid ipv6 address, it will successfully parse as ipv6 without error)

func (*UDPAddr) Copy added in v0.5.0

func (a *UDPAddr) Copy() *UDPAddr

Copy creates a deep copy of the address.

func (*UDPAddr) GetPath added in v0.5.0

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

GetPath returns a path with attached metadata.

func (*UDPAddr) Network added in v0.5.0

func (a *UDPAddr) Network() string

Network implements net.Addr interface.

func (*UDPAddr) Set added in v0.5.0

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

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

func (*UDPAddr) String added in v0.5.0

func (a *UDPAddr) String() string

String implements net.Addr interface.

func (*UDPAddr) Type added in v0.6.0

func (a *UDPAddr) Type() string

Type is used to satisfy the pflag.Value interface.

type UDPL4 added in v0.6.0

type UDPL4 struct {
	slayers.UDP
}

type UDPPayload added in v0.6.0

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.
QUIC/SCION implementation.
QUIC/SCION implementation.

Jump to

Keyboard shortcuts

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