From da18a6e261ac7602e824ced203d0555935e2c5a0 Mon Sep 17 00:00:00 2001 From: initframs Date: Thu, 18 Jun 2026 18:11:14 -0700 Subject: restruct: seperate libvsic and vsicd --- README.md | 94 +++++++-------------------------------------------------------- 1 file changed, 10 insertions(+), 84 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 5580945..e260ae2 100644 --- a/README.md +++ b/README.md @@ -1,98 +1,24 @@ # vsic -![GitHub last commit](https://img.shields.io/github/last-commit/initframs/vsic) ![GitHub License](https://img.shields.io/github/license/initframs/vsic) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/initframs/vsic) ![Static Badge](https://img.shields.io/badge/binary%20size-5.47MB-blue) +![GitHub last commit](https://img.shields.io/github/last-commit/initframs/vsic) ![GitHub License](https://img.shields.io/github/license/initframs/vsic) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/initframs/vsic) ![Static Badge](https://img.shields.io/badge/binary%20size-5.47MB-blue) *very* simple internet chat +this part of the project, `libvsic`, handles framing, parsing, and other useful vsic protocol stuff. if you're looking to run a vsic server, check out [vsicd](https://github.com/initframs/vsicd). + ## features - minimal text-based protocol- no client needed, it's simple enough to be used over just plain `nc` - tiny (5.47M) and fast (starts in 0.004s, stops in 0.005s*) - easily customizable (toml config!) - > *note: start time measured as average over 128 starts/stops. excluding fixed sleep times in code - -## vsicd - -a vsic server written in go, designed to be completely async and have an ultra small footprint. only 1 config file and 3 commands. - -```bash -vsicd start # start the vsic daemon -vsicd stop # stop the vsic daemon -vsicd info # see stats like ram/cpu usage, connected clients, and more -``` - -```toml -# ~/.config/vsicd/config.toml -name = "my cool server" -motd = """ -i love vsicd -irc still good though -""" # vsicd automatically trims blank lines so your config can look better :D - -[moderation] -# banlist = "~/.config/vsicd/bans.txt" (todo) -# modcmd = "python3 ~/.config/vsicd/moderation.py" (todo) - -max_conns_per_ip = 4 -max_msgs_per_sec = 1 -max_msg_size = 4096 -max_keepalive_timeout = 120 - -[server.tcp] -enabled = false # exactly one of server.tcp/server.tls must be enabled - -[server.tls] -enabled = true -port = 4570 -ssl_cert = "/etc/certs/example.com.crt" -ssl_key = "/etc/certs/example.com.key" -``` - -### building vsicd - -vsicd is pure go, so there's no need for C interop support :) - -`-ldflags="-s -w"` removes the DWARF debugging info and the symbol table. this isn't recommended for development, but it reduces binary size. when reporting errors/bugs, don't use these options. - -```bash -CGO_ENABLED=0 go build -ldflags="-s -w" -o vsicd -``` + > *note: start time measured as average over 128 starts/stops. excluding fixed sleep times in code* ## libvsic libvsic is a collection of utils to help keep protocol behavior repeatable and to allow the protocol to be reused in other client/server implementations. -## protocol reference - -the actual vsic TCP protocol. Commands are sent in the format `COMMAND [param]`. - -### commands (client) - -the responses in the table are assuming normal behavior, they don't include cases like hitting rate limits or sending invalid parameters. - - -| Command | Sent | Purpose | Responses | -| ------------------ | --------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | -| `n/a` | when connecting to a server | inform the client they've connected | `CONNECTED` | -| `HELLO [username]` | when connecting to a server | initiate connection and register a username | `HELLO [username]` (note that if the name is already taken, a random numerical suffix is added), followed by an `MOTD` message | -| `MSG [msg]` | when sending a message | send a message for the server to broadcast | `MSG [username]: [msg]` is sent to all clients, including the original sender | -| `PING` | at specific timed intervals | tcp keepalive | `PONG` | -| `BYE` | when disconnecting | end connection | `CYA`, then server ends connection. | - - -### errors - -#### `ERROR 100` - -Sent after a malformed command or invalid parameter is received during the handshake. Terminates the connection. - -#### `ERROR 101` - -Sent after an invalid parameter is received (for example, empty `MSG`), but does not terminate the connection. Indicates the command was ignored by the server. - -#### `ERROR 102` - -Sent after an invalid command is received, but does not terminate the connection. Indicates the command was ignored by the server. - -#### `ERROR 200` - -Sent after the client attempts to send a message, but is being rate limited. +the vsic protocol is designed to be human readable, even over the raw tcp connection. to achieve this, the general command structure is very simple: +``` +COMMAND param1 param2 [etc etc] \n +``` +this structure is used both by the client and the server. +> *note: while the actual vsic protocol works this way, web clients like [lwvc](https://github.com/initframs/lwvc) most likely use a different, json-framed protocol due to the need to communicate with a ws-tcp or wss-tls compatibility layer (example: [wssc](https://github.com/initframs/wssc)) \ No newline at end of file -- cgit v1.2.3