packets

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 8

Documentation

Index

Constants

View Source
const (
	PACKET_SIZE = 1400 // At the moment we work only with normal MTUs, no jumbo frames
)

Variables

View Source
var ConnectionStates = newConnectionStates()
View Source
var ConnectionTypes = newConnectionTypes()

Functions

func ConnTypeToString

func ConnTypeToString(connType int) string

func Listen

func Listen(listen *net.UDPAddr) (*returnPathConn, error)

Types

type BasicConn

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

func (*BasicConn) GetState

func (c *BasicConn) GetState() int

type PacketGen

type PacketGen interface {
	SetMeta(metrics PacketGenMeta)
	GetMetrics() PathMetrics
	// GetMetrics() PacketMetrics
	// Creating a SCION packet out of the provided payload
	// returns the full SCION packet in a new byte slice
	// Metrics are collected here, because all SCION header information
	// are available
	Generate(payload []byte, path snet.Path) ([]byte, error)
}

The Packetgenerator needs previously presented meta Furthermore, it collects metrics under the hood that can be queried using GetMetrics This is probably done by the MPPeerSock itself, who can then insert the metrics into the QualityDatabase To avoid having one Generator per path, the path can be passed individually for each packet

type PacketGenMeta

type PacketGenMeta struct {
	LocalAddr  snet.UDPAddr
	RemoteAddr snet.UDPAddr
}

Information required to create SCION common and address headers Path headers are then created using the path provided in the Generate func

type PacketHandler

type PacketHandler interface {
	SetMeta(PacketGenMeta)
	// GetMetrics() PacketMetrics
	// Handle works the other way round than generate
	// We put a full SCION packet (encoded) in the Handle func
	// and receive only the payload
	// Metrics are collected here, because all SCION header information
	// are available
	Handle([]byte) ([]byte, error)
}

type PacketHandlerMeta

type PacketHandlerMeta struct {
	LocalAddr snet.UDPAddr
}

Same as for PacketGenerator, however we need to elaborate Which types of information are really required here

type PacketScheduler

type PacketScheduler interface {
	Write([]byte) (int, error)
	Read([]byte) (int, error)
	WriteStream([]byte) (int, error)
	ReadStream([]byte) (int, error)
	SetConnections([]UDPConn)
}

PacketSchedulers have a list of "selected" paths which comes from the path selection module. These paths are considered "optimal" regarding the path selection properties that the application provides The scheduler decides for each packet over which of the optimal paths it will be sent

type PathMetrics

type PathMetrics struct {
	ReadBytes        int64
	LastReadBytes    int64
	ReadPackets      int64
	WrittenBytes     int64
	LastWrittenBytes int64
	WrittenPackets   int64
	ReadBandwidth    []int64
	WrittenBandwidth []int64
	MaxBandwidth     int64
	UpdateInterval   time.Duration
}

Some Metrics to start with Will be extended later NOTE: Add per path metrics here?

func NewPathMetrics

func NewPathMetrics(updateInterval time.Duration) *PathMetrics

func (*PathMetrics) Tick

func (m *PathMetrics) Tick()

type QUICReliableConn

type QUICReliableConn struct {
	Ready chan bool

	NoReturnPathConn bool
	// contains filtered or unexported fields
}

TODO: Implement SCION/QUIC here

func (*QUICReliableConn) AcceptStream

func (qc *QUICReliableConn) AcceptStream() (quic.Stream, error)

func (*QUICReliableConn) AcceptStreamWithContext added in v1.0.2

func (qc *QUICReliableConn) AcceptStreamWithContext(ctx context.Context) (quic.Stream, error)

func (*QUICReliableConn) Close

func (qc *QUICReliableConn) Close() error

func (*QUICReliableConn) Dial

func (qc *QUICReliableConn) Dial(addr snet.UDPAddr, path *snet.Path) error

func (*QUICReliableConn) GetId

func (qc *QUICReliableConn) GetId() string

func (*QUICReliableConn) GetInternalConn

func (qc *QUICReliableConn) GetInternalConn() quic.Stream

func (*QUICReliableConn) GetMetrics

func (qc *QUICReliableConn) GetMetrics() *PathMetrics

func (*QUICReliableConn) GetPath

func (qc *QUICReliableConn) GetPath() *snet.Path

func (*QUICReliableConn) GetRemote

func (qc *QUICReliableConn) GetRemote() *snet.UDPAddr

func (*QUICReliableConn) GetState

func (qc *QUICReliableConn) GetState() int

func (*QUICReliableConn) GetType

func (qc *QUICReliableConn) GetType() int

func (*QUICReliableConn) Listen

func (qc *QUICReliableConn) Listen(addr snet.UDPAddr) error

func (*QUICReliableConn) LocalAddr

func (qc *QUICReliableConn) LocalAddr() net.Addr

func (*QUICReliableConn) MarkAsClosed

func (qc *QUICReliableConn) MarkAsClosed() error

func (*QUICReliableConn) Read

func (qc *QUICReliableConn) Read(b []byte) (int, error)

This simply wraps conn.Read and will later collect metrics

func (*QUICReliableConn) ReadStream

func (qc *QUICReliableConn) ReadStream(b []byte) (int, error)

func (*QUICReliableConn) RemoteAddr

func (qc *QUICReliableConn) RemoteAddr() net.Addr

func (*QUICReliableConn) SetDeadline

func (qc *QUICReliableConn) SetDeadline(t time.Time) error

func (*QUICReliableConn) SetId

func (qc *QUICReliableConn) SetId(id string)

