Documentation ¶
Index ¶
Constants ¶
const ( DEFAULT_ROUNDS = 256 SALT_SIZE = 16 MAX_MSG_COUNT = 50 )
const ( RES_OK byte = 0x0 RES_ERR byte = 0x1 MESSAGE_INIT byte = 0x1 MESSAGE_TXT byte = 0x2 MESSAGE_DISCONNECT byte = 0x3 CHAT_ARCHIVE byte = 0x4 )
message codes wil be defined here
const BUF_SIZE = 1024
const Blue = "\033[34m"
const Bold = "\033[1m"
const ColorReset = "\033[0m"
const Cyan = "\033[36m"
const Gray = "\033[37m"
const Green = "\033[32m"
const (
ID_SIZE = 512
)
const Italic = "\033[3m"
const Magenta = "\033[35m"
const Red = "\033[31m"
const White = "\033[97m"
const Yellow = "\033[33m"
Variables ¶
This section is empty.
Functions ¶
func DecryptArchive ¶ added in v0.1.1
returns a string of a decrypted chat archive
func GenId ¶
func GenId(prvKey *rsa.PrivateKey) (string, error)
given a user's private key, generates their id, in the form of a Base64-encoded signature of a constant
Types ¶
type Chatroom ¶
func (Chatroom) ArchiveChat ¶ added in v0.1.1
archives a chat and saves it to a file in a given path
func (*Chatroom) AwaitMessage ¶
awaits an incoming message, and handles it according to its code
func (Chatroom) DisplayMessages ¶
displays all of the Messages currently in the archive
func (*Chatroom) HandleCommand ¶
handles a chat command, and returns the string to be output to the terminal after running
func (*Chatroom) SendMessage ¶
sends a string message to the peer
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func NewMessage ¶
constructs a new message, making a note of the current timestamp
type Tunnel ¶
type Tunnel struct { PeerPubKey rsa.PublicKey Incoming net.Conn Outgoing net.Conn Peer User User User // contains filtered or unexported fields }
func ConnectPeer ¶
func ConnectPeer(addr string, pubKey rsa.PublicKey, prvKey rsa.PrivateKey, initiator User) (*Tunnel, error)
attempts to connect to a peer, returning a tunnel if the peer can be reached
func (Tunnel) AwaitMessage ¶
func (Tunnel) SendMessage ¶
encrypts and sends the provided message through this Tunnel