connectivity

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2020 License: BSD-3-Clause, MIT Imports: 22 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// CannotResolveLocalTCPAddressError is thrown when a local ricochet connection has the wrong format.
	CannotResolveLocalTCPAddressError = utils.Error("CannotResolveLocalTCPAddressError")
	// CannotDialLocalTCPAddressError is thrown when a connection to a local ricochet address fails.
	CannotDialLocalTCPAddressError = utils.Error("CannotDialLocalTCPAddressError")
	// CannotDialRicochetAddressError is thrown when a connection to a ricochet address fails.
	CannotDialRicochetAddressError = utils.Error("CannotDialRicochetAddressError")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ACN

type ACN interface {
	// GetBootstrapStatus returns an int 0-100 on the percent the bootstrapping of the underlying network is at and an optional string message
	GetBootstrapStatus() (int, string)
	// WaitTillBootstrapped Blocks until underlying network is bootstrapped
	WaitTillBootstrapped()
	// Sets the calback function to be called when ACN status changes
	SetStatusCallback(callback func(int, string))

	// Restarts the underlying connection
	Restart()

	// Open takes a hostname and returns a net.conn to the derived endpoint
	// Open allows a client to resolve various hostnames to connections
	// The supported types are onions address are:
	//  * ricochet:jlq67qzo6s4yp3sp
	//  * jlq67qzo6s4yp3sp
	//  * 127.0.0.1:55555|jlq67qzo6s4yp3sp - Localhost Connection
	Open(hostname string) (net.Conn, string, error)

	// Listen takes a private key and a port and returns a ListenService for it
	Listen(identity PrivateKey, port int) (ListenService, error)

	Close()
}

ACN is Anonymous Communication Network implementation wrapper that supports Open for new connections and Listen to accept connections

func LocalProvider

func LocalProvider() ACN

LocalProvider returns a for testing use only local clearnet implementation of a ACN interface

func StartTor

func StartTor(appDirectory string, bundledTorPath string) (ACN, error)

StartTor creates/starts a Tor ACN and returns a usable ACN object

type ListenService

type ListenService interface {
	// AddressIdentity is the core "identity" part of an address, ex: rsjeuxzlexy4fvo75vrdtj37nrvlmvbw57n5mhypcjpzv3xkka3l4yyd
	AddressIdentity() string

	// AddressFull is the full network address, ex: rsjeuxzlexy4fvo75vrdtj37nrvlmvbw57n5mhypcjpzv3xkka3l4yyd.onion:9878
	AddressFull() string

	Accept() (net.Conn, error)
	Close()
}

ListenService is an address that was opened with Listen() and can Accept() new connections

type PrivateKey

type PrivateKey interface{}

PrivateKey represents a private key using an unspecified algorithm.

Jump to

Keyboard shortcuts

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