811 Commits

Author SHA1 Message Date
contact
6de32aea34 Handle upstream multi-line SASL
References: https://todo.sr.ht/~emersion/soju/173

git-svn-id: file:///srv/svn/repo/suika/trunk@761 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-10 09:46:41 +00:00
contact
28994d6bde Add support for downstream multi-line AUTHENTICATE commands
Useful for long passwords.

git-svn-id: file:///srv/svn/repo/suika/trunk@760 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-09 22:21:08 +00:00
contact
52e40a3e0e Block RPL_{CREATIONTIME,TOPICWHOTIME} for detached channels
Closes: https://todo.sr.ht/~emersion/soju/132

git-svn-id: file:///srv/svn/repo/suika/trunk@759 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-09 11:12:20 +00:00
contact
8a03d66c9f Don't forward duplicate JOIN commands
Closes: https://todo.sr.ht/~emersion/soju/171

git-svn-id: file:///srv/svn/repo/suika/trunk@758 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-08 17:23:46 +00:00
contact
d5a071dd91 Add context to {conn,upstreamConn}.SendMessage
This avoids blocking on upstream message rate limiting for too
long.

git-svn-id: file:///srv/svn/repo/suika/trunk@757 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-08 17:03:40 +00:00
contact
bafd6c3e41 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.

git-svn-id: file:///srv/svn/repo/suika/trunk@756 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-08 14:00:02 +00:00
contact
fcac9d5cdd service: send summary when executing "server notice"
Sometimes this command times out. Display the number of skipped
users.

git-svn-id: file:///srv/svn/repo/suika/trunk@755 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-08 13:55:31 +00:00
contact
6487d245a4 Use dc.nick instead of "*" for RPL_* messages
Makes it clearer what these fields are used for. The default value
for dc.nick is "*".

git-svn-id: file:///srv/svn/repo/suika/trunk@754 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-07 08:42:32 +00:00
contact
9a91517fc5 Improve error message when downstream doesn't authenticate
git-svn-id: file:///srv/svn/repo/suika/trunk@753 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-07 08:40:02 +00:00
contact
4d4886e359 Use more descriptive errors when aborting pending commands
git-svn-id: file:///srv/svn/repo/suika/trunk@752 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 21:33:50 +00:00
contact
2a56c11036 Disallow ',' in nicknames
It breaks lists as in `PRIVMSG a,b,c :foo`.

git-svn-id: file:///srv/svn/repo/suika/trunk@751 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 18:23:28 +00:00
contact
c1b86bbf9c Add username to downstreamConn log messages
git-svn-id: file:///srv/svn/repo/suika/trunk@750 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 17:56:00 +00:00
contact
1059ee4607 Improve msgStore.Append log message wording
git-svn-id: file:///srv/svn/repo/suika/trunk@749 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 17:46:10 +00:00
contact
8646b0e5db Downgrade conn log messages to debug
git-svn-id: file:///srv/svn/repo/suika/trunk@748 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 17:40:37 +00:00
contact
ab7067fa48 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

git-svn-id: file:///srv/svn/repo/suika/trunk@747 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 17:35:49 +00:00
contact
608d415c30 Remove Logger.Print
Callers can just use Logger.Printf instead.

git-svn-id: file:///srv/svn/repo/suika/trunk@746 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 17:27:36 +00:00
contact
c74b16c19f Stop incrementing hopcount in RPL_WHOREPLY
It's extra code for something clients should ignore because it's
unreliable and useless.

git-svn-id: file:///srv/svn/repo/suika/trunk@745 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 17:08:53 +00:00
contact
5dd0243bb1 Read nickname from RPL_WELCOME
References: https://github.com/ircdocs/modern-irc/pull/146

git-svn-id: file:///srv/svn/repo/suika/trunk@744 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-06 16:58:54 +00:00
contact
f638c52c9b Fallback to alt nick
If the nickname we want is taken, fallback to another one by
appending underscores. Use MONITOR to figure out when we can request
our desired nick again.

Closes: https://todo.sr.ht/~emersion/soju/35

git-svn-id: file:///srv/svn/repo/suika/trunk@743 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-04 19:07:23 +00:00
contact
da3d8aaa8c Avoid forwarding MONITOR requests if upstream doesn't support it
Clients aren't supposed to do this, but in case they do, let's
send them an error.

git-svn-id: file:///srv/svn/repo/suika/trunk@742 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-04 18:29:39 +00:00
contact
5d8bf4f0ef Use golang.org/x/time/rate
Instead of hand-rolling our own rate-limiter based on goroutines,
use golang.org/x/time/rate.

git-svn-id: file:///srv/svn/repo/suika/trunk@741 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 22:52:29 +00:00
contact
5e2a9f86c9 Add context to network.storeClientDeliveryReceipts
git-svn-id: file:///srv/svn/repo/suika/trunk@740 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 22:32:12 +00:00
contact
0331e8241c Add context to upstreamConn.handleMessage
git-svn-id: file:///srv/svn/repo/suika/trunk@739 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 22:27:12 +00:00
contact
886ae69bc6 Cancel pending commands on downstream disconnect
If a client queues a high number of commands and then disconnects,
remove all of the pending commands. This avoids unnecessarily
sending commands whose results won't be used.

git-svn-id: file:///srv/svn/repo/suika/trunk@738 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 18:29:44 +00:00
contact
b9180f0b42 Mark ACCOUNT_REQUIRED error as permanent connection failure
There's no point in retrying to connect in this case.