func (*QUICReliableConn) SetLocal

func (qc *QUICReliableConn) SetLocal(local snet.UDPAddr)

func (*QUICReliableConn) SetPath

func (qc *QUICReliableConn) SetPath(path *snet.Path)

func (*QUICReliableConn) SetReadDeadline

func (qc *QUICReliableConn) SetReadDeadline(t time.Time) error

func (*QUICReliableConn) SetRemote

func (qc *QUICReliableConn) SetRemote(remote *snet.UDPAddr)

func (*QUICReliableConn) SetStream

func (qc *QUICReliableConn) SetStream(stream quic.Stream)

func (*QUICReliableConn) SetWriteDeadline

func (qc *QUICReliableConn) SetWriteDeadline(t time.Time) error

func (*QUICReliableConn) Write

func (qc *QUICReliableConn) Write(b []byte) (int, error)

This simply wraps conn.Write and will later collect metrics

func (*QUICReliableConn) WriteStream

func (qc *QUICReliableConn) WriteStream(b []byte) (int, error)

type SCIONConn

type SCIONConn struct {
	BasicConn
	// contains filtered or unexported fields
}

This one extends a SCION connection to collect metrics for each connection Since a connection has always one path, the metrics are also path metrics 0.0.3: Collecting metrics for read and written bytes is better at a place where both information are available, so we put it here, not obsolete

func (*SCIONConn) Close

func (sc *SCIONConn) Close() error

func (*SCIONConn) Dial

func (sc *SCIONConn) Dial(addr snet.UDPAddr, path *snet.Path) error

func (*SCIONConn) GetId

func (qc *SCIONConn) GetId() string

func (*SCIONConn) GetMetrics

func (sc *SCIONConn) GetMetrics() *PathMetrics

func (*SCIONConn) GetPath

func (sc *SCIONConn) GetPath() *snet.Path

func (*SCIONConn) GetRemote

func (sc *SCIONConn) GetRemote() *snet.UDPAddr

func (*SCIONConn) GetType

func (sc *SCIONConn) GetType() int

func (*SCIONConn) Listen

func (sc *SCIONConn) Listen(addr snet.UDPAddr) error

func (*SCIONConn) LocalAddr

func (sc *SCIONConn) LocalAddr() net.Addr

func (*SCIONConn) MarkAsClosed

func (sc *SCIONConn) MarkAsClosed() error

func (*SCIONConn) Read

func (sc *SCIONConn) Read(b []byte) (int, error)

This simply wraps conn.Read and will later collect metrics

func (*SCIONConn) ReadStream

func (sc *SCIONConn) ReadStream(b []byte) (int, error)

This simply wraps conn.Read and will later collect metrics

func (*SCIONConn) RemoteAddr

func (sc *SCIONConn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*SCIONConn) SetDeadline

func (sc *SCIONConn) SetDeadline(t time.Time) error

func (*SCIONConn) SetId

func (qc *SCIONConn) SetId(id string)

func (*SCIONConn) SetLocal

func (sc *SCIONConn) SetLocal(addr snet.UDPAddr)

func (*SCIONConn) SetPath

func (sc *SCIONConn) SetPath(path *snet.Path)

func (*SCIONConn) SetReadDeadline

func (sc *SCIONConn) SetReadDeadline(t time.Time) error

func (*SCIONConn) SetRemote

func (sc *SCIONConn) SetRemote(remote *snet.UDPAddr)

func (*SCIONConn) SetWriteDeadline

func (sc *SCIONConn) SetWriteDeadline(t time.Time) error

func (*SCIONConn) Write

func (sc *SCIONConn) Write(b []byte) (int, error)

This simply wraps conn.Write and will later collect metrics

func (*SCIONConn) WriteStream

func (sc *SCIONConn) WriteStream(b []byte) (int, error)

This simply wraps conn.Write and will later collect metrics

type SampleFirstPathScheduler

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

Implements a PacketScheduler that calculates weights out of PathQualities and sends packets depending on the weight of each alternative

func NewWeighedScheduler

func NewWeighedScheduler(local snet.UDPAddr) *SampleFirstPathScheduler

func (*SampleFirstPathScheduler) Read

func (ws *SampleFirstPathScheduler) Read(data []byte) (int, error)

func (*SampleFirstPathScheduler) ReadStream

func (ws *SampleFirstPathScheduler) ReadStream(data []byte) (int, error)

func (*SampleFirstPathScheduler) SetConnections

func (ws *SampleFirstPathScheduler) SetConnections(conns []UDPConn)

func (*SampleFirstPathScheduler) Write

func (ws *SampleFirstPathScheduler) Write(data []byte) (int, error)

func (*SampleFirstPathScheduler) WriteStream

func (ws *SampleFirstPathScheduler) WriteStream(data []byte) (int, error)

type TransportConstructor

type TransportConstructor func() UDPConn

type UDPConn

type UDPConn interface {
	net.Conn
	Listen(snet.UDPAddr) error
	Dial(snet.UDPAddr, *snet.Path) error
	GetState() int
	GetMetrics() *PathMetrics
	GetPath() *snet.Path
	GetRemote() *snet.UDPAddr
	SetLocal(snet.UDPAddr)
	WriteStream([]byte) (int, error)
	ReadStream([]byte) (int, error)
	GetType() int
	GetId() string
	SetId(string)
	MarkAsClosed() error
}

func QUICConnConstructor

func QUICConnConstructor() UDPConn

func SCIONTransportConstructor

func SCIONTransportConstructor() UDPConn

Jump to

Keyboard shortcuts

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