Documentation
¶
Index ¶
- func IsValidGarlicMultiAddr(a i2pma.I2PMultiaddr) bool
- func LoadKeys(keysPath string) (*sam3.I2PKeys, error)
- func RandTunName() string
- type GarlicConn
- func (c GarlicConn) AcceptStream() (streammux.Stream, error)
- func (c GarlicConn) Close() error
- func (c GarlicConn) Conn() net.Conn
- func (c GarlicConn) GetStreams() []net.Stream
- func (c GarlicConn) IsClosed() bool
- func (c GarlicConn) LocalMultiaddr() ma.Multiaddr
- func (c GarlicConn) LocalPeer() peer.ID
- func (c GarlicConn) LocalPrivateKey() crypto.PrivKey
- func (c GarlicConn) NewStream() (net.Stream, error)
- func (c GarlicConn) OpenStream() (streammux.Stream, error)
- func (c GarlicConn) Protocol() protocol.ID
- func (c GarlicConn) Read(b []byte) (int, error)
- func (c GarlicConn) RemoteMultiaddr() ma.Multiaddr
- func (c GarlicConn) RemotePeer() peer.ID
- func (c GarlicConn) RemotePublicKey() crypto.PubKey
- func (c GarlicConn) Reset() error
- func (c GarlicConn) SetDeadline(t time.Time) error
- func (c GarlicConn) SetProtocol(protocol.ID)
- func (c GarlicConn) SetReadDeadline(t time.Time) error
- func (c GarlicConn) SetWriteDeadline(t time.Time) error
- func (c GarlicConn) Stat() net.Stat
- func (c GarlicConn) Transport() tpt.Transport
- func (c GarlicConn) Write(b []byte) (int, error)
- type GarlicDialer
- func (d GarlicDialer) ClosePeer(id peer.ID) error
- func (d GarlicDialer) Connectedness(id peer.ID) net.Connectedness
- func (d GarlicDialer) Conns() []net.Conn
- func (d GarlicDialer) ConnsToPeer(p peer.ID) []net.Conn
- func (d *GarlicDialer) Dial(ctx context.Context, raddr i2pma.I2PMultiaddr, p peer.ID) (tpt.Conn, error)
- func (d *GarlicDialer) DialGarlic(ctx context.Context, raddr i2pma.I2PMultiaddr, p peer.ID) (*GarlicConn, error)
- func (d GarlicDialer) DialPeer(ctx context.Context, p peer.ID) (net.Conn, error)
- func (d GarlicDialer) LocalPeer() peer.ID
- func (d *GarlicDialer) Matches(a ma.Multiaddr) bool
- func (d *GarlicDialer) MatchesI2P(a i2pma.I2PMultiaddr) bool
- func (d GarlicDialer) Notify(net.Notifiee)
- func (d GarlicDialer) Peers() []peer.ID
- func (d GarlicDialer) Peerstore() peerstore.Peerstore
- func (d GarlicDialer) StopNotify(net.Notifiee)
- type GarlicListener
- type GarlicTransport
- func (t GarlicTransport) CanDial(m ma.Multiaddr) bool
- func (t GarlicTransport) CanDialI2P(m i2pma.I2PMultiaddr) bool
- func (t GarlicTransport) Dial(c context.Context, m ma.Multiaddr, p peer.ID) (tpt.Conn, error)
- func (t GarlicTransport) Dialer(laddr ma.Multiaddr) (net.Dialer, error)
- func (t GarlicTransport) Listen(laddr ma.Multiaddr) (tpt.Listener, error)
- func (t *GarlicTransport) Matches(a i2pma.I2PMultiaddr) bool
- func (t GarlicTransport) Protocols() []int
- func (t GarlicTransport) Proxy() bool
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 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) 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) 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
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) 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) LocalPeer ¶
func (d GarlicDialer) LocalPeer() peer.ID
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) 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) 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