i2pStreaming

package module
v0.0.0-...-fdd3868 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: MIT Imports: 21 Imported by: 0

README

i2p Streaming Transport for libp2p

Don't use this one. A better version which is consistent with the rest of libp2p is nearly ready. Still don't use it, even though I literally just pushed the code I've decided isn't thw worthwhile approach.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsValidGarlicMultiAddr

func IsValidGarlicMultiAddr(a i2pma.I2PMultiaddr) bool

IsValidGarlicMultiAddr is used to validate that a multiaddr is representing a I2P garlic service

func LoadKeys

func LoadKeys(keysPath string) (*sam3.I2PKeys, error)

LoadKeys loads keys into our keys from files in the keys directory

func RandTunName

func RandTunName() string

RandTunName generates a random tunnel names to avoid collisions

Types

type GarlicConn

type GarlicConn struct {
	i2pma.I2PMultiaddr
	*sam3.StreamSession
	*GarlicTransport
	// contains filtered or unexported fields
}

GarlicConn implements go-libp2p-transport's Conn interface

func NewGarlicConn

func NewGarlicConn(t *GarlicTransport, laddr *ma.Multiaddr, lPrivKey crypto.PrivKey, lPubKey crypto.PubKey, raddr i2pma.I2PMultiaddr, rPubKey crypto.PubKey) (GarlicConn, error)

func (GarlicConn) AcceptStream

func (c GarlicConn) AcceptStream() (streammux.Stream, error)

AcceptStream lets us streammux

func (GarlicConn) Close

func (c GarlicConn) Close() error

Close ends a SAM session associated with a transport

func (GarlicConn) Conn

func (c GarlicConn) Conn() net.Conn

Conn converts a GarlicConn to a net.Conn

func (GarlicConn) GetStreams

func (c GarlicConn) GetStreams() []net.Stream

GetStreams lets us streammux

func (GarlicConn) IsClosed

func (c GarlicConn) IsClosed() bool

IsClosed says a connection is close if a session hasn't been opened for now.

func (GarlicConn) LocalMultiaddr

func (c GarlicConn) LocalMultiaddr() ma.Multiaddr

LocalMultiaddr returns the local multiaddr for this connection

func (GarlicConn) LocalPeer

func (c GarlicConn) LocalPeer() peer.ID

LocalPeer returns the local peer.ID used for IPFS

func (GarlicConn) LocalPrivateKey

func (c GarlicConn) LocalPrivateKey() crypto.PrivKey

LocalPrivateKey returns the local private key used for the peer.ID

func (GarlicConn) NewStream

func (c GarlicConn) NewStream() (net.Stream, error)

func (GarlicConn) OpenStream

func (c GarlicConn) OpenStream() (streammux.Stream, error)

OpenStream lets us streammux

func (GarlicConn) Protocol

func (c GarlicConn) Protocol() protocol.ID

func (GarlicConn) Read

func (c GarlicConn) Read(b []byte) (int, error)

Read finishes implementing a net.Conn

func (GarlicConn) RemoteMultiaddr

func (c GarlicConn) RemoteMultiaddr() ma.Multiaddr

RemoteMultiaddr returns the remote multiaddr for this connection

func (GarlicConn) RemotePeer

func (c GarlicConn) RemotePeer() peer.ID

RemotePeer returns the remote peer.ID used for IPFS

func (GarlicConn) RemotePublicKey

func (c GarlicConn) RemotePublicKey() crypto.PubKey

RemotePublicKey returns the remote public key used for the peer.ID

func (GarlicConn) Reset

func (c GarlicConn) Reset() error

Reset lets us streammux

func (GarlicConn) SetDeadline

func (c GarlicConn) SetDeadline(t time.Time) error

func (GarlicConn) SetProtocol

func (c GarlicConn) SetProtocol(protocol.ID)

func (GarlicConn) SetReadDeadline

func (c GarlicConn) SetReadDeadline(t time.Time) error

func (GarlicConn) SetWriteDeadline

func (c GarlicConn) SetWriteDeadline(t time.Time) error

func (GarlicConn) Stat

func (c GarlicConn) Stat() net.Stat

func (GarlicConn) Transport

func (c GarlicConn) Transport() tpt.Transport

Transport returns the GarlicTransport associated with this GarlicConn

func (GarlicConn) Write

func (c GarlicConn) Write(b []byte) (int, error)

Write finishes implementing a net.Conn

type GarlicDialer

type GarlicDialer struct {
	GarlicConn
	// contains filtered or unexported fields
}

GarlicDialer implements a go-libp2p compatible Dialer

func NewGarlicDialer

func NewGarlicDialer(t *GarlicTransport, laddr ma.Multiaddr, raddr i2pma.I2PMultiaddr) (*GarlicDialer, error)

func (GarlicDialer) ClosePeer

