peer

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 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 CwtchPeer

type CwtchPeer interface {
	Init(event.Manager)
	AutoHandleEvents(events []event.Type)
	PeerWithOnion(string)
	InviteOnionToGroup(string, string) error
	SendMessageToPeer(string, string) string
	SendGetValToPeer(string, string, string)
	StoreMessage(onion string, messageTxt string, sent time.Time)

	SetContactAuthorization(string, model.Authorization) error
	ProcessInvite(string, string) (string, string, error)
	AcceptInvite(string) error
	RejectInvite(string)
	DeleteContact(string)
	DeleteGroup(string)

	AddServer(string) error
	JoinServer(string) error
	GetServers() []string
	SendMessageToGroupTracked(string, string) (string, error)

	GetName() string
	SetName(string)
	GetOnion() string

	GetPeerState(string) (connections.ConnectionState, bool)

	StartGroup(string) (string, []byte, error)

	ImportGroup(string) error
	ExportGroup(string) (string, error)

	GetGroup(string) *model.Group
	GetGroupState(string) (connections.ConnectionState, bool)
	GetGroups() []string
	AddContact(nick, onion string, authorization model.Authorization)
	GetContacts() []string
	GetContact(string) *model.PublicProfile

	SetAttribute(string, string)
	GetAttribute(string) (string, bool)
	SetContactAttribute(string, string, string)
	GetContactAttribute(string, string) (string, bool)
	SetGroupAttribute(string, string, string)
	GetGroupAttribute(string, string) (string, bool)

	Listen()
	StartPeersConnections()
	StartServerConnections()
	Shutdown()
}

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.

Jump to

Keyboard shortcuts

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