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, event.RetryServerRequest, }
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 // scope.zone.key = value SetScopedZonedAttribute(scope attr.Scope, zone attr.Zone, key string, value string) // scope.zone.key = value GetScopedZonedAttribute(scope attr.Scope, zone attr.Zone, key string) (string, bool) ReadContacts ModifyContacts AccessPeeringState ModifyPeeringState ReadGroups ModifyGroups ReadServers ModifyServers SendMessages ModifyMessages SendMessagesToGroup }
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) (string, error) StartGroup(string) (string, string, error) AcceptInvite(string) error RejectInvite(string) DeleteGroup(string) SetGroupAttribute(string, string, string) }
ModifyGroups provides write-only access add/edit/remove new groups
type ModifyMessages ¶ added in v0.8.6
ModifyMessages enables a caller to modify the messages in a timline
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 { SendMessage(handle string, message string) error // Deprecated: is unsafe SendGetValToPeer(string, string, string) SendScopedZonedGetValToContact(handle string, scope attr.Scope, zone attr.Zone, key string) // Deprecated SendMessageToPeer(string, string) string // TODO // Deprecated use overlays instead InviteOnionToGroup(string, string) error }
SendMessages enables a caller to sender messages to a contact