chat

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2016 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SelfNode = Node{}

The node of the program

Functions

func BroadcastMessage

func BroadcastMessage(msg common.Message)

Takes message, encrypts it, and sends it to all peers

func CreateConnection

func CreateConnection(ip string, silent bool)

Adds a connection to the peers

func GetMessageChannel

func GetMessageChannel() chan common.Message

Returns msgChan

func GetOutputChannel

func GetOutputChannel() chan chan string

XXX: DEPRICATED

func Listen

func Listen(port int)

Create a listener for the app to lisen on

func LoadPeers

func LoadPeers() error

This loads saved peers from disk

func SavePeers

func SavePeers() error

This saves all peers to disk. It goes through all currently connected peers and saves them to ~/.chatlab/saved-peers.gob

Types

type EncyptedMessage

type EncyptedMessage struct {
	EncyptedMessage string
}

The struct that is sent to peers

type Node

type Node struct {
	Username string
	IsRelay  bool
	Port     string
}

Defines what a connection is

type Peer

type Peer struct {
	Conn     net.Conn
	Username string
	Encoder  *gob.Encoder
	Decoder  *gob.Decoder
	Node     Node
}

Defines who the connection is and how to understand them

type SavedPeer

type SavedPeer struct {
	IP       string
	Username string
	Key      string
	IsRelay  bool
}

Format for peers to be saved to disk

Jump to

Keyboard shortcuts

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