i2ptcp

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2019 License: MIT Imports: 10 Imported by: 0

README

go-garlic-tcp-transport

A new, more consistent and useful libp2p transport for tcp-like messages over i2p. It uses the SAM Bridge and it works again, please report bugs to me at this git repository.

Relationship to sam3

This is essentially a shim between libp2p and sam3 which prepares all of the libp2p-specific parts on top of the sam3 Streaming connection and listener interfaces.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GarlicOptions

func GarlicOptions(s []string) func(*GarlicTCPTransport) error

func KeysPath

func KeysPath(s string) func(*GarlicTCPTransport) error

KeysPath sets the path to the keys, if no keys are present, they will be generated.

func LocalPeerID

func LocalPeerID(p peer.ID) func(*GarlicTCPTransport) error

func NewGarlicTCPTransport

func NewGarlicTCPTransport(host, port, pass string, keysPath string, onlyGarlic bool, options []string) (tpt.Transport, error)

NewGarlicTransport initializes a GarlicTransport for libp2p

func NewGarlicTCPTransportPeer

func NewGarlicTCPTransportPeer(id peer.ID, host, port, pass string, keysPath string, onlyGarlic bool, options []string) (tpt.Transport, error)

NewGarlicTransportPeer initializes a GarlicTransport for libp2p with a local peer.ID

func OnlyGarlic

func OnlyGarlic(b bool) func(*GarlicTCPTransport) error

func SAMHost

func SAMHost(s string) func(*GarlicTCPTransport) error

SAMHost sets the host of the SAM Bridge to use

func SAMPass

func SAMPass(s string) func(*GarlicTCPTransport) error

SAMPass sets the password to use when authenticating to the SAM bridge. It's ignored for now, and will return an error if it recieves a non-empty string.

func SAMPort

func SAMPort(s string) func(*GarlicTCPTransport) error

SAMPort sets the port of the SAM bridge to use

Types

type GarlicTCPTransport

type GarlicTCPTransport struct {
	i2ptcpconn.GarlicTCPConn

	HostSAM string
	PortSAM string
	PassSAM string
	// contains filtered or unexported fields
}

GarlicTCPTransport is a libp2p interface to an i2p TCP-like tunnel created via the SAM bridge

func NewGarlicTCPTransportFromOptions

func NewGarlicTCPTransportFromOptions(opts ...func(*GarlicTCPTransport) error) (*GarlicTCPTransport, error)

func (*GarlicTCPTransport) CanDial

func (t *GarlicTCPTransport) CanDial(m ma.Multiaddr) bool

CanDial implements transport.CanDial

func (*GarlicTCPTransport) CanDialI2P

func (t *GarlicTCPTransport) CanDialI2P(m ma.Multiaddr) bool

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

func (*GarlicTCPTransport) Dial

Dial returns a new GarlicConn

func (*GarlicTCPTransport) Listen

func (t *GarlicTCPTransport) Listen(addr ma.Multiaddr) (tpt.Listener, error)

Listen implements a connection, but addr is IGNORED here, it's drawn from the transport keys

func (*GarlicTCPTransport) ListenI2P

func (t *GarlicTCPTransport) ListenI2P() (*i2ptcpconn.GarlicTCPConn, error)

ListenI2P is like Listen, but it returns the GarlicTCPConn and doesn't require a multiaddr

func (*GarlicTCPTransport) Matches

func (t *GarlicTCPTransport) Matches(a ma.Multiaddr) bool

Matches returns true if the address is a valid garlic TCP multiaddr

func (*GarlicTCPTransport) MatchesI2P

func (t *GarlicTCPTransport) MatchesI2P(a ma.Multiaddr) bool

Matches returns true if the address is a valid garlic TCP multiaddr

func (*GarlicTCPTransport) PrintOptions

func (t *GarlicTCPTransport) PrintOptions() []string

func (*GarlicTCPTransport) Protocols

func (t *GarlicTCPTransport) Protocols() []int

Protocols need only return this I think

func (*GarlicTCPTransport) Proxy

func (t *GarlicTCPTransport) Proxy() bool

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

func (*GarlicTCPTransport) SAMAddress

func (t *GarlicTCPTransport) SAMAddress() string

func (*GarlicTCPTransport) SAMHost

func (t *GarlicTCPTransport) SAMHost() string

func (*GarlicTCPTransport) SAMPort

func (t *GarlicTCPTransport) SAMPort() string

type Option

type Option func(*GarlicTCPTransport) error

Option is a functional argument

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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