Documentation ¶
Index ¶
- Constants
- Variables
- func ConnTypeToString(connType int) string
- func Listen(listen *net.UDPAddr) (*returnPathConn, error)
- type BasicConn
- type PacketGen
- type PacketGenMeta
- type PacketHandler
- type PacketHandlerMeta
- type PacketScheduler
- type PathMetrics
- type QUICReliableConn
- func (qc *QUICReliableConn) AcceptStream() (quic.Stream, error)
- func (qc *QUICReliableConn) AcceptStreamWithContext(ctx context.Context) (quic.Stream, error)
- func (qc *QUICReliableConn) Close() error
- func (qc *QUICReliableConn) Dial(addr snet.UDPAddr, path *snet.Path) error
- func (qc *QUICReliableConn) GetId() string
- func (qc *QUICReliableConn) GetInternalConn() quic.Stream
- func (qc *QUICReliableConn) GetMetrics() *PathMetrics
- func (qc *QUICReliableConn) GetPath() *snet.Path
- func (qc *QUICReliableConn) GetRemote() *snet.UDPAddr
- func (qc *QUICReliableConn) GetState() int
- func (qc *QUICReliableConn) GetType() int
- func (qc *QUICReliableConn) Listen(addr snet.UDPAddr) error
- func (qc *QUICReliableConn) LocalAddr() net.Addr
- func (qc *QUICReliableConn) MarkAsClosed() error
- func (qc *QUICReliableConn) Read(b []byte) (int, error)
- func (qc *QUICReliableConn) ReadStream(b []byte) (int, error)
- func (qc *QUICReliableConn) RemoteAddr() net.Addr
- func (qc *QUICReliableConn) SetDeadline(t time.Time) error
- func (qc *QUICReliableConn) SetId(id string)
- func (qc *QUICReliableConn) SetLocal(local snet.UDPAddr)
- func (qc *QUICReliableConn) SetPath(path *snet.Path)
- func (qc *QUICReliableConn) SetReadDeadline(t time.Time) error
- func (qc *QUICReliableConn) SetRemote(remote *snet.UDPAddr)
- func (qc *QUICReliableConn) SetStream(stream quic.Stream)
- func (qc *QUICReliableConn) SetWriteDeadline(t time.Time) error
- func (qc *QUICReliableConn) Write(b []byte) (int, error)
- func (qc *QUICReliableConn) WriteStream(b []byte) (int, error)
- type SCIONConn
- func (sc *SCIONConn) Close() error
- func (sc *SCIONConn) Dial(addr snet.UDPAddr, path *snet.Path) error
- func (qc *SCIONConn) GetId() string
- func (sc *SCIONConn) GetMetrics() *PathMetrics
- func (sc *SCIONConn) GetPath() *snet.Path
- func (sc *SCIONConn) GetRemote() *snet.UDPAddr
- func (sc *SCIONConn) GetType() int
- func (sc *SCIONConn) Listen(addr snet.UDPAddr) error
- func (sc *SCIONConn) LocalAddr() net.Addr
- func (sc *SCIONConn) MarkAsClosed() error
- func (sc *SCIONConn) Read(b []byte) (int, error)
- func (sc *SCIONConn) ReadStream(b []byte) (int, error)
- func (sc *SCIONConn) RemoteAddr() net.Addr
- func (sc *SCIONConn) SetDeadline(t time.Time) error
- func (qc *SCIONConn) SetId(id string)
- func (sc *SCIONConn) SetLocal(addr snet.UDPAddr)
- func (sc *SCIONConn) SetPath(path *snet.Path)
- func (sc *SCIONConn) SetReadDeadline(t time.Time) error
- func (sc *SCIONConn) SetRemote(remote *snet.UDPAddr)
- func (sc *SCIONConn) SetWriteDeadline(t time.Time) error
- func (sc *SCIONConn) Write(b []byte) (int, error)
- func (sc *SCIONConn) WriteStream(b []byte) (int, error)
- type SampleFirstPathScheduler
- func (ws *SampleFirstPathScheduler) Read(data []byte) (int, error)
- func (ws *SampleFirstPathScheduler) ReadStream(data []byte) (int, error)
- func (ws *SampleFirstPathScheduler) SetConnections(conns []UDPConn)
- func (ws *SampleFirstPathScheduler) Write(data []byte) (int, error)
- func (ws *SampleFirstPathScheduler) WriteStream(data []byte) (int, error)
- type TransportConstructor
- type UDPConn
Constants ¶
const (
PACKET_SIZE = 1400 // At the moment we work only with normal MTUs, no jumbo frames
)
Variables ¶
var ConnectionStates = newConnectionStates()
var ConnectionTypes = newConnectionTypes()
Functions ¶
func ConnTypeToString ¶
Types ¶
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 ¶
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 ¶
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) 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) 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) GetMetrics ¶
func (sc *SCIONConn) GetMetrics() *PathMetrics
func (*SCIONConn) MarkAsClosed ¶
func (*SCIONConn) ReadStream ¶
This simply wraps conn.Read and will later collect metrics
func (*SCIONConn) RemoteAddr ¶
RemoteAddr returns the remote network address.
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