Categorygithub.com/go-i2p/onramp
modulepackage
0.33.92
Repository: https://github.com/go-i2p/onramp.git
Documentation: pkg.go.dev

# README

onramp

Go Report Card

High-level, easy-to-use listeners and clients for I2P and onion URL's from Go. Provides only the most widely-used functions in a basic way. It expects nothing from the users, an otherwise empty instance of the structs will listen and dial I2P Streaming and Tor TCP sessions successfully.

In all cases, it assumes that keys are "persistent" in that they are managed maintained between usages of the same application in the same configuration. This means that hidden services will maintain their identities, and that clients will always have the same return addresses. If you don't want this behavior, make sure to delete the "keystore" when your app closes or when your application needs to cycle keys by calling the Garlic.DeleteKeys() or Onion.DeleteKeys() function. For more information, check out the godoc.

STATUS: This project is maintained. I will respond to issues, pull requests, and feature requests within a few days.

Usage

Basic usage is designed to be very simple, import the package and instantiate a struct and you're ready to go.

For more extensive examples, see: EXAMPLE

I2P(Garlic) Usage:

When using it to manage an I2P session, set up an onramp.Garlic struct.


package main

import (
	"log"

	"github.com/go-i2p/onramp"
)

func main() {
	garlic := &onramp.Garlic{}
	defer garlic.Close()
	listener, err := garlic.Listen()
	if err != nil {
		log.Fatal(err)
	}
	defer listener.Close()
}

Tor(Onion) Usage:

When using it to manage a Tor session, set up an onramp.Onion struct.


package main

import (
	"log"

	"github.com/go-i2p/onramp"
)

func main() {
	onion := &onramp.Onion{}
	defer garlic.Close()
	listener, err := onion.Listen()
	if err != nil {
		log.Fatal(err)
	}
	defer listener.Close()
}

Verbosity

Logging can be enabled and configured using the DEBUG_I2P environment variable. By default, logging is disabled.

There are three available log levels:

  • Debug
export DEBUG_I2P=debug
  • Warn
export DEBUG_I2P=warn
  • Error
export DEBUG_I2P=error

If DEBUG_I2P is set to an unrecognized variable, it will fall back to "debug".

Contributing

See CONTRIBUTING.md for more information.

License

This project is licensed under the MIT license, see LICENSE for more information.

# Functions

CloseAllGarlic closes all garlics managed by the onramp package.
CloseAllOnion closes all onions managed by the onramp package.
CloseGarlic closes the Garlic at the given index.
CloseOnion closes the Onion at the given index.
CreateTLSCertificate generates a TLS certificate for the given hostname, and stores it in the TLS keystore for the application.
DeleteGarlicKeys deletes the key file at the given path as determined by keystore + tunName.
DeleteI2PKeyStore deletes the I2P Keystore.
DeleteOnionKeys deletes the key file at the given path as determined by keystore + tunName.
DeleteTLSKeyStore deletes the TLS Keystore.
DeleteTorKeyStore deletes the Onion Keystore.
Dial returns a connection for the given network and address.
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.
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.
GetJoinedWD returns the working directory joined with the given path.
GetI2PKeysLogger returns the initialized logger.
I2PKeys returns the I2PKeys at the keystore directory for the given tunnel name.
I2PKeystorePath returns the path to the I2P Keystore.
No description provided by the author
Listen returns a listener for the given network and address.
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.
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.
NewGarlic returns a new Garlic struct.
NewOnion returns a new Onion object.
NewTLSCertificate generates a new TLS certificate for the given hostname, returning it as bytes.
NewTLSCertificateAltNames generates a new TLS certificate for the given hostname, and a list of alternate names, returning it as bytes.
No description provided by the author
TLSKeys returns the TLS certificate and key for the given hostname.
TLSKeystorePath returns the path to the TLS Keystore.
TorKeys returns a key pair which will be stored at the given key name in the key store.
TorKeystorePath returns the path to the Onion Keystore.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

I2P_KEYSTORE_PATH is the place where I2P Keys will be saved.
ONION_KEYSTORE_PATH is the place where Onion Keys will be saved.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SAM_ADDR is the default I2P SAM address.
TLS_KEYSTORE_PATH is the place where TLS Keys will be saved.

# Structs

Garlic is a ready-made I2P streaming manager.
No description provided by the author
Onion represents a structure which manages an onion service and a Tor client.
No description provided by the author