lanchat

command module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: BSD-2-Clause Imports: 9 Imported by: 0

README

Lanchat

go

Chat on the terminal over the local network.

Tested only on Linux.

Usage

Download the binary and run it:

./lanchat -u my_user

Run ./lanchat -h to see available flags. Besides command line flags, options can be passed via a configuration file (see the configuration file section below).

The program automatically detects if there's already a running Lanchat server in the local network and connects to it. If there isn't, the command starts one on port 6776.

Start typing to chat, or run one of the available commands (enter :help to see what these are).

Build from source

Download repository and run make.

Plan

  • Handle broadcasts properly (host should forward messages to all clients)
  • Fix handling of :id command: change own label
  • Transmit administrative messages to all peers (e.g. "user 'bla' connected")
  • Add notifications with a cooldown
  • Configuration file
  • Become host if previous host disconnects; ping peers periodically
  • Add :help command
  • Every peer should know about all others, not just the host.
  • Use peer information to make host reelection more reliable
  • Show current peers with :info
  • Show currently connected peers on a side tab
  • More tests
  • Move to Go 1.18. There are functions that could be merged with generics (compareUIPackets and compareNetPackets, for example). Add fuzzing tests.

Testing

A crude integration test can be run with make check. It creates a chat with few users and runs some commands for inspection.

Architecture

The app is separated into two components:

  • Client: Handles networking, sending and receiving messages, scanning for peers. It also parses both outbound and inbound messages to process commands (messages starting with :)
  • UI: Responsible for handling the user interface, both the chat window and notifications.

Client and UI communicate to each other through two channels. For example, if the client receives a regular message, it will forward it to the UI to be rendered.

Configuration file

A filepath can be passed to lanchat for configuration with:

./lanchat -c my_config.toml

Below is an example TOML:

username = "icarus" # default 'noone'
port = 6777         # default 6776
local = true        # default false
notify = false      # default true
force-host = true   # default false

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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