network

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUnsupportedL4              common.ErrMsg = "unsupported SCION L4 protocol"
	ErrUnsupportedDestination     common.ErrMsg = "unsupported destination address type"
	ErrUnsupportedSCMPDestination common.ErrMsg = "unsupported SCMP destination address type"
	ErrUnsupportedQuotedL4Type    common.ErrMsg = "unsupported quoted L4 protocol type"
	ErrMalformedL4Quote           common.ErrMsg = "malformed L4 quote"
)
View Source
const OverflowLoggingInterval = 10 * time.Second

OverflowLoggingInterval is the minimum amount of time that needs to pass before another overflow logging message is printed (if needed).

View Source
const ReceiveBufferSize = 1 << 20

ReceiveBufferSize is the size of receive buffers used by the dispatcher.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConnHandler

type AppConnHandler struct {
	RoutingTable *IATable
	// Conn is the local socket to which the application is connected.
	Conn net.PacketConn
	// IPv4OverlayConn is the network connection to which egress IPv4 traffic
	// is sent.
	IPv4OverlayConn net.PacketConn
	// IPv6OverlayConn is the network connection to which egress IPv6 traffic
	// is sent.
	IPv6OverlayConn net.PacketConn
	Logger          log.Logger
}

AppConnHandler handles a single SCION application connection.

func (*AppConnHandler) Handle

func (h *AppConnHandler) Handle()

func (*AppConnHandler) RunAppToNetDataplane

func (h *AppConnHandler) RunAppToNetDataplane(ref registration.RegReference,
	ovConn net.PacketConn)

RunAppToNetDataplane moves packets from the application's socket to the overlay socket.

func (*AppConnHandler) RunRingToAppDataplane

func (h *AppConnHandler) RunRingToAppDataplane(r *ringbuf.Ring)

RunRingToAppDataplane moves packets from the application's ingress ring to the application's socket.

type AppConnManager

type AppConnManager struct {
	RoutingTable *IATable
	// IPv4OverlayConn is the network connection to which IPv4 egress traffic
	// is sent.
	IPv4OverlayConn net.PacketConn
	// IPv6OverlayConn is the network connection to which IPv6 egress traffic
	// is sent.
	IPv6OverlayConn net.PacketConn
}

AppConnManager handles new connections coming from SCION applications.

func (*AppConnManager) Handle

func (h *AppConnManager) Handle(conn net.PacketConn)

Handle passes conn off to a per-connection state handler.

type AppSocketServer

type AppSocketServer struct {
	Listener    *reliable.Listener
	ConnManager *AppConnManager
}

AppSocketServer accepts new connections coming from SCION apps, and hands them off to the registration + dataplane handler.

func (*AppSocketServer) Serve

func (s *AppSocketServer) Serve() error

type Destination

type Destination interface {
	// Send takes ownership of pkt, and then sends it to the location described
	// by this destination.
	Send(dp *NetToRingDataplane, pkt *respool.Packet)
}

func ComputeDestination

func ComputeDestination(packet *spkt.ScnPkt) (Destination, error)

func ComputeSCMPDestination

func ComputeSCMPDestination(packet *spkt.ScnPkt, header *scmp.Hdr) (Destination, error)

ComputeSCMPDestination decides which application to send the SCMP packet to. It also increments SCMP-related metrics.

func ComputeSCMPErrorDestination

func ComputeSCMPErrorDestination(packet *spkt.ScnPkt, header *scmp.Hdr) (Destination, error)

func ComputeSCMPGeneralDestination

func ComputeSCMPGeneralDestination(s *spkt.ScnPkt, header *scmp.Hdr) (Destination, error)

func ComputeUDPDestination

func ComputeUDPDestination(packet *spkt.ScnPkt, header *l4.UDP) (Destination, error)

type Dispatcher

type Dispatcher struct {
	RoutingTable      *IATable
	OverlaySocket     string
	ApplicationSocket string
	SocketFileMode    os.FileMode
}

func (*Dispatcher) ListenAndServe

func (d *Dispatcher) ListenAndServe() error

type IATable

type IATable struct {
	registration.IATable
}

IATable is a type-safe convenience wrapper around a generic routing table.

func NewIATable

func NewIATable(minPort, maxPort int) *IATable

func (*IATable) LookupID

func (t *IATable) LookupID(ia addr.IA, id uint64) (*TableEntry, bool)

func (*IATable) LookupPublic

func (t *IATable) LookupPublic(ia addr.IA, public *net.UDPAddr) (*TableEntry, bool)

func (*IATable) LookupService

func (t *IATable) LookupService(ia addr.IA, svc addr.HostSVC, bind net.IP) []*TableEntry

type NetToRingDataplane

type NetToRingDataplane struct {
	OverlayConn  net.PacketConn
	RoutingTable *IATable
}

NetToRingDataplane reads SCION packets from the overlay socket, routes them to determine the destination process, and then enqueues the packets on the application's ingress ring.

The rings are used to provide non-blocking IO for the overlay receiver.

func (*NetToRingDataplane) Run

func (dp *NetToRingDataplane) Run() error

type SCMPAppDestination

type SCMPAppDestination struct {
	ID uint64
}

func (*SCMPAppDestination) Send

type SCMPHandlerDestination

type SCMPHandlerDestination struct{}

func (SCMPHandlerDestination) Send

type SVCDestination

type SVCDestination addr.HostSVC

func (SVCDestination) Send

func (d SVCDestination) Send(dp *NetToRingDataplane, pkt *respool.Packet)

type SocketMetaHandler

type SocketMetaHandler interface {
	Handle(*conn.ReadMeta)
}

SocketMetaHandler processes OS socket metadata during reads.

type TableEntry

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

type UDPDestination

type UDPDestination net.UDPAddr

func (*UDPDestination) Send

func (d *UDPDestination) Send(dp *NetToRingDataplane, pkt *respool.Packet)

Jump to

Keyboard shortcuts

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