Simon Ser
027a89a0b0
server: log when waiting for user goroutines on shutdown
...
Useful for debugging.
2022-09-18 21:43:31 +02:00
Simon Ser
d354c73933
server: close queued up connections on shutdown
...
Closes: https://todo.sr.ht/~emersion/soju/204
2022-09-18 21:37:45 +02:00
Simon Ser
05a382ef16
Downgrade Web Push urgency for unimportant messages
...
For instance TAGMSG and MARKREAD aren't really high urgency.
2022-08-17 16:04:11 +02:00
Jeff Martin
a662091a9d
server: fix panic stacktrace print formatting
...
This change uses string formatting for the output of debug.Stack. The
output of debug.Stack is []byte, which isn't human readable.
2022-08-08 15:27:04 +02:00
Reto Brunner
ac01ac0143
Use output given to NewLogger
...
Previously the output param was ignored
2022-08-02 10:11:25 +02:00
Simon Ser
3863b8cb6b
Add webpush extension
...
References: https://github.com/ircv3/ircv3-specifications/pull/471
Co-authored-by: delthas <delthas@dille.cc>
2022-06-14 16:16:12 +02:00
Simon Ser
95db42e645
Move identd to separate package
2022-05-09 16:36:54 +02:00
Simon Ser
3a7dee8128
Introduce a database package
2022-05-09 15:08:04 +02:00
Simon Ser
5de2a7ec12
Remove unnecessary lastDownstreamID initialization
2022-04-04 09:59:16 +02:00
Simon Ser
9f002d0409
server: print panic stack trace as string
...
debug.Stack() returns a byte slice.
2022-04-04 09:54:48 +02:00
Simon Ser
69e9b6a439
Retry on temporary net.Listener failure
...
Instead of stopping to listen, retry on temporary failure. This
can happen when running out of FDs.
Closes: https://todo.sr.ht/~emersion/soju/183
2022-01-19 22:35:46 +01:00
Simon Ser
d21fc06d88
server: cleanup user in defer
...
If a user goroutine panics, this correctly removes it from the
global map instead of leaving a dangling entry behind.
2021-12-08 15:00:02 +01:00
Simon Ser
d829d2ab12
Add Logger.Debugf
...
Makes it easy to print debugging messages which aren't targeted at
the user. See [1] for motivation.
[1]: https://dave.cheney.net/2015/11/05/lets-talk-about-logging
2021-12-06 18:35:49 +01:00
Simon Ser
7dd884d3da
Remove Logger.Print
...
Callers can just use Logger.Printf instead.
2021-12-06 18:27:36 +01:00
Simon Ser
578020e553
Add exponential backoff when re-connecting to upstream
...
The first reconnection attempt waits for 1min, the second the 2min,
and so on up to 10min. There's a 1min jitter so that multiple failed
connections don't try to reconnect at the exact same time.
Closes: https://todo.sr.ht/~emersion/soju/161
2021-12-02 12:14:35 +01:00
Simon Ser
8acc07d591
Add soju_upstream_connect_errors_total metric
2021-12-02 11:15:51 +01:00
Simon Ser
5a5c93a756
Add message counter metrics
2021-11-17 15:58:19 +01:00
Simon Ser
efc4c62725
Add number of upstream connections to metrics
2021-11-17 15:58:19 +01:00
Simon Ser
7fa8c78122
Add int64 gauge abstraction
...
We want to serve metrics via both BouncerServ and Prometheus. Add
a tiny abstraction to avoid updating multiple metrics at once.
2021-11-17 15:58:19 +01:00
Simon Ser
df6b161f55
Add basic active users and downstreams metrics
2021-11-17 15:58:19 +01:00
Simon Ser
8f8d7aab0e
Add basic Prometheus metrics exporter
...
This only exports the default metrics for now.
References: https://todo.sr.ht/~emersion/soju/142
2021-11-17 15:58:18 +01:00
Simon Ser
55840312b4
Add per-user IP addresses
...
The new upstream-user-ip directive allows bouncer operators to
assign one IP address per user.
2021-11-17 15:07:58 +01:00
Simon Ser
97152191ad
Add timeout for downstream connection registration
2021-11-17 14:54:03 +01:00
Simon Ser
3941f67380
Add config option to globally disable multi-upstream mode
...
Closes: https://todo.sr.ht/~emersion/soju/122
2021-11-17 11:41:11 +01:00
Simon Ser
73295e4fa7
Allow most config options to be reloaded
...
Closes: https://todo.sr.ht/~emersion/soju/42
2021-11-16 00:38:04 +01:00
Simon Ser
b9e06e498e
Add panic handlers for user and downstream goroutines
...
This only brings down a single user or downstream on panic, instead
or bringing down the whole bouncer.
Closes: https://todo.sr.ht/~emersion/soju/139
2021-11-15 21:40:17 +01:00
Simon Ser
d870efa666
Add context support to Server.createUser
2021-11-08 20:29:14 +01:00
Simon Ser
8b3e5e7465
Plumb context in downstreamConn.handleMessageRegistered
...
References: https://todo.sr.ht/~emersion/soju/141
2021-11-08 18:11:24 +01:00
Simon Ser
abe5f362db
Turn CHATHISTORY and backlog limits into constants
2021-11-03 18:29:21 +01:00
Simon Ser
ce69f00e3f
msgstore: add context to messageStore methods
...
This allows setting a hard timeout.
2021-11-03 18:21:05 +01:00
Simon Ser
07c962018d
Add title config option
...
Closes: https://todo.sr.ht/~emersion/soju/146
2021-11-02 22:38:07 +01:00
Simon Ser
4e35b4812f
Fix missing imports in server.go
...
Oops.
2021-10-29 16:18:34 +02:00
Simon Ser
aa407a46e6
Get rid of io.EOF errors in logs
...
Closes: https://todo.sr.ht/~emersion/soju/150
2021-10-29 16:03:04 +02:00
Simon Ser
9ec1f1a5b0
Add context args to Database interface
...
This is a mecanical change, which just lifts up the context.TODO()
calls from inside the DB implementations to the callers.
Future work involves properly wiring up the contexts when it makes
sense.
2021-10-18 19:15:15 +02:00
Simon Ser
a9a066faac
Add bouncer MOTD
...
Closes: https://todo.sr.ht/~emersion/soju/137
2021-10-13 10:58:34 +02:00
Simon Ser
94dbfff11d
Add max-user-networks config option
2021-10-07 20:43:10 +02:00
Simon Ser
f93616fb41
Add "server status" command
...
Right now, it prints the number of active users and number of
downstream connections.
2021-10-05 19:13:53 +02:00
Simon Ser
1626ffb97b
Use isErrClosed in Server.Serve
2021-10-05 14:02:59 +02:00
Simon Ser
410ba47277
Close DB on shutdown
2021-10-05 11:53:38 +02:00
Simon Ser
5bedcd24e2
Add support for IRCv3 WebSocket text subprotocol
...
Technically we aren't spec-compliant since we don't serve
binary.ircv3.net. Any complaints will be redirected to /dev/null.
2021-09-28 21:25:06 +02:00
Simon Ser
d7b1c5a9a2
Allow admins to broadcast message to all bouncer users
...
Typically done via:
/notice $<bouncer> <message>
Or, for a connection not bound to a specific network:
/notice $* <message>
The message is broadcast as BouncerServ, because that's the only
user that can be trusted to belong to the bouncer by users. Any
other prefix would conflict with the upstream network.
2021-06-23 19:23:09 +02:00
Drew DeVault
61b68d6dfb
db: refactor into interface
...
This refactors the SQLite-specific bits into db_sqlite.go. A future
patch will add PostgreSQL support.
2021-05-25 16:35:39 +02:00
Simon Ser
927ee80da1
Stop reading X-Forwarded-Port
...
X-Forwarded-Port contains the destination port, not the source port,
so it isn't useful for our purposes.
Move parsing of X-Forwarded-* header fields to parseForwarded.
2021-03-18 13:28:46 +01:00
Simon Ser
1b49fff763
Fix Forwarded HTTP header handling
...
"for" contains the port, if any. "port" doesn't exist.
2021-03-18 13:21:38 +01:00
Simon Ser
9046fda283
Add support for the Forwarded HTTP header
...
This is the standard replacing X-Forwarded-*.
2021-03-18 12:08:25 +01:00
Simon Ser
5b7205c9c1
Drop "irc" WebSocket subprotocol
...
The subprotocol hasn't been standardized yet. It looks like the standard
is moving in another direction.
2021-03-18 12:02:36 +01:00
Simon Ser
08b1010939
Add support for graceful shutdown
...
Closes: https://todo.sr.ht/~emersion/soju/45
2021-02-09 17:34:46 +01:00
Simon Ser
92fece5cd4
Nuke in-memory ring buffer
...
Instead, always read chat history from logs. Unify the implicit chat
history (pushing history to clients) and explicit chat history
(via the CHATHISTORY command).
Instead of keeping track of ring buffer cursors for each client, use
message IDs.
If necessary, the ring buffer could be re-introduced behind a
common MessageStore interface (could be useful when on-disk logs are
disabled).
References: https://todo.sr.ht/~emersion/soju/80
2020-08-20 20:05:01 +02:00
Simon Ser
bdb132ad98
Implement rate limiting for upstream messages
...
Allow up to 10 outgoing messages in a burst, then throttle to 1 message
each 2 seconds.
Closes: https://todo.sr.ht/~emersion/soju/87
2020-08-19 19:42:33 +02:00
Simon Ser
65302d3c1e
Add an ident server
...
Closes: https://todo.sr.ht/~emersion/soju/69
2020-08-11 10:59:06 +02:00