22 Commits

Author SHA1 Message Date
kl
969469c37d service: Handle zero-value in stringPtrFlag.String
FlagSet.PrintDefaults uses reflection to construct a zero value, calls
.String on it, and compares the result with the current flag value to
detect zero-value flags. For stringPtrFlag, this would result in a
panic, as String() always dereferenced the first level of its **string.

Add another check so that both pointer levels are nil-checked.

git-svn-id: file:///srv/svn/repo/suika/trunk@333 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-10 14:18:15 +00:00
delthas
6a71f953cb Add support for the user create admin service command
This adds support for user create, a new service command only accessible
to admin users. This lets users create other users on the fly and makes
soju start the user routine immediately; unlike sojuctl which currently
requires closing soju, creating the user, and starting soju again.

git-svn-id: file:///srv/svn/repo/suika/trunk@329 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-08 20:30:09 +00:00
delthas
ff63d3e24e Add support for admin-restricted service commands
This is preparatory work for creating new users from a service command.

This adds support for specifying specific service commands as
admin-restricted. Only admin users can run these commands. These
commands won't show up in the help when run from a non-admin
user, unless the user is requesting help for that specific command.

git-svn-id: file:///srv/svn/repo/suika/trunk@328 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-08 20:30:09 +00:00
delthas
e853516870 Rename handleServiceCreateNetwork to handleServiceNetworkCreate
This renames handleServiceCreateNetwork for consistency with other
service commands.

git-svn-id: file:///srv/svn/repo/suika/trunk@325 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-08 20:30:09 +00:00
contact
5aef4e44a8 Introduce ircConn
This interface will allow a conn to be backed by a websocket.

git-svn-id: file:///srv/svn/repo/suika/trunk@315 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-04 15:27:57 +00:00
contact
d7d1f89ecf Add network update command
The user.updateNetwork function is a bit involved because we need to
make sure that the upstream connection is closed before re-connecting
(would otherwise cause "Nick already used" errors) and that the
downstream connections' state is kept in sync.

References: https://todo.sr.ht/~emersion/soju/17

git-svn-id: file:///srv/svn/repo/suika/trunk@313 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-04 11:04:39 +00:00
fox.cpp
5f49770e07 Implement upstream SASL EXTERNAL support
Closes: https://todo.sr.ht/~emersion/soju/47

git-svn-id: file:///srv/svn/repo/suika/trunk@307 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-06-02 09:24:22 +00:00
contact
e74291b093 Remove network.upstream
This is an artifact from when we used locks. No need for this anymore.

git-svn-id: file:///srv/svn/repo/suika/trunk@279 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-30 08:25:16 +00:00
contact
eef5879a61 Abbreviate net status service reply
Don't print the nickname if it's the same as the downstream
connection's.

git-svn-id: file:///srv/svn/repo/suika/trunk@271 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-28 14:27:53 +00:00
delthas
67237abdea Add support for the irc+insecure address scheme
Some servers do not support TLS, or have invalid, expired or self-signed
TLS certificates. While the right fix would be toi contact each server
owner to add support for valid TLS, supporting plaintext upstream
connections is sometimes necessary.

This adds support for the irc+insecure address scheme, which connects to
a network in plain-text over TCP.

git-svn-id: file:///srv/svn/repo/suika/trunk@270 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-28 09:41:13 +00:00
delthas
d94fe63d8a Add support for IRC address schemes
This is preparatory work for adding other connection types to upstream
servers. The service command `network create` now accepts a scheme in
the address flag, which specifies how to connect to the upstream server.

The only supported scheme for now is ircs, which is also the default if
no scheme is specified. ircs connects to a network over a TLS TCP
connection.

git-svn-id: file:///srv/svn/repo/suika/trunk@269 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-28 09:41:13 +00:00
delthas
218af4327e Add support for custom network on-connect commands
Some servers use custom IRC bots with custom commands for registering to
specific services after connection.

This adds support for setting custom raw IRC messages, that will be
sent after registering to a network.

It also adds support for a custom flag.Value type for string
slice flags (flags taking several string values).

git-svn-id: file:///srv/svn/repo/suika/trunk@263 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-16 15:38:47 +00:00
admin
017d8be225 Allow users to change password in client
Added a BouncerServ command for that.

git-svn-id: file:///srv/svn/repo/suika/trunk@252 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-10 08:16:25 +00:00
contact
60d04d512d Only print addr if necessary in network status service command
git-svn-id: file:///srv/svn/repo/suika/trunk@224 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-05 13:20:13 +00:00
delthas
ac110eaccc Fill all fields of the service user prefix
On some IRC clients, NOTICE messages from a user which does not have a
user or host in its prefix (and therefore only have a Name, and look
like prefixes of servers), are treated as server notices rather than
user notices, and are treated differently. (For that matter, soju also
considers NOTICE messages from users with only a Name in their prefix as
special server messages). On most of these clients, NOTICE messages from
a user are formatted differently and stand out from the large flow of
incoming misceallenous server messages.

This fills the service user with fake User and Host values so that
NOTICE messages from it correctly appear as coming from a user. This
is particularly useful in the context of connection and disconnect
errors NOTICE messages that are broadcast from the service user to all
relevant downstreams.

git-svn-id: file:///srv/svn/repo/suika/trunk@220 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-04 15:34:30 +00:00
delthas
4ccc12d584 Send the last error for disconnected networks in network status
This adds support for sending the exact error message of a network when
it is disconnected, in the reply to the service command `network
status`. This lets users easily examine why a network is currently
disconnected.

No lock is needed because all reads and writes of network.lastError are
made in the user goroutine.

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

git-svn-id: file:///srv/svn/repo/suika/trunk@219 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-04 15:34:12 +00:00
delthas
c03e14ee9e Send one NOTICE on new upstream disconnect/connect errors
In order to notify the user when we are disconnected from a network
(either due to an error, or due a QUIT), and when we fail reconnecting,
this commit adds support for sending a short NOTICE message from the
service user to all relevant downstreams.

The last error is stored, and cleared on successful connection, to
ensure that the user is *not* flooded with identical connection error
messages, which can often happen when a server is down.

No lock is needed on lastError because it is only read and modified from
the user goroutine.

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

git-svn-id: file:///srv/svn/repo/suika/trunk@218 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-04 15:33:09 +00:00
contact
d317a87876 Add "network delete" service command
And add all the infrastructure required to stop and delete networks.

References: https://todo.sr.ht/~emersion/soju/17

git-svn-id: file:///srv/svn/repo/suika/trunk@202 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-04-01 13:40:20 +00:00
contact
23af40ce3d Add a "network status" command
git-svn-id: file:///srv/svn/repo/suika/trunk@151 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-25 21:57:48 +00:00
contact
d64a0f318a Make BouncerServ commands a tree
For instance, replace "create-network" with "network create".

git-svn-id: file:///srv/svn/repo/suika/trunk@150 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-25 20:03:13 +00:00
delthas
c4fc09cea0 Add create-network bouncer service command
git-svn-id: file:///srv/svn/repo/suika/trunk@120 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-19 00:14:44 +00:00
contact
0504ff78cf Add basic infrastructure for bouncer service
git-svn-id: file:///srv/svn/repo/suika/trunk@117 f0ae65fe-ee39-954e-97ec-027ff2717ef4
2020-03-18 11:23:08 +00:00