Documentation ¶
Index ¶
- Variables
- type BrokenChannelError
- type BrokenExchangeError
- type Channel
- func (c *Channel) Close() error
- func (c *Channel) Error(err error) error
- func (c *Channel) Errorf(format string, args ...interface{}) error
- func (c *Channel) Exchange() *Exchange
- func (c *Channel) Kill()
- func (c *Channel) LocalAddr() net.Addr
- func (c *Channel) Read(b []byte) (int, error)
- func (c *Channel) ReadPacket() (*lob.Packet, error)
- func (c *Channel) RemoteAddr() net.Addr
- func (c *Channel) RemoteHashname() hashname.H
- func (c *Channel) RemoteIdentity() *Identity
- func (c *Channel) SetDeadline(d time.Time) error
- func (c *Channel) SetReadDeadline(d time.Time) error
- func (c *Channel) SetWriteDeadline(d time.Time) error
- func (c *Channel) Write(b []byte) (int, error)
- func (c *Channel) WritePacket(pkt *lob.Packet) error
- func (c *Channel) WritePacketTo(pkt *lob.Packet, p *Pipe) error
- type ChannelHook
- type ChannelHooks
- type ChannelOption
- type Endpoint
- func (e *Endpoint) Close() error
- func (e *Endpoint) CreateExchange(identity *Identity) (*Exchange, error)
- func (e *Endpoint) DefaultChannelHooks() *ChannelHooks
- func (e *Endpoint) DefaultExchangeHooks() *ExchangeHooks
- func (e *Endpoint) Dial(identifier Identifier) (*Exchange, error)
- func (e *Endpoint) GetExchange(hashname hashname.H) *Exchange
- func (e *Endpoint) GetExchanges() []*Exchange
- func (e *Endpoint) Hooks() *EndpointHooks
- func (e *Endpoint) Identify(i Identifier) (*Identity, error)
- func (e *Endpoint) Listen(typ string, reliable bool) *Listener
- func (e *Endpoint) LocalHashname() hashname.H
- func (e *Endpoint) LocalIdentity() (*Identity, error)
- func (e *Endpoint) Log() *logs.Logger
- func (e *Endpoint) Module(key interface{}) Module
- func (e *Endpoint) Open(i Identifier, typ string, reliable bool) (*Channel, error)
- type EndpointHook
- type EndpointHooks
- type EndpointOption
- type Exchange
- func (x *Exchange) ActivePath() net.Addr
- func (x *Exchange) ActivePipe() *Pipe
- func (x *Exchange) AddPathCandidate(addr net.Addr)
- func (x *Exchange) AddPipeConnection(conn net.Conn, addr net.Addr) (p *Pipe, added bool)
- func (x *Exchange) ApplyHandshake(handshake cipherset.Handshake, pipe *Pipe) (response *bufpool.Buffer, ok bool)
- func (x *Exchange) Dial() error
- func (x *Exchange) GenerateHandshake() (*bufpool.Buffer, error)
- func (x *Exchange) KnownPaths() []net.Addr
- func (x *Exchange) KnownPipes() []*Pipe
- func (x *Exchange) LocalToken() cipherset.Token
- func (x *Exchange) Open(typ string, reliable bool) (*Channel, error)
- func (x *Exchange) RemoteHashname() hashname.H
- func (x *Exchange) RemoteIdentity() *Identity
- func (x *Exchange) RemoteToken() cipherset.Token
- func (x *Exchange) State() ExchangeState
- func (x *Exchange) String() string
- type ExchangeHook
- type ExchangeHooks
- type ExchangeOption
- type ExchangeState
- type Identifier
- type Identity
- func (i *Identity) AddPathCandiate(addr net.Addr) *Identity
- func (i *Identity) Addresses() []net.Addr
- func (i *Identity) Hashname() hashname.H
- func (i *Identity) Identify(e *Endpoint) (*Identity, error)
- func (i *Identity) Keys() cipherset.Keys
- func (i *Identity) MarshalJSON() ([]byte, error)
- func (i *Identity) String() string
- func (i *Identity) UnmarshalJSON(p []byte) error
- type Listener
- type Module
- type Pipe
- type Transports
- type UnreachableEndpointError
Constants ¶
This section is empty.
Variables ¶
var ( ErrListenerClosed = errors.New("listener closed") ErrListenerBacklogTooLarge = errors.New("listener backlog too large") ErrListenerInvalidType = errors.New("listener inavlid channel type") )
var ErrInvalidHandshake = errors.New("e3x: invalid handshake")
var ErrNoAddress = errors.New("e3x: no addresses")
var ErrNoKeys = errors.New("e3x: no keys")
var ErrStopPropagation = errors.New("observer: stop propagation")
var ErrTimeout = errors.New("e3x: deadline reached")
var ErrUnidentifiable = errors.New("unidentifiable identity")
Functions ¶
This section is empty.
Types ¶
type BrokenChannelError ¶
type BrokenChannelError struct {
// contains filtered or unexported fields
}
func (*BrokenChannelError) Error ¶
func (err *BrokenChannelError) Error() string
type BrokenExchangeError ¶
func (BrokenExchangeError) Error ¶
func (err BrokenExchangeError) Error() string
type Channel ¶
func (*Channel) RemoteAddr ¶
RemoteAddr returns the remote network address.
func (*Channel) RemoteHashname ¶
func (*Channel) RemoteIdentity ¶
func (*Channel) SetDeadline ¶
SetDeadline implements the net.Conn SetDeadline method.
func (*Channel) SetReadDeadline ¶
SetReadDeadline implements the net.Conn SetReadDeadline method.
func (*Channel) SetWriteDeadline ¶
SetWriteDeadline implements the net.Conn SetWriteDeadline method.
type ChannelHook ¶
type ChannelHooks ¶
type ChannelHooks struct {
// contains filtered or unexported fields
}
func (*ChannelHooks) Closed ¶
func (s *ChannelHooks) Closed() error
func (*ChannelHooks) Opened ¶
func (s *ChannelHooks) Opened() error
func (*ChannelHooks) Register ¶
func (h *ChannelHooks) Register(hook ChannelHook)
type ChannelOption ¶
type Endpoint ¶
Endpoint represents a Telehash endpoint.
func Open ¶
func Open(options ...EndpointOption) (*Endpoint, error)
func (*Endpoint) CreateExchange ¶
CreateExchange returns the exchange for identity. If the exchange already exists it is simply returned otherwise a new exchange is created and registered. Note that CreateExchange does not Dial.
func (*Endpoint) DefaultChannelHooks ¶
func (e *Endpoint) DefaultChannelHooks() *ChannelHooks
func (*Endpoint) DefaultExchangeHooks ¶
func (e *Endpoint) DefaultExchangeHooks() *ExchangeHooks
func (*Endpoint) Dial ¶
func (e *Endpoint) Dial(identifier Identifier) (*Exchange, error)
Dial will lookup the identity of identifier, get the exchange for the identity and dial the exchange.
func (*Endpoint) GetExchanges ¶
func (*Endpoint) Hooks ¶
func (e *Endpoint) Hooks() *EndpointHooks
func (*Endpoint) LocalHashname ¶
func (*Endpoint) LocalIdentity ¶
type EndpointHook ¶
type EndpointHooks ¶
type EndpointHooks struct {
// contains filtered or unexported fields
}
func (*EndpointHooks) DropPacket ¶
func (*EndpointHooks) NetChanged ¶
func (s *EndpointHooks) NetChanged(up, down []net.Addr) error
func (*EndpointHooks) Register ¶
func (h *EndpointHooks) Register(hook EndpointHook)
type EndpointOption ¶
func DisableLog ¶
func DisableLog() EndpointOption
func Keys ¶
func Keys(keys cipherset.Keys) EndpointOption
func Log ¶
func Log(w io.Writer) EndpointOption
func RegisterModule ¶
func RegisterModule(key interface{}, mod Module) EndpointOption
func Transport ¶
func Transport(config transports.Config) EndpointOption
type Exchange ¶
func (*Exchange) ActivePath ¶
ActivePath returns the path that is currently used for channel packets.
func (*Exchange) ActivePipe ¶
ActivePipe returns the pipe that is currently used for channel packets.
func (*Exchange) AddPathCandidate ¶
AddPathCandidate adds a new path tto the exchange. The path is only used when it performs better than any other paths.
func (*Exchange) AddPipeConnection ¶
func (*Exchange) ApplyHandshake ¶
func (x *Exchange) ApplyHandshake(handshake cipherset.Handshake, pipe *Pipe) (response *bufpool.Buffer, ok bool)
ApplyHandshake applies a (out-of-band) handshake to the exchange. When the handshake is accepted err is nil. When the handshake is a request-handshake and it is accepted response will contain a response-handshake packet.
func (*Exchange) GenerateHandshake ¶
GenerateHandshake can be used to generate a new handshake packet. This is useful when the exchange doesn't know where to send the handshakes yet.
func (*Exchange) KnownPaths ¶
KnownPaths returns all the know addresses of the remote endpoint.
func (*Exchange) KnownPipes ¶
KnownPipes returns all the know pipes of the remote endpoint.
func (*Exchange) LocalToken ¶
LocalToken returns the token identifying the local side of the exchange.
func (*Exchange) RemoteHashname ¶
RemoteHashname returns the hashname of the remote peer.
func (*Exchange) RemoteIdentity ¶
RemoteIdentity returns the Identity of the remote peer.
func (*Exchange) RemoteToken ¶
RemoteToken returns the token identifying the remote side of the exchange.
func (*Exchange) State ¶
func (x *Exchange) State() ExchangeState
type ExchangeHook ¶
type ExchangeHooks ¶
type ExchangeHooks struct {
// contains filtered or unexported fields
}
func (*ExchangeHooks) Closed ¶
func (s *ExchangeHooks) Closed(reason error) error
func (*ExchangeHooks) DropPacket ¶
func (s *ExchangeHooks) DropPacket(msg []byte, pipe *Pipe, reason error) error
func (*ExchangeHooks) Opened ¶
func (s *ExchangeHooks) Opened() error
func (*ExchangeHooks) Register ¶
func (h *ExchangeHooks) Register(hook ExchangeHook)
type ExchangeOption ¶
type ExchangeState ¶
type ExchangeState uint8
const ( ExchangeInitialising ExchangeState = 0 ExchangeDialing ExchangeState = 1 << iota ExchangeIdle ExchangeActive ExchangeExpired ExchangeBroken )
func (ExchangeState) IsClosed ¶
func (s ExchangeState) IsClosed() bool
func (ExchangeState) IsOpen ¶
func (s ExchangeState) IsOpen() bool
func (ExchangeState) String ¶
func (s ExchangeState) String() string
type Identifier ¶
Identifier represents an identifing set of information which can be resolved into a full Identity.
func HashnameIdentifier ¶
func HashnameIdentifier(hn hashname.H) Identifier
HashnameIdentifier returns an identifer which identifies an Identity using only information internal to an endpoint. In other words it will return the Identity associated with a hashname if that information is available within the endpoint.
type Identity ¶
type Identity struct {
// contains filtered or unexported fields
}
func NewIdentity ¶
func (*Identity) MarshalJSON ¶
func (*Identity) UnmarshalJSON ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func (*Listener) AcceptChannel ¶
type Module ¶
type Module interface { // Init is called after the creating the endpoint and before openeing the endpoint transport. Init() error // Start is called after opening the endpoint transport. Start() error // Stop is called before closing the endpoint transport. Stop() error }
Module must be implemented by endpoint modules.
type Pipe ¶
type Pipe struct {
// contains filtered or unexported fields
}
func (*Pipe) RemoteAddr ¶
type Transports ¶
type Transports interface { // Wrap must be called durring a Module.Init call. The existing endpoint // transport will be passed to and a valid transport must be returned. // Only use this module when you know what you are doeing. Wrap(f func(transports.Config) transports.Config) // LocalAddresses returns the list of discovered local addresses LocalAddresses() []net.Addr }
Transports exposes the Wrap method
func TransportsFromEndpoint ¶
func TransportsFromEndpoint(e *Endpoint) Transports
TransportsFromEndpoint returns the Transports module for Endpoint.
type UnreachableEndpointError ¶
func (UnreachableEndpointError) Error ¶
func (err UnreachableEndpointError) Error() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cs1a
Package cs1a implements Cipher Set 1a.
|
Package cs1a implements Cipher Set 1a. |
cs1a/eccp
Elliptic Curve Compressed Point marshaler
|
Elliptic Curve Compressed Point marshaler |
cs1a/ecdh
Elliptic curve Diffie–Hellman key sharing
|
Elliptic curve Diffie–Hellman key sharing |
cs1a/secp160r1
Parameters for the secp160r1 Elliptic curve
|
Parameters for the secp160r1 Elliptic curve |
cs3a
Package cs3a implements Cipher Set 3a.
|
Package cs3a implements Cipher Set 3a. |