jonaswagner / scamper-chat

An IRC-like chat client and server using SCTP, based on Scamper+Netty

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scamper Chat

This is an IRC-like chat application consisting of a server, a command-line client and some libraries for shared code. It uses SCTP rather than TCP in its wire protocol, and the scamper library that makes it easy to write protocols using SCTP.

Features

  • Multiple chat rooms, IRC-style, with similar commands
  • Ansi-colored shell client
  • End-to-end Blowfish encryption on password-protected rooms - meaning that the server cannot decrypt the chat messages (the server does store a SHA-512 hash of the password to reject access, but has no way to decrypt messages).

This project serves as a demo of how to write servers with Scamper, in addition to being usable in its own right.

Requirements

If either of the latter are missing, the client will let you know.

Configuration

The client by default attempts to connect to a public server that is up for the time being (no promises), so it can be run with no arguments:

java -jar scamper-chat-client.jar

To connect to a different server, pass --port and --host on the command-line, e.g.

java -jar scamper-chat-client.jar --port 8007 --host foo.bar.com

The server can be configured similarly using command-line options

Subprojects

  • Scamper Hub - the server - build and run with java -jar
  • Scamper Chat CLI - command-line ansi-colored chat client featuring IRC-like commands (/join, /who, /rooms, etc.) - also build and run with java -jar

The rest are supporting projects for those:

  • Scamper Chat Common - POJO data types used in the wire protocol, and base classes for clients
  • Scamper Chat Message Types - Defines the Scamper MessageTypes that are used by client and server to choose handlers for particular kinds of messages
  • Scamper Chat Client Base - Base classes that provide a simple interface for writing scamper-chat clients

Downloads And Builds

Building is as simple as cloning this repository and running mvn install (Maven 3.2.x or later and JDK 8 recommended).

Wire Format

The wire-format is BSON with gzip compression for larger messages; encryption is applied to message bodies by the client and decrypted by receiving clients.

To-Do

Plenty of things could be done with this:

  • Get the server working with multiple-associations (SCTP allows a connection to be to multiple redundant machines)
  • Do something more like bitchx for the command-line client - this is complicated by the lack of a reliable way to get terminal dimensions in Java, though jline looks like it could help
    • This could be done by assuming a fixed console size, it just wouldn't be pretty
  • Implement additional IRC-like commands (it would pay to split this stuff out into command-objects in the CLI)
  • Swap out the JCE Blowfish with BCrypt or some JCE-independent implementation of Twofish to be done with needing the Java crypto extensions - math is not a munition, and the fact that this doesn't come built into Java is a ridiculous artifact of the 90s
  • Adapter Netty's SSL engine to server/client communication
    • Use certs to validate that you're really talking to the server you think you are

About

An IRC-like chat client and server using SCTP, based on Scamper+Netty


Languages

Language:Java 100.0%