Documentation ¶
Index ¶
- func GarlicOptions(s []string) func(*GarlicTCPConn) error
- func OnlyGarlic(b bool) func(*GarlicTCPConn) error
- func SAMPass(s string) func(*GarlicTCPConn) error
- func Transport(t tpt.Transport) func(*GarlicTCPConn) error
- type GarlicTCPConn
- func (t *GarlicTCPConn) Accept() (tpt.CapableConn, error)
- func (t *GarlicTCPConn) AcceptI2P() (*GarlicTCPConn, error)
- func (t *GarlicTCPConn) AcceptStream() (mux.MuxedStream, error)
- func (t *GarlicTCPConn) Addr() net.Addr
- func (t *GarlicTCPConn) Base32() string
- func (t *GarlicTCPConn) Base64() string
- func (t *GarlicTCPConn) Close() error
- func (t *GarlicTCPConn) Dial(c context.Context, m ma.Multiaddr, p peer.ID) (tpt.CapableConn, error)
- func (t *GarlicTCPConn) DialI2P(c context.Context, m ma.Multiaddr, p peer.ID) (*GarlicTCPConn, error)
- func (t *GarlicTCPConn) GetI2PKeys() (i2pkeys.I2PKeys, error)
- func (t *GarlicTCPConn) IsClosed() bool
- func (t *GarlicTCPConn) Listen() (tpt.CapableConn, error)
- func (t *GarlicTCPConn) ListenI2P() (*GarlicTCPConn, error)
- func (t *GarlicTCPConn) LocalMultiaddr() ma.Multiaddr
- func (t *GarlicTCPConn) MA() ma.Multiaddr
- func (t *GarlicTCPConn) Multiaddr() ma.Multiaddr
- func (t *GarlicTCPConn) OpenStream() (mux.MuxedStream, error)
- func (t *GarlicTCPConn) PrintOptions() []string
- func (t *GarlicTCPConn) RemoteMA() ma.Multiaddr
- func (t *GarlicTCPConn) RemoteMultiaddr() ma.Multiaddr
- func (t *GarlicTCPConn) Reset() error
- func (t *GarlicTCPConn) SAMAddress() string
- func (t *GarlicTCPConn) SAMHost() string
- func (t *GarlicTCPConn) SAMPort() string
- func (t *GarlicTCPConn) Stat() network.Stat
- func (t *GarlicTCPConn) Transport() tpt.Transport
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GarlicOptions ¶
func GarlicOptions(s []string) func(*GarlicTCPConn) error
GarlicOptions is a slice of string-formatted options to pass to the SAM API.
func OnlyGarlic ¶
func OnlyGarlic(b bool) func(*GarlicTCPConn) error
OnlyGarlic indicates that this connection will only be used to serve anonymous connections. It does nothing but indicate that for now.
func SAMPass ¶
func SAMPass(s string) func(*GarlicTCPConn) 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.
Types ¶
type GarlicTCPConn ¶
type GarlicTCPConn struct { *sam3.SAMConn *sam3.SAM *sam3.StreamSession *sam3.StreamListener i2pkeys.I2PKeys network.ConnSecurity // contains filtered or unexported fields }
GarlicTCPConn implements a Conn interface
func NewGarlicTCPConn ¶
func NewGarlicTCPConn(transport tpt.Transport, onlyGarlic bool, options []string) (*GarlicTCPConn, error)
NewGarlicTCPConn creates an I2P Connection struct from a fixed list of arguments
func NewGarlicTCPConnFromOptions ¶
func NewGarlicTCPConnFromOptions(opts ...func(*GarlicTCPConn) error) (*GarlicTCPConn, error)
NewGarlicTCPConnFromOptions creates a GarlicTCPConn using function arguments
func (*GarlicTCPConn) Accept ¶
func (t *GarlicTCPConn) Accept() (tpt.CapableConn, error)
Accept implements a listener
func (*GarlicTCPConn) AcceptI2P ¶
func (t *GarlicTCPConn) AcceptI2P() (*GarlicTCPConn, error)
AcceptI2P helps with Accept
func (*GarlicTCPConn) AcceptStream ¶
func (t *GarlicTCPConn) AcceptStream() (mux.MuxedStream, error)
AcceptStream lets us streammux
func (*GarlicTCPConn) Addr ¶
func (t *GarlicTCPConn) Addr() net.Addr
Addr returns the net.Addr version of the local Multiaddr
func (*GarlicTCPConn) Base32 ¶
func (t *GarlicTCPConn) Base32() string
Base32 returns the remotely-accessible base32 address of the gateway over i2p this is the one you want to use to visit it in the browser.
func (*GarlicTCPConn) Base64 ¶
func (t *GarlicTCPConn) Base64() string
Base64 returns the remotely-accessible base64 address of the gateway over I2P
func (*GarlicTCPConn) Close ¶
func (t *GarlicTCPConn) Close() error
Close ends a SAM session associated with a transport
func (*GarlicTCPConn) Dial ¶
func (t *GarlicTCPConn) Dial(c context.Context, m ma.Multiaddr, p peer.ID) (tpt.CapableConn, error)
Dial dials an I2P client connection to an i2p hidden service using a garlic64 multiaddr and returns a tpt.CapableConn
func (*GarlicTCPConn) DialI2P ¶
func (t *GarlicTCPConn) DialI2P(c context.Context, m ma.Multiaddr, p peer.ID) (*GarlicTCPConn, error)
DialI2P helps with Dial and returns a GarlicTCPConn
func (*GarlicTCPConn) GetI2PKeys ¶
func (t *GarlicTCPConn) GetI2PKeys() (i2pkeys.I2PKeys, error)
GetI2PKeys loads the i2p address keys and returns them.
func (*GarlicTCPConn) IsClosed ¶
func (t *GarlicTCPConn) IsClosed() bool
IsClosed says a connection is closed if t.StreamSession is nil because Close() nils it if it works. Might need to re-visit that.
func (*GarlicTCPConn) Listen ¶
func (t *GarlicTCPConn) Listen() (tpt.CapableConn, error)
Listen implements a listener
func (*GarlicTCPConn) ListenI2P ¶
func (t *GarlicTCPConn) ListenI2P() (*GarlicTCPConn, error)
ListenI2P helps with Listen
func (*GarlicTCPConn) LocalMultiaddr ¶
func (t *GarlicTCPConn) LocalMultiaddr() ma.Multiaddr
LocalMultiaddr returns the local multiaddr for this connection
func (*GarlicTCPConn) MA ¶
func (t *GarlicTCPConn) MA() ma.Multiaddr
MaBase64 gives us a multiaddr by converting an I2PAddr
func (*GarlicTCPConn) Multiaddr ¶
func (t *GarlicTCPConn) Multiaddr() ma.Multiaddr
Multiaddr returns the local Multiaddr
func (*GarlicTCPConn) OpenStream ¶
func (t *GarlicTCPConn) OpenStream() (mux.MuxedStream, error)
OpenStream lets us streammux
func (*GarlicTCPConn) PrintOptions ¶
func (t *GarlicTCPConn) PrintOptions() []string
PrintOptions returns the options passed to the SAM bridge as a slice of strings.
func (*GarlicTCPConn) RemoteMA ¶
func (t *GarlicTCPConn) RemoteMA() ma.Multiaddr
RemoteMA gives us a multiaddr for the remote peer
func (*GarlicTCPConn) RemoteMultiaddr ¶
func (t *GarlicTCPConn) RemoteMultiaddr() ma.Multiaddr
RemoteMultiaddr returns the remote multiaddr for this connection
func (*GarlicTCPConn) Reset ¶
func (t *GarlicTCPConn) Reset() error
Reset lets us streammux, I need to re-examine how to implement it.
func (*GarlicTCPConn) SAMAddress ¶
func (t *GarlicTCPConn) SAMAddress() string
SAMAddress combines them and returns a full address.
func (*GarlicTCPConn) SAMHost ¶
func (t *GarlicTCPConn) SAMHost() string
SAMHost returns the IP address of the configured SAM bridge
func (*GarlicTCPConn) SAMPort ¶
func (t *GarlicTCPConn) SAMPort() string
SAMPort returns the Port of the configured SAM bridge
func (*GarlicTCPConn) Stat ¶
func (t *GarlicTCPConn) Stat() network.Stat
Stat returns the local Multiaddr
func (*GarlicTCPConn) Transport ¶
func (t *GarlicTCPConn) Transport() tpt.Transport
Transport returns the GarlicTCPTransport to which the GarlicTCPConn belongs
type Option ¶
type Option func(*GarlicTCPConn) error
Option is a functional argument to the connection constructor