smp

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: 8 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MPListener

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

Waits for multiple incoming MPPeerSock connections Since the MPPeerSock itself is bound to a particular peer, it can only wait for one incoming connection Therefor, the MPListener can be used to wait for multiple Incoming peer connections

func NewMPListener

func NewMPListener(local string, options *MPListenerOptions) *MPListener

Instantiates a new MPListener

func (*MPListener) Listen

func (l *MPListener) Listen() error

Needs to be called to listen before waiting can be started

func (*MPListener) WaitForMPPeerSockConnect

func (l *MPListener) WaitForMPPeerSockConnect() (*snet.UDPAddr, error)

Waits for new incoming MPPeerSocks Should be called in a loop Using the returned addr, a new MPPeerSock can be instantiated That dials back to the incoming socket

func (*MPListener) WaitForMPPeerSockConnectWithContext added in v1.0.2

func (l *MPListener) WaitForMPPeerSockConnectWithContext(ctx context.Context) (*snet.UDPAddr, error)

Waits for new incoming MPPeerSocks Should be called in a loop Using the returned addr, a new MPPeerSock can be instantiated That dials back to the incoming socket

type MPListenerOptions

type MPListenerOptions struct {
	Transport string // "QUIC" | "SCION"
}

type MPPeerSock

type MPPeerSock struct {
	Peer                    *snet.UDPAddr
	OnPathsetChange         chan pathselection.PathSet
	OnConnectionsChange     chan []packets.UDPConn
	PathSelectionProperties []string // TODO: Design a real struct for this, string is only dummy
	PacketScheduler         packets.PacketScheduler
	Local                   string
	UnderlaySocket          socket.UnderlaySocket
	TransportConstructor    packets.TransportConstructor
	PathQualityDB           pathselection.PathQualityDatabase
	SelectedPathSet         *pathselection.PathSet
	Mode                    string
	Options                 *MPSocketOptions
	MetricsInterval         time.Duration

	PathSelectionInterval time.Duration
	// contains filtered or unexported fields
}

MPPeerSock This represents a multipath socket that can handle 1-n paths. Each socket is bound to a specific peer

func NewMPPeerSock

func NewMPPeerSock(local string, peer *snet.UDPAddr, options *MPSocketOptions) *MPPeerSock

Instantiates a new Multipath Peer Socket peer argument may be omitted for a socket waiting for an incoming connections

func (*MPPeerSock) Connect

func (mp *MPPeerSock) Connect(pathSetWrapper pathselection.CustomPathSelection, options *socket.ConnectOptions) error

A first approach could be to open connections over all Paths to later reduce time effort for switching paths

func (*MPPeerSock) DialAll

func (mp *MPPeerSock) DialAll(pathAlternatives *pathselection.PathSet, options *socket.ConnectOptions) error

Could call dialPath for all paths. However, not the connections over included should be idled or closed here

func (*MPPeerSock) Disconnect

func (mp *MPPeerSock) Disconnect() []error

func (*MPPeerSock) ForcePathSelection

func (mp *MPPeerSock) ForcePathSelection()

func (*MPPeerSock) GetAvailablePaths

func (mp *MPPeerSock) GetAvailablePaths() ([]snet.Path, error)

func (*MPPeerSock) Listen

func (mp *MPPeerSock) Listen() error

Listen on the provided local address This call does not wait for incoming connections and shout be called for both, waiting and dialing sockets

func (*MPPeerSock) Read

func (mp *MPPeerSock) Read(b []byte) (int, error)

Read from the peer over a specific path Here the socket could decide from which path to read or we have to read from all

func (*MPPeerSock) ReadStream

func (mp *MPPeerSock) ReadStream(b []byte) (int, error)

Read from the peer over a specific path Here the socket could decide from which path to read or we have to read from all

func (*MPPeerSock) SetMode

func (mp *MPPeerSock) SetMode(mode string)

Set Mode after intantiating the socket

func (*MPPeerSock) SetPeer

func (mp *MPPeerSock) SetPeer(peer *snet.UDPAddr)

Set Peer after instantiating the socket This does not connect automatically after changing the peer

func (*MPPeerSock) StartPathSelection

func (mp *MPPeerSock) StartPathSelection(sel pathselection.CustomPathSelection, noPeriodicPathSelection bool)

Performs the first pathselection run and if noPeriodicPathSelection is false, also starts the cyclic pathselection

func (*MPPeerSock) WaitForPeerConnect

func (mp *MPPeerSock) WaitForPeerConnect(sel pathselection.CustomPathSelection) (*snet.UDPAddr, error)

This method waits until a remote MPPeerSock calls connect to this socket's local address A pathselection may be passed, which lets the socket dialing back to its remote (e.g. for server-side path selection) Since the MPPeerSock waits for only one incoming connection to determine a new peer it starts waiting for other connections (if no selection passed) and fires the OnConnectionsChange event for each new incoming connection

func (*MPPeerSock) WaitForPeerConnectWithContext added in v1.0.3

func (mp *MPPeerSock) WaitForPeerConnectWithContext(ctx context.Context, sel pathselection.CustomPathSelection) (*snet.UDPAddr, error)

This method waits until a remote MPPeerSock calls connect to this socket's local address A pathselection may be passed, which lets the socket dialing back to its remote (e.g. for server-side path selection) Since the MPPeerSock waits for only one incoming connection to determine a new peer it starts waiting for other connections (if no selection passed) and fires the OnConnectionsChange event for each new incoming connection

func (*MPPeerSock) Write

func (mp *MPPeerSock) Write(b []byte) (int, error)

Write to the peer over a specific path Here the socket could decide over which path to write

func (*MPPeerSock) WriteStream

func (mp *MPPeerSock) WriteStream(b []byte) (int, error)

Write to the peer over a specific path Here the socket could decide over which path to write

type MPSocketOptions

type MPSocketOptions struct {
	Transport                   string // "QUIC" | "SCION"
	PathSelectionResponsibility string // "CLIENT" | "SERVER" | "BOTH"
	MultiportMode               bool
}

Jump to

Keyboard shortcuts

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