Commit Graph

320 Commits

Author SHA1 Message Date
Simon Ser
2966723ab4
doc: add basic architecture document 2020-03-27 19:49:55 +01:00
Simon Ser
4ba2a05ebf
Move man page to doc/ 2020-03-27 19:23:41 +01:00
Simon Ser
08bb06c164
Nuke user.lock
Split user.register into two functions, one to make sure the user is
authenticated, the other to send our current state. This allows to get
rid of data races by doing the second part in the user goroutine.

Closes: https://todo.sr.ht/~emersion/soju/22
2020-03-27 19:17:58 +01:00
Simon Ser
c0f5850e5b
Add eventDownstreamDisconnected
This should remove the need for protecting user.downstreamConns with a
mutex.
2020-03-27 17:55:03 +01:00
Simon Ser
36ab6ece09
Add eventDownstreamConnected
In a later commit, we'll be able to move part of downstreamConn.register
into the user goroutine to prevent races.

References: https://todo.sr.ht/~emersion/soju/22
2020-03-27 17:21:05 +01:00
Simon Ser
474f2889d9
Introduce a user.events channel
This allows to easily add new events, and also guarantees ordering
between different event types.
2020-03-27 16:33:19 +01:00
delthas
764b54da59
Add downstream NOTICE support 2020-03-27 09:40:51 +01:00
delthas
9530df5db0
Add downstream INVITE support 2020-03-26 22:43:48 +01:00
delthas
3b6e175365
Add upstream RPL_CREATIONTIME support 2020-03-26 22:33:44 +01:00
delthas
2cb0cf3665
Fix capitalization of 'id'
Following the Go project source code guidelines, id is an abbreviation
and must typically be written as id or ID, not Id.
2020-03-26 22:28:13 +01:00
delthas
a018f35c42
Add downstream TOPIC support 2020-03-26 22:27:46 +01:00
delthas
bab26c7a6f
Add KICK support
Downstream and upstream message handling are slightly different because
downstreams can send KICK messages with multiple channels or users,
while upstreams can only send KICK messages with one channel and one
user (according to the RFC).
2020-03-26 00:15:26 +01:00
delthas
9b7309d4c9
Simplify error handling for downstream JOIN/PART
downstreamConnection.unmarshalEntity already returns an ircError of
command ERR_NOSUCHCHANNEL, so there's no need to explicitly return
another ircError of that type.
2020-03-26 00:12:53 +01:00
delthas
d00698e15c
Fix wrong handling of members parameter of RPL_NAMREPLY
Some servers (namely UnrealIRCd) wrongly add a trailing space to the
members parameters of the RPL_NAMREPLY command, which was not handled
correctly.

Adding a trailing space is not legal wrt the IRC specs, but since
UnrealIRCd does it and is in wide use today, we have to work around it.
2020-03-25 23:21:26 +01:00
delthas
6e72071716
Route NAMES, WHO, WHOIS replies to the requesting downstream
Using labeled-response, the replies to several commands such as NAMES,
WHO, WHOIS can be routed back to a specific downstream, rather than
being broadcast to all downstreams.

