Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultEventsToHandle = []event.Type{ event.EncryptedGroupMessage, event.NewMessageFromPeer, event.PeerAcknowledgement, event.NewGroupInvite, event.PeerError, event.SendMessageToGroupError, event.NewGetValMessageFromPeer, event.ProtocolEngineStopped, }
DefaultEventsToHandle specifies which events will be subscribed to
when a peer has its Init() function called
Functions ¶
This section is empty.
Types ¶
type AccessPeeringState ¶ added in v0.6.3
type AccessPeeringState interface {
GetPeerState(string) (connections.ConnectionState, bool)
}
AccessPeeringState provides access to functions relating to the underlying connections of a peer.
type CwtchPeer ¶
type CwtchPeer interface { // Core Cwtch Peer Functions that should not be exposed to // most functions Init(event.Manager) AutoHandleEvents(events []event.Type) Listen() StartPeersConnections() StartServerConnections() Shutdown() // Relating to local attributes GetOnion() string SetAttribute(string, string) GetAttribute(string) (string, bool) ReadContacts ModifyContacts AccessPeeringState ModifyPeeringState ReadGroups ModifyGroups ReadServers ModifyServers SendMessages SendMessagesToGroup // Deprecated // TODO Should be removed GetName() string SetName(string) // TODO Should not be exposed... ProcessInvite(string, string) (string, string, error) }
CwtchPeer provides us with a way of testing systems built on top of cwtch without having to directly implement a cwtchPeer.
func FromProfile ¶
FromProfile generates a new peer from a profile.
func NewCwtchPeer ¶
NewCwtchPeer creates and returns a new cwtchPeer with the given name.
type ModifyContacts ¶ added in v0.6.3
type ModifyContacts interface { AddContact(nick, onion string, authorization model.Authorization) SetContactAuthorization(string, model.Authorization) error SetContactAttribute(string, string, string) DeleteContact(string) }
ModifyContacts is a meta-interface intended to restrict callers to modify-only access to contacts
type ModifyContactsAndPeers ¶ added in v0.6.3
type ModifyContactsAndPeers interface { ReadContacts ModifyContacts ModifyPeeringState }
ModifyContactsAndPeers is a meta-interface intended to restrict a call to reading and modifying contacts and peers.
type ModifyGroups ¶ added in v0.6.3
type ModifyGroups interface { ImportGroup(string) error StartGroup(string) (string, []byte, error) AcceptInvite(string) error RejectInvite(string) DeleteGroup(string) SetGroupAttribute(string, string, string) }
ModifyGroups provides write-only access add/edit/remove new groups
type ModifyPeeringState ¶ added in v0.6.3
type ModifyPeeringState interface { BlockUnknownConnections() AllowUnknownConnections() PeerWithOnion(string) JoinServer(string) error }
ModifyPeeringState is a meta-interface intended to restrict callers to modify-only access to connection peers
type ModifyServers ¶ added in v0.6.3
ModifyServers provides write-only access to servers
type ReadContacts ¶ added in v0.6.3
type ReadContacts interface { GetContacts() []string GetContact(string) *model.PublicProfile GetContactAttribute(string, string) (string, bool) }
ReadContacts is a meta-interface intended to restrict callers to read-only access to contacts
type ReadGroups ¶ added in v0.6.3
type ReadGroups interface { GetGroup(string) *model.Group GetGroupState(string) (connections.ConnectionState, bool) GetGroups() []string GetGroupAttribute(string, string) (string, bool) ExportGroup(string) (string, error) }
ReadGroups provides read-only access to group state
type ReadServers ¶ added in v0.6.3
type ReadServers interface {
GetServers() []string
}
ReadServers provides access to the servers
type SendMessages ¶ added in v0.6.3
type SendMessages interface { SendGetValToPeer(string, string, string) SendMessageToPeer(string, string) string // TODO This should probably not be exposed StoreMessage(onion string, messageTxt string, sent time.Time) // TODO Extract once groups are stable InviteOnionToGroup(string, string) error }
SendMessages enables a caller to sender messages to a contact Note: