transport

package
v0.0.0-...-d831735 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

*

i2np messages transports

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTransportAvailable = errors.New("no transports available")

error for when we have no transports available to use

Functions

This section is empty.

Types

type Transport

type Transport interface {
	// Accept accepts an incoming session.
	Accept() (net.Conn, error)

	// Addr returns an
	Addr() net.Addr

	// Set the router identity for this transport.
	// will bind if the underlying socket is not already
	// if the underlying socket is already bound update the RouterIdentity
	// returns any errors that happen if they do
	SetIdentity(ident router_identity.RouterIdentity) error

	// Obtain a transport session with a router given its RouterInfo.
	// If a session with this router is NOT already made attempt to create one and block until made or until an error happens
	// returns an established TransportSession and nil on success
	// returns nil and an error on error
	GetSession(routerInfo router_info.RouterInfo) (TransportSession, error)

	// return true if a routerInfo is compatable with this transport
	Compatable(routerInfo router_info.RouterInfo) bool

	// close the transport cleanly
	// blocks until done
	// returns an error if one happens
	Close() error

	// get the name of this tranport as a string
	Name() string
}

type TransportMuxer

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

muxes multiple transports into 1 Transport implements transport.Transport

func Mux

func Mux(t ...Transport) (tmux *TransportMuxer)

mux a bunch of transports together

func (*TransportMuxer) Close

func (tmux *TransportMuxer) Close() (err error)

close every transport that this transport muxer has

func (*TransportMuxer) Compatable

func (tmux *TransportMuxer) Compatable(routerInfo router_info.RouterInfo) (compat bool)

is there a transport that we mux that is compatable with this router info?

func (*TransportMuxer) GetSession

func (tmux *TransportMuxer) GetSession(routerInfo router_info.RouterInfo) (s TransportSession, err error)

get a transport session given a router info return session and nil if successful return nil and ErrNoTransportAvailable if we failed to get a session

func (*TransportMuxer) Name

func (tmux *TransportMuxer) Name() string

the name of this transport with the names of all the ones that we mux

func (*TransportMuxer) SetIdentity

func (tmux *TransportMuxer) SetIdentity(ident router_identity.RouterIdentity) (err error)

set the identity for every transport

type TransportSession

type TransportSession interface {
	// queue an i2np message to be sent over the session
	// will block as long as the send queue is full
	// does not block if the queue is not full
	QueueSendI2NP(msg i2np.I2NPMessage)
	// return how many i2np messages are not completely sent yet
	SendQueueSize() int
	// blocking read the next fully recv'd i2np message from this session
	ReadNextI2NP() (i2np.I2NPMessage, error)
	// close the session cleanly
	// returns any errors that happen while closing the session
	Close() error
}

a session between 2 routers for tranmitting i2np messages securly

Directories

Path Synopsis
i2p ssu transport implementation
i2p ssu transport implementation

Jump to

Keyboard shortcuts

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