git-svn-id: file:///srv/svn/repo/suika/trunk@737 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 16:58:56 +00:00
contact
85e0641af8 Don't retry connecting on permanent failure
Closes: https://todo.sr.ht/~emersion/soju/164

git-svn-id: file:///srv/svn/repo/suika/trunk@736 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 16:33:11 +00:00
contact
993177a2c0 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

git-svn-id: file:///srv/svn/repo/suika/trunk@735 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 11:14:35 +00:00
contact
1eaf9afc48 Add soju_upstream_connect_errors_total metric
git-svn-id: file:///srv/svn/repo/suika/trunk@734 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 10:15:51 +00:00
contact
49d75b4a4b Fix upstream gauge metric
It wasn't decremented on error. While at it, increment it when
connecting to the upstream network.

git-svn-id: file:///srv/svn/repo/suika/trunk@733 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 10:03:56 +00:00
contact
6c2a942af3 Add context to connectToUpstream
git-svn-id: file:///srv/svn/repo/suika/trunk@732 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-02 09:53:43 +00:00
contact
a7785769b2 Validate address in user.checkNetwork
git-svn-id: file:///srv/svn/repo/suika/trunk@731 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-01 14:57:54 +00:00
contact
fd58864d3f Add "sasl status" command
git-svn-id: file:///srv/svn/repo/suika/trunk@730 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-12-01 10:03:27 +00:00
contact
f60544b6f8 Add support for draft/account-registration proxying
This adds support for the draft/account-registration extension [1].
This allows downstreams to register on upstream networks.

[1]: https://ircv3.net/specs/extensions/account-registration

git-svn-id: file:///srv/svn/repo/suika/trunk@729 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-30 11:02:54 +00:00
contact
7f11c8a67b doc/soju.1: add network create example
git-svn-id: file:///srv/svn/repo/suika/trunk@728 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-30 08:26:07 +00:00
contact
501daacf2f downstream: improve unmarshalEntityNetwork error message
Closes: https://todo.sr.ht/~emersion/soju/162

git-svn-id: file:///srv/svn/repo/suika/trunk@727 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-29 15:41:52 +00:00
contact
14fe903059 Return more descriptive auth failure errors
git-svn-id: file:///srv/svn/repo/suika/trunk@726 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-29 12:14:16 +00:00
contact
d8ef203c84 Remove sasl cap after registration if network doesn't support it
This will stop clients from trying to issue AUTHENTICATE requests
after connection registration.

git-svn-id: file:///srv/svn/repo/suika/trunk@725 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-21 15:28:38 +00:00
contact
756a37c778 Add support for post-connection-registration upstream SASL auth
Once the downstream connection has logged in with their bouncer
credentials, allow them to issue more SASL auths which will be
redirected to the upstream network. This allows downstream clients
to provide UIs to login to transparently login to upstream networks.

git-svn-id: file:///srv/svn/repo/suika/trunk@724 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-21 15:10:54 +00:00
contact
27bc8188ff Send RPL_LOGGEDIN with bouncer account in multi-upstream mode
git-svn-id: file:///srv/svn/repo/suika/trunk@723 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-21 10:00:57 +00:00
contact
c9c288b749 Use RPL_LOGGEDIN/OUT to mirror upstream status
This will allow clients to properly show/hide UI to login and
register.

git-svn-id: file:///srv/svn/repo/suika/trunk@722 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-19 18:21:48 +00:00
contact
8d130a9d92 Abort SASL if in-progress while completing registration
Implements the following recommendation from the spec:

> If the client completes registration (with CAP END, NICK, USER and any other
> necessary messages) while the SASL authentication is still in progress, the
> server SHOULD abort it and send a 906 numeric, then register the client
> without authentication.

git-svn-id: file:///srv/svn/repo/suika/trunk@721 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-19 17:55:07 +00:00
contact
292ad7748c Add missing account-notify to permanentUpstreamCaps
git-svn-id: file:///srv/svn/repo/suika/trunk@720 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-19 10:55:22 +00:00
tomvig38
4b4d3d4543 Add CHATHISTORY LATEST support
This patch adds a bit more compliance to the chathistory IRCv3 specification.

git-svn-id: file:///srv/svn/repo/suika/trunk@719 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-18 20:06:26 +00:00
contact
4961e5f107 contrib/clients: WeeChat 3.3 enables all IRCv3 caps by default
git-svn-id: file:///srv/svn/repo/suika/trunk@718 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-18 20:05:58 +00:00
contact
6dde2649b6 Disallow empty string for nick
git-svn-id: file:///srv/svn/repo/suika/trunk@717 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-18 08:44:33 +00:00
hubert
bb7b240a5b Allow AUTHENTICATE before NICK
Now that dc.nick is not blank during registration, sasl replies from the
server are correct and cap handling can be a bit simplified.

git-svn-id: file:///srv/svn/repo/suika/trunk@716 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-18 08:40:23 +00:00
contact
bd1a481bfb doc/per-user-ip: new documentation article
git-svn-id: file:///srv/svn/repo/suika/trunk@715 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-17 17:04:14 +00:00
contact
9faf7f6b8f Upgrade dependencies
git-svn-id: file:///srv/svn/repo/suika/trunk@714 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-17 15:57:41 +00:00
contact
467c6df654 Add pprof HTTP server
This enables production debugging of the bouncer.

Closes: https://todo.sr.ht/~emersion/soju/155

git-svn-id: file:///srv/svn/repo/suika/trunk@713 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-17 15:18:52 +00:00
contact
8b44d4ce3c Add Prometheus instrumentation for the database
git-svn-id: file:///srv/svn/repo/suika/trunk@712 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2021-11-17 14:58:19 +00:00