Documentation ¶
Index ¶
Constants ¶
const Scheme = "circuit"
Variables ¶
var ErrParse = errors.NewError("parse")
Functions ¶
Types ¶
type Addr ¶
type Addr interface { // NetAddr returns the underlying networking address of this endpoint. NetAddr() net.Addr // String returns an equivalent textual representation of the address. String() string // Returns a unique textual representation of the address, suitable to be used as a file name. FileName() string // WorkerID returns the worker ID of the underlying worker. WorkerID() WorkerID }
Addr represents the identity of a unique remote worker. The implementing type must be registered with package encoding/gob.
func ServerAddr ¶
func ServerAddr() Addr
type Conn ¶
type Conn interface { // Read reads the next value from the connection. Read() (interface{}, error) // Write writes the given value to the connection. Write(interface{}) error // Close closes the connection. Close() error // ... Abort(reason error) // Addr returns the address of the remote endpoint. Addr() Addr }
Conn is a connection to a remote endpoint.
type Dialer ¶
type Dialer interface { // Dial connects to the endpoint specified by addr and returns a respective connection object. Dial(addr Addr) (Conn, error) }
Dialer is a device for initating connections to addressed remote endpoints.
type Listener ¶
type Listener interface { // Accept returns the next incoming connection. Accept() Conn // Close closes the listening device. Close() // Addr returns the address of this endpoint. Addr() Addr }
Listener is a device for accepting incoming connections.
type System ¶
type System interface { NewTransport(workerID WorkerID, addr net.Addr, key []byte) Transport ParseNetAddr(s string) (net.Addr, error) ParseAddr(s string) (Addr, error) }
System creates a new transport framework for the given local address
type Transport ¶
Transport cumulatively represents the ability to listen for connections and dial into remote endpoints.
type WorkerID ¶
type WorkerID string
WorkerID represents the identity of a circuit worker process.
func HashWorkerID ¶
HashWorkerID hashes the unconstrained string s into a worker ID value.
func Int64WorkerID ¶
func ParseOrHashWorkerID ¶
ParseOrHashWorkerID tries to parse the string s as a canonical worker ID representation. If it fails, it treats s as an unconstrained string and hashes it to a worker ID value. In either case, it returns a WorkerID value.
func ParseWorkerID ¶
ParseWorkerID parses the string s for a canonical representation of a worker ID and returns a corresponding WorkerID value.