Documentation ¶
Index ¶
- func I2PAddrToMultiAddr(addr string) (ma.Multiaddr, error)
- func MultiAddrToI2PAddr(addr ma.Multiaddr) (string, error)
- type ConnWithoutAddr
- type Connection
- type I2PTransport
- func (i2p *I2PTransport) CanDial(addr ma.Multiaddr) bool
- func (i2p *I2PTransport) Close()
- func (i2p *I2PTransport) Dial(ctx context.Context, remoteAddress ma.Multiaddr, peerID peer.ID) (transport.CapableConn, error)
- func (i2p *I2PTransport) Listen(_ ma.Multiaddr) (transport.Listener, error)
- func (i2p *I2PTransport) Protocols() []int
- func (i2p *I2PTransport) Proxy() bool
- func (i2p *I2PTransport) String() string
- type Option
- type TransportBuilderFunc
- type TransportListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func I2PAddrToMultiAddr ¶
expects either a base32 or base64 i2p destination expects there to be no :port suffix to the address
Types ¶
type ConnWithoutAddr ¶
type ConnWithoutAddr interface { Read(b []byte) (n int, err error) Write(b []byte) (n int, err error) Close() error SetDeadline(t time.Time) error SetReadDeadline(t time.Time) error SetWriteDeadline(t time.Time) error }
ConnWithoutAddr is a net.Conn like but without LocalAddr and RemoteAddr.
type Connection ¶
type Connection struct { ConnWithoutAddr // contains filtered or unexported fields }
This struct only exists to satify libp2p interfaces
func NewConnection ¶
func NewConnection(conn ConnWithoutAddr, localAddr, remoteAddr ma.Multiaddr) (*Connection, error)
func (*Connection) LocalAddr ¶
func (c *Connection) LocalAddr() net.Addr
I don't think these are used anywhere.. but must match the interface
func (*Connection) LocalMultiaddr ¶
func (c *Connection) LocalMultiaddr() ma.Multiaddr
func (*Connection) RemoteAddr ¶
func (c *Connection) RemoteAddr() net.Addr
func (*Connection) RemoteMultiaddr ¶
func (c *Connection) RemoteMultiaddr() ma.Multiaddr
type I2PTransport ¶
type I2PTransport struct { // Connection upgrader for upgrading insecure stream connections to // secure multiplex connections. Upgrader transport.Upgrader // contains filtered or unexported fields }
func (*I2PTransport) CanDial ¶
func (i2p *I2PTransport) CanDial(addr ma.Multiaddr) bool
CanDial returns true if this transport believes it can dial the given multiaddr.
func (*I2PTransport) Close ¶
func (i2p *I2PTransport) Close()
Closes all SAM sessions by closing the PRIMARY session
func (*I2PTransport) Dial ¶
func (i2p *I2PTransport) Dial(ctx context.Context, remoteAddress ma.Multiaddr, peerID peer.ID) (transport.CapableConn, error)
func (*I2PTransport) Listen ¶
input argument isn't used because we'll be listening on whichever destination is provided by i2p
func (*I2PTransport) Protocols ¶
func (i2p *I2PTransport) Protocols() []int
Protocols returns the list of protocols this transport can dial.
func (*I2PTransport) Proxy ¶
func (i2p *I2PTransport) Proxy() bool
Proxy always returns false for the I2P transport.
func (*I2PTransport) String ¶
func (i2p *I2PTransport) String() string
type Option ¶
type Option func(*I2PTransport) error
type TransportBuilderFunc ¶
type TransportBuilderFunc = func(transport.Upgrader) (*I2PTransport, error)
func I2PTransportBuilder ¶
func I2PTransportBuilder(sam *sam3.SAM, i2pKeys i2pkeys.I2PKeys, outboundPort string, rngSeed int) (TransportBuilderFunc, ma.Multiaddr, error)
returns a function that when called by go-libp2p, creates an I2PTransport Initializes SAM sessions/tunnel which can take about 4-25 seconds depending on i2p network conditions
type TransportListener ¶
type TransportListener struct {
// contains filtered or unexported fields
}
this struct only exists to satisfy the interface requirements for libp2p connection upgrader
func NewTransportListener ¶
func NewTransportListener(streamListener *sam3.StreamListener) (*TransportListener, error)
func (*TransportListener) Addr ¶
func (t *TransportListener) Addr() net.Addr
func (*TransportListener) Close ¶
func (t *TransportListener) Close() error
func (*TransportListener) Multiaddr ¶
func (t *TransportListener) Multiaddr() ma.Multiaddr