I2P_KEYSTORE_PATH is the place where I2P Keys will be saved. it defaults to the directory "i2pkeys" current working directory reference it by calling I2PKeystorePath() to check for errors
var I2P_KEYSTORE_PATH = i2pdefault
ONION_KEYSTORE_PATH is the place where Onion Keys will be saved. it defaults to the directory "onionkeys" current working directory reference it by calling OnionKeystorePath() to check for errors
var ONION_KEYSTORE_PATH = tordefault
var OPT_DEFAULTS = sam3.Options_Default
SAM_ADDR is the default I2P SAM address. It can be overridden by the struct or by changing this variable.
var SAM_ADDR = "127.0.0.1:7656"
func CloseAllGarlic()
CloseAllGarlic closes all garlics managed by the onramp package. It does not affect objects instantiated by an app.
func CloseAllOnion()
CloseAllOnion closes all onions managed by the onramp package. It does not affect objects instantiated by an app.
func CloseGarlic(tunName string)
CloseGarlic closes the Garlic at the given index. It does not affect Garlic objects instantiated by an app.
func CloseOnion(tunName string)
CloseOnion closes the Onion at the given index. It does not affect Onion objects instantiated by an app.
func CreateTLSCertificate(tlsHost string, tlsCert, tlsKey *string) error
func DeleteGarlicKeys(tunName string) error
DeleteGarlicKeys deletes the key file at the given path as determined by keystore + tunName. This is permanent and irreversible, and will change the onion service address.
func DeleteI2PKeyStore() error
DeleteI2PKeyStore deletes the I2P Keystore.
func DeleteOnionKeys(tunName string) error
DeleteOnionKeys deletes the key file at the given path as determined by keystore + tunName.
func DeleteTorKeyStore() error
DeleteTorKeyStore deletes the Onion Keystore.
func Dial(network, addr string) (net.Conn, error)
Dial returns a connection for the given network and address. network is ignored. If the address ends in i2p, it returns an I2P connection. if the address ends in anything else, it returns a Tor connection.
func DialGarlic(network, addr string) (net.Conn, error)
DialGarlic returns a net.Conn for a garlic structure's keys corresponding to a structure managed by the onramp library and not instantiated by an app.
func DialOnion(network, addr string) (net.Conn, error)
DialOnion returns a net.Conn for a onion structure's keys corresponding to a structure managed by the onramp library and not instantiated by an app.
func GetJoinedWD(dir string) (string, error)
GetJoinedWD returns the working directory joined with the given path.
func I2PKeys(tunName, samAddr string) (i2pkeys.I2PKeys, error)
I2PKeys returns the I2PKeys at the keystore directory for the given tunnel name. If none exist, they are created and stored.
func I2PKeystorePath() (string, error)
I2PKeystorePath returns the path to the I2P Keystore. If the path is not set, it returns the default path. If the path does not exist, it creates it.
func Listen(network, keys string) (net.Listener, error)
Listen returns a listener for the given network and address. if network is i2p or garlic, it returns an I2P listener. if network is tor or onion, it returns an Onion listener. if keys ends with ".i2p", it returns an I2P listener.
func ListenGarlic(network, keys string) (net.Listener, error)
ListenGarlic returns a net.Listener for a garlic structure's keys corresponding to a structure managed by the onramp library and not instantiated by an app.
func ListenOnion(network, keys string) (net.Listener, error)
ListenOnion returns a net.Listener for a onion structure's keys corresponding to a structure managed by the onramp library and not instantiated by an app.
func NewTLSCertificate(host string, priv *ecdsa.PrivateKey) ([]byte, error)
func NewTLSCertificateAltNames(priv *ecdsa.PrivateKey, hosts ...string) ([]byte, error)
func TorKeys(keyName string) (ed25519.KeyPair, error)
TorKeys returns a key pair which will be stored at the given key name in the key store. If the key already exists, it will be returned. If it does not exist, it will be generated.
func TorKeystorePath() (string, error)
TorKeystorePath returns the path to the Onion Keystore. If the path is not set, it returns the default path. If the path does not exist, it creates it.
type Garlic struct { ... }
Garlic is a ready-made I2P streaming manager. Once initialized it always has a valid I2PKeys and StreamSession.
func NewGarlic(tunName, samAddr string, options []string) (*Garlic, error)
NewGarlic returns a new Garlic struct. It is immediately ready to use with I2P streaming.
func (g *Garlic) Close() error
Close closes the Garlic structure's sessions and listeners.
func (g *Garlic) DeleteKeys() error
func (g *Garlic) Dial(net, addr string) (net.Conn, error)
Dial returns a net.Conn for the Garlic structure's I2P keys.
func (g *Garlic) Keys() (i2pkeys.I2PKeys, error)
Keys returns the I2PKeys for the Garlic structure. If none exist, they are created and stored.
func (g *Garlic) Listen() (net.Listener, error)
Listen returns a net.Listener for the Garlic structure's I2P keys.
type Onion struct { ... }
Onion represents a structure which manages an onion service and a Tor client. The onion service will automatically have persistent keys.
func NewOnion(name string) (*Onion, error)
NewOnion returns a new Onion object.
func (o *Onion) Close() error
Close closes the Onion Service and all associated resources.
func (g *Onion) DeleteKeys() error
DeleteKeys deletes the keys at the given key name in the key store. This is permanent and irreversible, and will change the onion service address.
func (o *Onion) Dial(net, addr string) (net.Conn, error)
Dial returns a net.Conn to the given onion address or clearnet address.
func (o *Onion) Keys() (ed25519.KeyPair, error)
Keys returns the keys for the Onion
func (o *Onion) Listen() (net.Listener, error)
ListenOnion returns a net.Listener which will listen on an onion address, and will automatically generate a keypair and store it.
Readme created from Go doc with goreadme
MIT License
Copyright (c) 2022 idk
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Hide license