Documentation ¶
Index ¶
- Constants
- type AcceptAllContactHandler
- type AcceptAllContactManager
- func (aacm *AcceptAllContactManager) ContactRequest(name string, message string) string
- func (aacm *AcceptAllContactManager) LookupContact(hostname string, publicKey rsa.PublicKey) (allowed, known bool)
- func (aacm *AcceptAllContactManager) LookupContactV3(hostname string, publicKey ed25519.PublicKey) (allowed, known bool)
- type ContactManagerInterface
- type Instance
- type InstanceFactory
- func (af *InstanceFactory) AddHandler(ctype string, chandler func(*Instance) func() channels.Handler)
- func (af *InstanceFactory) GetApplicationInstance(rc *connection.Connection) *Instance
- func (af *InstanceFactory) GetHandler(ctype string) func(*Instance) func() channels.Handler
- func (af *InstanceFactory) GetHandlers() []string
- func (af *InstanceFactory) Init()
- type RicochetApplication
- func (ra *RicochetApplication) Broadcast(do func(rai *Instance))
- func (ra *RicochetApplication) Close(onion string)
- func (ra *RicochetApplication) ConnectionCount() int
- func (ra *RicochetApplication) HandleApplicationInstance(rai *Instance)
- func (ra *RicochetApplication) Init(acn connectivity.ACN, name string, v3identity identity.Identity, ...)
- func (ra *RicochetApplication) Open(onionAddress string, requestMessage string) (*Instance, error)
- func (ra *RicochetApplication) Run(ls connectivity.ListenService)
- func (ra *RicochetApplication) Shutdown()
Constants ¶
const (
// RicochetPort is the default port used by ricochet applications
RicochetPort = 9878
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptAllContactHandler ¶
type AcceptAllContactHandler struct{}
AcceptAllContactHandler is a pass through Contact Handler. It is currently only used by the integration test. TODO: DEPRECATE
func (*AcceptAllContactHandler) ContactRequest ¶
func (aach *AcceptAllContactHandler) ContactRequest(name string, message string) string
ContactRequest returns "Pending" for everything
func (*AcceptAllContactHandler) ContactRequestAccepted ¶
func (aach *AcceptAllContactHandler) ContactRequestAccepted()
ContactRequestAccepted is a noop
func (*AcceptAllContactHandler) ContactRequestError ¶
func (aach *AcceptAllContactHandler) ContactRequestError()
ContactRequestError is a noop
func (*AcceptAllContactHandler) ContactRequestRejected ¶
func (aach *AcceptAllContactHandler) ContactRequestRejected()
ContactRequestRejected is a noop
type AcceptAllContactManager ¶
type AcceptAllContactManager struct { }
AcceptAllContactManager implements the contact manager interface an presumes all connections are allowed. It is currently used by the Cwtch Server. TODO Deprecate
func (*AcceptAllContactManager) ContactRequest ¶
func (aacm *AcceptAllContactManager) ContactRequest(name string, message string) string
ContactRequest accepts every single Contact Request
func (*AcceptAllContactManager) LookupContact ¶
func (aacm *AcceptAllContactManager) LookupContact(hostname string, publicKey rsa.PublicKey) (allowed, known bool)
LookupContact returns that a contact is known and allowed to communicate for all cases.
func (*AcceptAllContactManager) LookupContactV3 ¶
func (aacm *AcceptAllContactManager) LookupContactV3(hostname string, publicKey ed25519.PublicKey) (allowed, known bool)
LookupContactV3 returns that a contact is known and allowed to communicate for all cases.
type ContactManagerInterface ¶
type ContactManagerInterface interface { LookupContact(hostname string, publicKey rsa.PublicKey) (allowed, known bool) LookupContactV3(hostname string, publicKey ed25519.PublicKey) (allowed, known bool) }
ContactManagerInterface provides a mechanism for autonous applications to make decisions on what connections to accept or reject.
type Instance ¶
type Instance struct { connection.AutoConnectionHandler Connection *connection.Connection RemoteHostname string }
Instance is a concrete instance of a ricochet application, encapsulating a connection
type InstanceFactory ¶
type InstanceFactory struct {
// contains filtered or unexported fields
}
InstanceFactory generates ApplicationInstances on a specific connection.
func (*InstanceFactory) AddHandler ¶
func (af *InstanceFactory) AddHandler(ctype string, chandler func(*Instance) func() channels.Handler)
AddHandler defines a channel type -> handler construct function
func (*InstanceFactory) GetApplicationInstance ¶
func (af *InstanceFactory) GetApplicationInstance(rc *connection.Connection) *Instance
GetApplicationInstance builds a new application instance using a connection as a base.
func (*InstanceFactory) GetHandler ¶
func (af *InstanceFactory) GetHandler(ctype string) func(*Instance) func() channels.Handler
GetHandler returns a set handler for the channel type.
func (*InstanceFactory) GetHandlers ¶
func (af *InstanceFactory) GetHandlers() []string
GetHandlers returns all handlers
func (*InstanceFactory) Init ¶
func (af *InstanceFactory) Init()
Init sets up an Application Factory
type RicochetApplication ¶
type RicochetApplication struct {
// contains filtered or unexported fields
}
RicochetApplication bundles many useful constructs that are likely standard in a ricochet application
func (*RicochetApplication) Broadcast ¶
func (ra *RicochetApplication) Broadcast(do func(rai *Instance))
Broadcast performs the given function do() over all application instance (all connected peers)
func (*RicochetApplication) Close ¶
func (ra *RicochetApplication) Close(onion string)
Close kills a connection by a given Onion Address
func (*RicochetApplication) ConnectionCount ¶
func (ra *RicochetApplication) ConnectionCount() int
ConnectionCount returns the number of concurrent connections to the application
func (*RicochetApplication) HandleApplicationInstance ¶
func (ra *RicochetApplication) HandleApplicationInstance(rai *Instance)
HandleApplicationInstance delegates handling of a given Instance to the Application.
func (*RicochetApplication) Init ¶
func (ra *RicochetApplication) Init(acn connectivity.ACN, name string, v3identity identity.Identity, af InstanceFactory, cm ContactManagerInterface)
Init initializes the underlying RicochetApplication datastructure, making it ready for use
func (*RicochetApplication) Open ¶
func (ra *RicochetApplication) Open(onionAddress string, requestMessage string) (*Instance, error)
Open a connection to another Ricochet peer at onionAddress. Infof they are unknown to use, use requestMessage (otherwise can be blank)
func (*RicochetApplication) Run ¶
func (ra *RicochetApplication) Run(ls connectivity.ListenService)
Run handles a Listen object and Accepts and handles new connections
func (*RicochetApplication) Shutdown ¶
func (ra *RicochetApplication) Shutdown()
Shutdown stops a RicochetApplication, terminating all child processes and resources