https://github.com/timboudreau/scamper-chat
An IRC-like chat client and server using SCTP, based on Scamper+Netty
https://github.com/timboudreau/scamper-chat
async chat java netty sctp
Last synced: 8 months ago
JSON representation
An IRC-like chat client and server using SCTP, based on Scamper+Netty
- Host: GitHub
- URL: https://github.com/timboudreau/scamper-chat
- Owner: timboudreau
- Created: 2015-01-16T03:20:54.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2022-05-16T23:12:10.000Z (over 3 years ago)
- Last Synced: 2025-04-05T19:23:44.670Z (9 months ago)
- Topics: async, chat, java, netty, sctp
- Language: Java
- Size: 84 KB
- Stars: 15
- Watchers: 5
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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](https://github.com/timboudreau/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
------------
* Java 8
* [Cryptography Extensions for Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html)
if you (sorry!) want to use password-protected rooms
* *Linux Users* need [lksctp-tools](http://lksctp.sourceforge.net/) - if you see an error about loading native libraries, you don't have it
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 [MessageType](http://timboudreau.com/builds/job/scamper/lastSuccessfulBuild/artifact/scamper/target/apidocs/com/mastfrog/scamper/MessageType.html)s 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).
* The continuous build is [here](http://timboudreau.com/builds/job/scamper-chat/)
* [Server JAR download](http://timboudreau.com/builds/job/scamper-chat/lastSuccessfulBuild/artifact/scamper-hub/target/scamper-hub-server.jar)
* [Client JAR download](http://timboudreau.com/builds/job/scamper-chat/lastSuccessfulBuild/artifact/scamper-chat-cli/target/scamper-chat-client.jar)
* Javadoc:
* [Chat Client Base Javadoc](http://timboudreau.com/builds/job/scamper-chat/lastSuccessfulBuild/artifact/scamper-chat-client-base/target/apidocs/index.html)
* [Scamper-Chat Common Javadoc](http://timboudreau.com/builds/job/scamper-chat/lastSuccessfulBuild/artifact/scamper-chat-common/target/apidocs/index.html)
* [Scamper-Chat MessageTypes Javadoc](http://timboudreau.com/builds/job/scamper-chat/lastSuccessfulBuild/artifact/scamper-chat-messagetypes/target/apidocs/index.html)
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](http://www.bitchx.com/) for the command-line client - this is complicated by the lack of a reliable way to get terminal dimensions in Java, though [jline](http://jline.sourceforge.net/) 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