Documentation ¶
Index ¶
- Constants
- Variables
- type Adapter
- type AdoptionRequest
- type Channel
- type Context
- type Event
- type LocalNode
- func (node *LocalNode) AdaptWS(adapter Adapter)
- func (node *LocalNode) AdapterReceiveWeb(ID string, event Event, msg []byte) error
- func (local *LocalNode) AddNode(node Node)
- func (local *LocalNode) ConnectToNodeWS(node Node) error
- func (local *LocalNode) Decrypt(node string, msg []byte) ([]byte, error)
- func (local *LocalNode) DeleteNode(node string)
- func (local *LocalNode) Encrypt(node string, msg []byte) ([]byte, error)
- func (local *LocalNode) ExistsNodeWS(node string) bool
- func (local *LocalNode) GetNode(id string) *Node
- func (local *LocalNode) GetNodeWS(node string) *websocket.Conn
- func (local *LocalNode) HandleMessage(protocol string, message Message)
- func (local *LocalNode) IterateNodes(callback func(string, Node) bool)
- func (local *LocalNode) IterateNodesWS(f func(key string, value *websocket.Conn) bool)
- func (node *LocalNode) Pipe(protocol string, message Message) error
- func (local *LocalNode) ProcessEvent(message *Message, target string) Event
- func (local *LocalNode) ProcessMarshal(message *Message, target string) []byte
- func (local *LocalNode) ReceiveWS(bytes []byte)
- func (local *LocalNode) ReceiveWSAdoption(request string) (Node, error)
- func (node *LocalNode) RemoveAdapterWS(ID string)
- func (local *LocalNode) RemoveNodeWS(node string)
- func (local *LocalNode) SendClient(id string, event Event) error
- func (n *LocalNode) SetupSocketless(sl string)
- func (n *LocalNode) SetupWS(ws string)
- func (local *LocalNode) Socketless(nodeEntity Node, message Message) error
- func (local *LocalNode) ToNode() Node
- type Message
- type Node
Constants ¶
View Source
const ChannelBroadcast = "br"
View Source
const ChannelConversation = "c"
View Source
const ChannelP2P = "p"
View Source
const ProtocolUDP = "udp"
View Source
const ProtocolWS = "ws"
Variables ¶
View Source
var DebugLogs = false
Functions ¶
This section is empty.
Types ¶
type AdoptionRequest ¶
type Channel ¶
type Channel struct { Channel string `json:"channel"` // Channel name Target []string `json:"target"` // User IDs to send to (node and user ID for p2p channel) Nodes []string `json:"-"` // Nodes to send to (only for conversation channel) }
func BroadcastChannel ¶
func Conversation ¶
func P2PChannel ¶
func (Channel) IsBroadcast ¶
func (Channel) IsConversation ¶
type LocalNode ¶
type LocalNode struct { ID string `json:"id"` Token string `json:"token"` WS string `json:"ws,omitempty"` // Websocket ip SL string `json:"sl,omitempty"` // Socketless pipe Processors map[string]func(*Message, string) Event `json:"-"` // Encryption Cipher cipher.Block `json:"-"` // contains filtered or unexported fields }
func SetupCurrent ¶
func (*LocalNode) AdapterReceiveWeb ¶
Handles receiving messages from the target and passes them to the adapter
func (*LocalNode) ConnectToNodeWS ¶
func (*LocalNode) DeleteNode ¶
func (*LocalNode) ExistsNodeWS ¶
func (*LocalNode) HandleMessage ¶
func (*LocalNode) IterateNodes ¶
IterateConnections iterates over all connections. If the callback returns false, the iteration stops.
func (*LocalNode) IterateNodesWS ¶
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
func (*LocalNode) ProcessEvent ¶
func (*LocalNode) ProcessMarshal ¶
func (*LocalNode) ReceiveWSAdoption ¶
func (*LocalNode) RemoveAdapterWS ¶
Remove a websocket/sl adapter
func (*LocalNode) RemoveNodeWS ¶
func (*LocalNode) SendClient ¶
SendClient is a function that sends a WS packet to the client
func (*LocalNode) SetupSocketless ¶
func (*LocalNode) Socketless ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.