Documentation ¶
Index ¶
- func NewTorResover(proxy string) *madns.Resolver
- type OnionConn
- type OnionListener
- type OnionTransport
- func (t *OnionTransport) CanDial(a ma.Multiaddr) bool
- func (t *OnionTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tpt.CapableConn, error)
- func (t *OnionTransport) Listen(laddr ma.Multiaddr) (tpt.Listener, error)
- func (t *OnionTransport) Protocols() []int
- func (t *OnionTransport) Proxy() bool
- type OnionTransportC
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTorResover ¶
NewTorResover returns a no madns.Resolver that will resolve IP addresses over Tor.
TODO: This does not seem to work for TXT records. Look into if Tor can resolve TXT records.
Types ¶
type OnionConn ¶
OnionConn implement's go-libp2p-transport's Conn interface
func (*OnionConn) LocalMultiaddr ¶
LocalMultiaddr returns the local multiaddr for this connection
func (*OnionConn) RemoteMultiaddr ¶
RemoteMultiaddr returns the remote multiaddr for this connection
type OnionListener ¶
OnionListener implements go-libp2p-transport's Listener interface
func (*OnionListener) Accept ¶
func (l *OnionListener) Accept() (tpt.CapableConn, error)
Accept blocks until a connection is received returning go-libp2p-transport's Conn interface or an error if something went wrong
func (*OnionListener) Addr ¶
func (l *OnionListener) Addr() net.Addr
Addr returns the net.Addr interface which represents the local multiaddr we are listening on
func (*OnionListener) Multiaddr ¶
func (l *OnionListener) Multiaddr() ma.Multiaddr
Multiaddr returns the local multiaddr we are listening on
type OnionTransport ¶
type OnionTransport struct { // Connection upgrader for upgrading insecure stream connections to // secure multiplex connections. Upgrader *tptu.Upgrader // contains filtered or unexported fields }
OnionTransport implements go-libp2p-transport's Transport interface
func NewOnionTransport ¶
func NewOnionTransport(dialer proxy.Dialer, service *tor.OnionService, dialOnionOnly bool, upgrader *tptu.Upgrader) (*OnionTransport, error)
NewOnionTransport creates a new OnionTransport
func (*OnionTransport) CanDial ¶
func (t *OnionTransport) CanDial(a ma.Multiaddr) bool
CanDial returns true if this transport knows how to dial the given multiaddr.
Returning true does not guarantee that dialing this multiaddr will succeed. This function should *only* be used to preemptively filter out addresses that we can't dial.
func (*OnionTransport) Dial ¶
func (t *OnionTransport) Dial(ctx context.Context, raddr ma.Multiaddr, p peer.ID) (tpt.CapableConn, error)
Dial dials a remote peer. It should try to reuse local listener addresses if possible but it may choose not to.
func (*OnionTransport) Protocols ¶
func (t *OnionTransport) Protocols() []int
Protocols returns the list of terminal protocols this transport can dial.
func (*OnionTransport) Proxy ¶
func (t *OnionTransport) Proxy() bool
Proxy always returns false for the onion transport.
type OnionTransportC ¶
OnionTransportC is a type alias for OnionTransport constructors, for use with libp2p.New
func NewOnionTransportC ¶
func NewOnionTransportC(dialer proxy.Dialer, service *tor.OnionService, dialOnionOnly bool) OnionTransportC
NewOnionTransportC is a convenience function that returns a function suitable for passing into libp2p.Transport for host configuration