This repository has been archived on 2020-04-20. You can view files and clone it, but cannot push or open issues or pull requests.
libricochet-go/connectivity/mixnet.go

37 lines
1.2 KiB
Go
Raw Normal View History

package connectivity
import (
"net"
)
// PrivateKey represents a private key using an unspecified algorithm.
type PrivateKey interface{}
// ListenService is an address that was opened with Listen() and can Accept() new connections
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()
}
// Mixnet is mixnet implementation wrapper that supports Open for new connections and Listen to accept connections
type Mixnet interface {
// 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()
}