peer

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2021 License: MIT Imports: 13 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

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
}

CwtchPeer provides us with a way of testing systems built on top of cwtch without having to directly implement a cwtchPeer.

func FromProfile

func FromProfile(profile *model.Profile) CwtchPeer

FromProfile generates a new peer from a profile.

func NewCwtchPeer

func NewCwtchPeer(name string) CwtchPeer

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 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

type ModifyServers interface {
	AddServer(string) error
}

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:

type SendMessagesToGroup added in v0.6.3

type SendMessagesToGroup interface {
	SendMessageToGroupTracked(string, string) (string, error)
}

SendMessagesToGroup enables a caller to sender messages to a group

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL