client

package
v0.0.0-...-4083cd3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskUserDetailsCLI

func AskUserDetailsCLI() (string, string)

func StartTUI

func StartTUI(c *Client) error

Types

type Client

type Client struct {
	ActiveConn   net.Conn
	Host         bool
	HostServer   *server.Server
	ServerAESKey []byte
	ServerPubKey *rsa.PublicKey

	LastCommand string
	TUI         *tview.Application

	KeepAliveTimer *time.Ticker
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *ClientConfig) Client

func (*Client) ActionMessageType

func (c *Client) ActionMessageType(p encoding.MsgProtocol, data []byte)

func (*Client) AwaitHandshakeResponse

func (c *Client) AwaitHandshakeResponse(conn net.Conn) (encoding.MsgProtocol, error)

func (*Client) AwaitMessage

func (c *Client) AwaitMessage()

func (*Client) AwaitServerKey

func (c *Client) AwaitServerKey(conn net.Conn) ([]byte, error)

func (*Client) Connect

func (c *Client) Connect(srvAddr string) error

func (*Client) ProcessMessage

func (c *Client) ProcessMessage()

func (*Client) PushSentMessageToChatView

func (c *Client) PushSentMessageToChatView(msg string)

func (*Client) PushToChatView

func (c *Client) PushToChatView(msg string)

func (*Client) SendAESKey

func (c *Client) SendAESKey(conn net.Conn) error

func (*Client) SendDisconnectionRequest

func (c *Client) SendDisconnectionRequest()

func (*Client) SendHandshake

func (c *Client) SendHandshake(conn net.Conn) error

func (*Client) SendKeepAlive

func (c *Client) SendKeepAlive()

func (*Client) SendMessageToServer

func (c *Client) SendMessageToServer(msg []byte) error

func (*Client) SendWhisperToServer

func (c *Client) SendWhisperToServer(msg []byte) error

func (*Client) SetAsHost

func (c *Client) SetAsHost(srv *server.Server)

type ClientConfig

type ClientConfig struct {
	Username      string `json:"username"`
	UserColour    string `json:"user_colour"`
	Logger        *log.Logger
	RSAKeyPair    crypto.RSAKeys
	ClientAESKey  []byte
	KeepAlivePing time.Duration
}

func SetupClientConfig

func SetupClientConfig(filePath string, manualSet bool) *ClientConfig

Jump to

Keyboard shortcuts

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