func (d GarlicDialer) ClosePeer(id peer.ID) error

func (GarlicDialer) Connectedness

func (d GarlicDialer) Connectedness(id peer.ID) net.Connectedness

func (GarlicDialer) Conns

func (d GarlicDialer) Conns() []net.Conn

func (GarlicDialer) ConnsToPeer

func (d GarlicDialer) ConnsToPeer(p peer.ID) []net.Conn

func (*GarlicDialer) Dial

func (d *GarlicDialer) Dial(ctx context.Context, raddr i2pma.I2PMultiaddr, p peer.ID) (tpt.Conn, error)

func (*GarlicDialer) DialGarlic

func (d *GarlicDialer) DialGarlic(ctx context.Context, raddr i2pma.I2PMultiaddr, p peer.ID) (*GarlicConn, error)

func (GarlicDialer) DialPeer

func (d GarlicDialer) DialPeer(ctx context.Context, p peer.ID) (net.Conn, error)

func (GarlicDialer) LocalPeer

func (d GarlicDialer) LocalPeer() peer.ID

func (*GarlicDialer) Matches

func (d *GarlicDialer) Matches(a ma.Multiaddr) bool

func (*GarlicDialer) MatchesI2P

func (d *GarlicDialer) MatchesI2P(a i2pma.I2PMultiaddr) bool

func (GarlicDialer) Notify

func (d GarlicDialer) Notify(net.Notifiee)

func (GarlicDialer) Peers

func (d GarlicDialer) Peers() []peer.ID

func (GarlicDialer) Peerstore

func (d GarlicDialer) Peerstore() peerstore.Peerstore

func (GarlicDialer) StopNotify

func (d GarlicDialer) StopNotify(net.Notifiee)

type GarlicListener

type GarlicListener struct {
	*sam3.StreamListener
	*sam3.StreamSession
	*GarlicTransport
	GarlicConn
	// contains filtered or unexported fields
}

GarlicListener implements go-libp2p-transport's Listener interface

func NewGarlicListener

func NewGarlicListener(t *GarlicTransport, key sam3.I2PKeys, laddr ma.Multiaddr) (*GarlicListener, error)

NewGarlicListener creates a new GarlicListener implementing transport.Listener

func (*GarlicListener) Accept

func (l *GarlicListener) Accept() (tpt.Conn, error)

Accept blocks until a connection is received returning go-libp2p-transport's Conn interface or an error if something went wrong

func (*GarlicListener) Addr

func (l *GarlicListener) Addr() net.Addr

Addr returns the net.Addr interface which represents the local multiaddr we are listening on

func (*GarlicListener) Close

func (l *GarlicListener) Close() error

Close shuts down the listener

func (*GarlicListener) Listen

func (l *GarlicListener) Listen() (tpt.Listener, error)

Listen implements transport.Listener

func (*GarlicListener) Multiaddr

func (l *GarlicListener) Multiaddr() ma.Multiaddr

Multiaddr returns the local multiaddr we are listening on

type GarlicTransport

type GarlicTransport struct {
	*sam3.SAM
	*sam3.I2PKeys
	*GarlicListener
	*GarlicDialer
	SAMAddr string
	// contains filtered or unexported fields
}

GarlicTransport implements go-libp2p-transport's Transport interface

func NewGarlicTransport

func NewGarlicTransport(SAMAddr, SAMPort, SANPass string, keysPath string, onlyGarlic bool) (*GarlicTransport, error)

NewGarlicTransport initializes a GarlicTransport for libp2p

func (GarlicTransport) CanDial

func (t GarlicTransport) CanDial(m ma.Multiaddr) bool

CanDial implements transport.CanDial

func (GarlicTransport) CanDialI2P

func (t GarlicTransport) CanDialI2P(m i2pma.I2PMultiaddr) bool

CanDialI2P is a special CanDial function that only returns true if it's an i2p address.

func (GarlicTransport) Dial

Dial returns a new GarlicConn

func (GarlicTransport) Dialer

func (t GarlicTransport) Dialer(laddr ma.Multiaddr) (net.Dialer, error)

Dialer creates and returns a go-libp2p-transport Dialer

func (GarlicTransport) Listen

func (t GarlicTransport) Listen(laddr ma.Multiaddr) (tpt.Listener, error)

Listen creates and returns a go-libp2p-transport Listener

func (*GarlicTransport) Matches

func (t *GarlicTransport) Matches(a i2pma.I2PMultiaddr) bool

Matches returns true if the address is a valid onion multiaddr

func (GarlicTransport) Protocols

func (t GarlicTransport) Protocols() []int

Protocols need only return this I think

func (GarlicTransport) Proxy

func (t GarlicTransport) Proxy() bool

Proxy always returns false, we're using the SAM bridge to make our requests

Jump to

Keyboard shortcuts

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