For example, after this commit, if the server supports labeled-response,
if a downstream requests the NAMES or WHO or WHOIS of a channel, the
replies of the upstream will only be sent back to that downstream, and
the other downstreams won't receive these messages.
2020-03-25 23:21:14 +01:00
delthas
e19f8aaba4
Add upstream labeled-response capability support 2020-03-25 23:20:56 +01:00
delthas
d0917f0fa1
Add a server-unique id to each downstream
Adding a simple uint64 id to each downstream is preparatory work
for labeled-responses tags targeting a specific downstream.
2020-03-25 23:17:46 +01:00
delthas
df8bfb75f2
Add upstream batch capability support 2020-03-25 23:16:53 +01:00
delthas
27dae3e8ad
Add upstream message-tags capability support 2020-03-25 23:15:48 +01:00
Simon Ser
44d808be8d
Add a "network status" command 2020-03-25 22:57:48 +01:00
Simon Ser
448464b0e4
Make BouncerServ commands a tree
For instance, replace "create-network" with "network create".
2020-03-25 21:03:13 +01:00
Simon Ser
04dd9d51f3
Correctly set Channel.ID in DB.StoreChannel 2020-03-25 14:23:41 +01:00
Simon Ser
02c3bdde20
Error out when storing unsupported SASL mechanism in DB 2020-03-25 14:15:25 +01:00
Simon Ser
63db290229
gitignore: add soju.db and soju.1 2020-03-25 13:44:32 +01:00
Simon Ser
33dacc4fb0
Add support for channel keys 2020-03-25 11:54:08 +01:00
Simon Ser
146906ef6b
Handle downstream JOIN/PART with multiple channel names
Closes: https://todo.sr.ht/~emersion/soju/19
2020-03-25 11:32:44 +01:00
Simon Ser
21241c2009
Consume ring buffer for networks added on-the-fly 2020-03-25 11:28:25 +01:00
Simon Ser
293a0e8e20
Move upstreamConn.ring to network
This handles upstream disconnection and re-connection better.
2020-03-25 10:53:08 +01:00
delthas
9486d657c5
Add downstream self WHO and WHOIS support 2020-03-25 09:51:22 +01:00
delthas
a958a01446
Add user hostname to downstream user prefix 2020-03-25 09:48:00 +01:00
delthas
9ff8429a53
Add downstream NAMES support
NAMES reply for channels currently joined will be returned from cache;
requests for channels not joined will be forwarded from upstream.
2020-03-25 09:47:26 +01:00
delthas
98a95e9955
Add MODE arguments support
- Add RPL_ISUPPORT support with CHANMODES, CHANTYPES, PREFIX parsing
- Add support for channel mode state with mode arguments
- Add upstream support for RPL_UMODEIS, RPL_CHANNELMODEIS
- Request channel MODE on upstream channel JOIN
- Use sane default channel mode and channel mode types
2020-03-25 09:40:08 +01:00
Simon Ser
b0ab43e5d8
Add more details to ring buffer panics 2020-03-24 09:22:40 +01:00
Simon Ser
015281ed35
Add user.{add,remove}Downstream 2020-03-23 16:05:00 +01:00
Simon Ser
c511a3c895
Add network.upstream helper 2020-03-21 10:24:38 +01:00
Simon Ser
4b9168196a
Fix typo 2020-03-21 08:44:03 +01:00
Simon Ser
ec98c6f04f
Fix empty SASL challenge message
We were sending an empty string. We need to send "+" instead.
2020-03-21 08:41:14 +01:00
Simon Ser
cb52f393f4
Drop messages on closed connections
This prevents this panic:

    panic: send on closed channel
    goroutine 9 [running]:
    git.sr.ht/~emersion/soju.(*upstreamConn).SendMessage(...)
            /home/simon/src/soju/upstream.go:866
    git.sr.ht/~emersion/soju.(*upstreamConn).handleMessage(0xc000084b40, 0xc000144680, 0x2, 0x0)
            /home/simon/src/soju/upstream.go:152 +0x62b
    git.sr.ht/~emersion/soju.(*user).run(0xc0000b8070)
            /home/simon/src/soju/user.go:144 +0x53d
    created by git.sr.ht/~emersion/soju.(*Server).Run
            /home/simon/src/soju/server.go:88 +0x286
2020-03-21 08:29:44 +01:00
Simon Ser
7114c8a1e9
Avoid sending JOIN twice for the same channel 2020-03-20 22:53:05 +01:00
Simon Ser
45d118dd12
Move upstreamConn.history to network 2020-03-20 22:48:17 +01:00
Simon Ser
7714c84669
Fix deadlocks in single-upstream mode 2020-03-20 10:42:17 +01:00
delthas
aedf66c73d Fix MODE downstream support
- Fix replies without client as first argument
- Replace wrong prefix check with a proper entity type check
2020-03-20 10:11:27 +01:00
delthas
b3ad960529 Add WHOIS support 2020-03-20 10:11:27 +01:00
delthas
54275c25ac Add WHO support 2020-03-20 00:29:03 +01:00
Simon Ser
549fbf62b1
Add basic Makefile 2020-03-19 15:11:43 +01:00
Simon Ser
166d8b0626
Remove some IRCv3 constants
go-irc v3.1.2 adds some missing IRCv3 constants.
2020-03-19 14:51:45 +01:00
Simon Ser
7dc2d4d9b1
Fix history name
dc.username contains the raw account username, not the username supplied
by the client.
2020-03-19 14:44:49 +01:00
Simon Ser
75cbc57555
readme: add ref to man page, add link to GitHub repo 2020-03-19 14:33:49 +01:00
Simon Ser
55651ede9d
man: fix typo 2020-03-19 14:18:31 +01:00
Simon Ser
80f8d71064
man: add basic man page 2020-03-19 14:16:39 +01:00