Documentation ¶
Index ¶
- Constants
- Variables
- func NewReadHexLogger(prefix string, r io.Reader) io.Reader
- func NewReadLogger(prefix string, r io.Reader) io.Reader
- func NewWriteLogger(prefix string, w io.Writer) io.Writer
- func SetAddr(s ...string) func(*Client) error
- func SetAddrMixed(s string, i int) func(*Client) error
- func SetCloseIdle(b bool) func(*Client) error
- func SetCloseIdleTime(u uint) func(*Client) error
- func SetCompression(b bool) func(*Client) error
- func SetDebug(b bool) func(*Client) error
- func SetEncrypt(b bool) func(*Client) error
- func SetFromPort(s string) func(*Client) error
- func SetFromPortInt(i int) func(*Client) error
- func SetHost(s string) func(*Client) error
- func SetInBackups(u uint) func(*Client) error
- func SetInLength(u uint) func(*Client) error
- func SetInQuantity(u uint) func(*Client) error
- func SetInVariance(i int) func(*Client) error
- func SetLocalDestination(s string) func(*Client) error
- func SetOutBackups(u uint) func(*Client) error
- func SetOutLength(u uint) func(*Client) error
- func SetOutQuantity(u uint) func(*Client) error
- func SetOutVariance(i int) func(*Client) error
- func SetPort(s string) func(*Client) error
- func SetPortInt(i int) func(*Client) error
- func SetReduceIdle(b bool) func(*Client) error
- func SetReduceIdleQuantity(u uint) func(*Client) error
- func SetReduceIdleTime(u uint) func(*Client) error
- func SetSignatureType(s string) func(*Client) error
- func SetToPort(s string) func(*Client) error
- func SetToPortInt(i int) func(*Client) error
- func SetUnpublished(b bool) func(*Client) error
- func WrapRWC(c io.ReadWriteCloser) io.ReadWriteCloser
- type Client
- func (c *Client) Accept() (net.Conn, error)
- func (c *Client) AcceptI2P() (net.Conn, error)
- func (p *Client) Addr() net.Addr
- func (c *Client) Base32() string
- func (c *Client) Base64() string
- func (c *Client) Close() error
- func (c *Client) CreateStreamSession(id int32, dest string) (string, error)
- func (c *Client) Destination() string
- func (c *Client) Dial(network, addr string) (net.Conn, error)
- func (c *Client) DialContext(ctx context.Context, network, addr string) (net.Conn, error)
- func (p *Client) ID() string
- func (c *Client) Listen() (net.Listener, error)
- func (c *Client) ListenI2P(dest string) (net.Listener, error)
- func (c *Client) Lookup(name string) (string, error)
- func (c *Client) NewClient() (*Client, error)
- func (c *Client) NewID() int32
- func (c *Client) Print() string
- func (c *Client) StreamAccept(id int32) (*Reply, error)
- func (c *Client) StreamConnect(id int32, dest string) error
- type Conn
- type Option
- type RWC
- type Reply
- type ReplyError
Constants ¶
const ( ResultOk = "OK" //Operation completed successfully ResultCantReachPeer = "CANT_REACH_PEER" //The peer exists, but cannot be reached ResultDuplicatedID = "DUPLICATED_ID" //If the nickname is already associated with a session : ResultDuplicatedDest = "DUPLICATED_DEST" //The specified Destination is already in use ResultI2PError = "I2P_ERROR" //A generic I2P error (e.g. I2CP disconnection, etc.) ResultInvalidKey = "INVALID_KEY" //The specified key is not valid (bad format, etc.) ResultKeyNotFound = "KEY_NOT_FOUND" //The naming system can't resolve the given name ResultPeerNotFound = "PEER_NOT_FOUND" //The peer cannot be found on the network ResultTimeout = "TIMEOUT" // Timeout while waiting for an event (e.g. peer answer) )
The Possible Results send by SAM
Variables ¶
var SAMsigTypes = []string{
"SIGNATURE_TYPE=DSA_SHA1",
"SIGNATURE_TYPE=ECDSA_SHA256_P256",
"SIGNATURE_TYPE=ECDSA_SHA384_P384",
"SIGNATURE_TYPE=ECDSA_SHA512_P521",
"SIGNATURE_TYPE=EdDSA_SHA512_Ed25519",
}
Functions ¶
func NewReadHexLogger ¶ added in v0.32.4
NewReadHexLogger returns a reader that behaves like r except that it logs to stderr using ecoding/hex.
func NewReadLogger ¶ added in v0.32.4
NewReadLogger returns a reader that behaves like r except that it logs (using log.Print) each read to standard error, printing the prefix and the hexadecimal data written.
func NewWriteLogger ¶ added in v0.32.4
NewWriteLogger returns a writer that behaves like w except that it logs (using log.Printf) each write to standard error, printing the prefix and the hexadecimal data written.
func SetAddrMixed ¶
SetAddrMixed sets a clients's address in the form host, port(int)
func SetCloseIdle ¶
SetCloseIdle sets the tunnels to close after a specific amount of time
func SetCloseIdleTime ¶
SetCloseIdleTime sets the time in milliseconds to wait before closing tunnels
func SetCompression ¶
SetCompression sets the tunnels to close after a specific amount of time
func SetEncrypt ¶
SetEncrypt tells the router to use an encrypted leaseset
func SetFromPort ¶
SetFromPort sets the port of the client's SAM bridge using a string
func SetFromPortInt ¶
SetFromPortInt sets the port of the client's SAM bridge using a string
func SetInBackups ¶
SetInBackups sets the inbound tunnel backups
func SetInLength ¶
SetInLength sets the number of hops inbound
func SetInQuantity ¶
SetInQuantity sets the inbound tunnel quantity
func SetInVariance ¶
SetInVariance sets the variance of a number of hops inbound
func SetLocalDestination ¶
SetLocalDestination sets the local destination of the tunnel from a private key
func SetOutBackups ¶
SetOutBackups sets the inbound tunnel backups
func SetOutLength ¶
SetOutLength sets the number of hops outbound
func SetOutQuantity ¶
SetOutQuantity sets the outbound tunnel quantity
func SetOutVariance ¶
SetOutVariance sets the variance of a number of hops outbound
func SetPortInt ¶
SetPortInt sets the port of the client's SAM bridge using a string
func SetReduceIdle ¶
SetReduceIdle sets the created tunnels to be reduced during extended idle time to avoid excessive resource usage
func SetReduceIdleQuantity ¶
SetReduceIdleQuantity sets number of tunnels to keep alive during an extended idle period
func SetReduceIdleTime ¶
SetReduceIdleTime sets time to wait before the tunnel quantity is reduced
func SetSignatureType ¶
SetSignatureType tells gosam to pass SAM a signature_type parameter with one of the following values:
"SIGNATURE_TYPE=DSA_SHA1", "SIGNATURE_TYPE=ECDSA_SHA256_P256", "SIGNATURE_TYPE=ECDSA_SHA384_P384", "SIGNATURE_TYPE=ECDSA_SHA512_P521", "SIGNATURE_TYPE=EdDSA_SHA512_Ed25519",
or an empty string
func SetToPortInt ¶
SetToPortInt sets the port of the client's SAM bridge using a string
func SetUnpublished ¶
SetUnpublished tells the router to not publish the client leaseset
func WrapRWC ¶ added in v0.32.4
func WrapRWC(c io.ReadWriteCloser) io.ReadWriteCloser
Types ¶
type Client ¶
A Client represents a single Connection to the SAM bridge
func NewClientFromOptions ¶
NewClientFromOptions creates a new client, connecting to a specified port
func NewDefaultClient ¶
NewDefaultClient creates a new client, connecting to the default host:port at localhost:7656
func (*Client) Accept ¶
Accept accepts a connection on a listening goSam.Client(Implements net.Listener) or, if the connection isn't listening yet, just calls AcceptI2P for compatibility with older versions.
func (*Client) CreateStreamSession ¶
CreateStreamSession creates a new STREAM Session. Returns the Id for the new Client.
func (*Client) Destination ¶
Destination returns the full destination of the local tunnel
func (*Client) DialContext ¶
DialContext implements the net.DialContext function and can be used for http.Transport
func (*Client) Listen ¶
Listen creates a new Client and returns a net.listener which *must* be started with Accept
func (*Client) ListenI2P ¶
ListenI2P creates a new Client and returns a net.listener which *must* be started with Accept
func (*Client) StreamAccept ¶
StreamAccept asks SAM to accept a TCP-Like connection
type Conn ¶ added in v0.32.2
type Conn struct { RWC // contains filtered or unexported fields }
func (*Conn) RemoteAddr ¶ added in v0.32.2
type Reply ¶
Reply is the parsed result of a SAM command, containing a map of all the key-value pairs
type ReplyError ¶
A ReplyError is a custom error type, containing the Result and full Reply
func (ReplyError) Error ¶
func (r ReplyError) Error() string