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
git-svn-id: file:///srv/svn/repo/suika/trunk@766 f0ae65fe-ee39-954e-97ec-027ff2717ef4
If a user goroutine panics, this correctly removes it from the
global map instead of leaving a dangling entry behind.
git-svn-id: file:///srv/svn/repo/suika/trunk@756 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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
git-svn-id: file:///srv/svn/repo/suika/trunk@747 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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
git-svn-id: file:///srv/svn/repo/suika/trunk@735 f0ae65fe-ee39-954e-97ec-027ff2717ef4
We want to serve metrics via both BouncerServ and Prometheus. Add
a tiny abstraction to avoid updating multiple metrics at once.
git-svn-id: file:///srv/svn/repo/suika/trunk@709 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This only exports the default metrics for now.
References: https://todo.sr.ht/~emersion/soju/142
git-svn-id: file:///srv/svn/repo/suika/trunk@707 f0ae65fe-ee39-954e-97ec-027ff2717ef4
The new upstream-user-ip directive allows bouncer operators to
assign one IP address per user.
git-svn-id: file:///srv/svn/repo/suika/trunk@705 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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
git-svn-id: file:///srv/svn/repo/suika/trunk@689 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@652 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Right now, it prints the number of active users and number of
downstream connections.
git-svn-id: file:///srv/svn/repo/suika/trunk@605 f0ae65fe-ee39-954e-97ec-027ff2717ef4
Technically we aren't spec-compliant since we don't serve
binary.ircv3.net. Any complaints will be redirected to /dev/null.
git-svn-id: file:///srv/svn/repo/suika/trunk@597 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@563 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This refactors the SQLite-specific bits into db_sqlite.go. A future
patch will add PostgreSQL support.
git-svn-id: file:///srv/svn/repo/suika/trunk@531 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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.
git-svn-id: file:///srv/svn/repo/suika/trunk@474 f0ae65fe-ee39-954e-97ec-027ff2717ef4
The subprotocol hasn't been standardized yet. It looks like the standard
is moving in another direction.
git-svn-id: file:///srv/svn/repo/suika/trunk@471 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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
git-svn-id: file:///srv/svn/repo/suika/trunk@409 f0ae65fe-ee39-954e-97ec-027ff2717ef4
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
git-svn-id: file:///srv/svn/repo/suika/trunk@398 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This allows to set the list of IPs allowed to act as a proxy. This is
only used for WebSockets right now, but will be expanded to TCP as well
once the PROXY protocol is supported.
git-svn-id: file:///srv/svn/repo/suika/trunk@370 f0ae65fe-ee39-954e-97ec-027ff2717ef4