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
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
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
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
33dacc4fb0
Add support for channel keys
2020-03-25 11:54:08 +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
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
45d118dd12
Move upstreamConn.history to network
2020-03-20 22:48: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
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
e3d97bb164
Add basic infrastructure for bouncer service
2020-03-18 12:23:08 +01:00
delthas
c82438625e
Add upstream INVITE support
2020-03-18 10:26:25 +01:00
Simon Ser
1241bf82aa
Protect upstreamConn.history with a lock
2020-03-16 15:08:56 +01:00
Simon Ser
3919ee2036
Per-user dispatcher goroutine
...
This allows message handlers to read upstream/downstream connection
information without causing any race condition.
References: https://todo.sr.ht/~emersion/soju/1
2020-03-16 12:44:59 +01:00
Simon Ser
cdab0dc825
Rename messages channels to outgoing
2020-03-16 11:26:54 +01:00
Simon Ser
f3940117d1
Rename project to soju
2020-03-13 18:13:03 +01:00
Simon Ser
2239b94399
Forward NOTICE messages coming from upstream connections
2020-03-13 16:39:49 +01:00
Simon Ser
85ffadea33
Update dependencies
...
go-irc v3.1.1 contains a breaking change.
References: https://github.com/go-irc/irc/issues/76
2020-03-13 16:18:53 +01:00
Simon Ser
03d5600da6
Add support for SASL authentication
...
We now store SASL credentials in the database and automatically populate
them on NickServ REGISTER/IDENTIFY.
References: https://todo.sr.ht/~emersion/jounce/10
2020-03-13 15:12:44 +01:00
Simon Ser
fee8fc79c6
Add support for upstream PASS command
2020-03-13 12:06:02 +01:00
Simon Ser
e39948cdbd
Add upstream CAP LS support
2020-03-13 11:26:43 +01:00
Simon Ser
2a1db4cb8d
Pass-through QUIT messages
2020-03-06 18:51:11 +01:00
Simon Ser
7883e8fa23
Pass-through NICK messages for other users
2020-03-06 18:43:56 +01:00
Simon Ser
9db953c7e5
go fmt
2020-03-04 19:23:24 +01:00
Simon Ser
84fe3ae255
Add SQLite database
...
Closes: https://todo.sr.ht/~emersion/jounce/9
2020-03-04 18:22:58 +01:00
Simon Ser
88cc4c41f1
Fix TOPIC parsing, broadcast to downstream clients
2020-03-04 15:45:14 +01:00
Simon Ser
c22ce793a1
Allow clients to specify an upstream name in their username
2020-03-04 15:44:13 +01:00
Simon Ser
d1550a3cdb
Remove upstream prefix for outgoing MODE and PRIVMSG
...
We shouldn't set the prefix when sending these commands.
2020-03-03 15:33:21 +01:00
Simon Ser
70fcef297b
Add functions to translate between upstream and downstream names
2020-02-19 18:25:19 +01:00
Simon Ser
ef2d145d1f
Fix PING handlers, again
2020-02-18 20:40:32 +01:00
Simon Ser
1141698a92
Enable TCP keep-alive on all connections
2020-02-18 17:26:17 +01:00
Simon Ser
d484e6e374
Properly handle PING messages
2020-02-18 17:07:58 +01:00
Simon Ser
286fb4b18c
Add a -debug flag
2020-02-18 16:31:18 +01:00
Simon Ser
3c3f218b2b
Add upstreamConn.SendMessage
...
Allows us to change upstreamConn implementation details without updating
the whole codebase.
2020-02-17 16:17:31 +01:00
Simon Ser
9a93c56cdf
Fix issues related to Ring
...
- RingConsumer is now used directly in the goroutine responsible for
writing downstream messages. This allows the ring buffer not to be
consumed on write error.
- RingConsumer now has a channel attached. This allows PRIVMSG messages
to always use RingConsumer, instead of also directly pushing messages
to all downstream connections.
- Multiple clients with the same history name are now supported.
- Ring is now protected by a mutex
2020-02-17 15:46:29 +01:00
Simon Ser
09dffc0f68
Abbreviate {upstream,downstream}Conn with uc and dc
...
This makes it clearer than just `c` when we manipulate both kinds at the
same time.
2020-02-17 12:36:42 +01:00
Simon Ser
0cf731aeab
Don't write to downstreamConn.messages directly
...
Use a helper function instead. This will allow us to change
downstreamConn implementation details without having to update the whole
codebase.
2020-02-17 12:27:48 +01:00
Simon Ser
fad9d820c1
Add an in-memory ring buffer
...
References: https://todo.sr.ht/~emersion/jounce/2
2020-02-07 16:43:54 +01:00
Simon Ser
4de405d3b2
Handle downstream MODE messages
2020-02-07 13:08:27 +01:00
Simon Ser
519cdd9e38
Close connection from writer goroutine
...
Connections were being closed from the reader goroutine, causing issues
when sending messages and immediately closing the connection.
2020-02-07 12:42:24 +01:00
Simon Ser
e17c0b3aca
Add upstreamConn.register
2020-02-07 12:37:44 +01:00
Simon Ser
96653499dc
Add parseMessageParams helper
2020-02-07 12:36:02 +01:00
Simon Ser
6d03af8243
Allow changing nickname
2020-02-07 12:19:42 +01:00
Simon Ser
636ede13da
Add user.forEachDownstream
2020-02-07 11:56:36 +01:00
Simon Ser
3b2bb58c60
Per-user connections
2020-02-07 11:36:42 +01:00
Simon Ser
7abf426447
Forward PRIVMSG messages
2020-02-07 11:07:01 +01:00
Simon Ser
0706d45aba
Handle channel mode changes
2020-02-07 11:01:53 +01:00
Simon Ser
bd54c57d71
Handle third-party JOIN and PART messages
2020-02-07 10:54:03 +01:00
Simon Ser
8493f5b255
Use a dedicated goroutine to write upstream messages
2020-02-06 22:46:46 +01:00
Simon Ser
cd7556264e
Forward channel information
2020-02-06 22:19:31 +01:00
Simon Ser
3f2e08b949
Mark channel info as complete on RPL_ENDOFNAMES
2020-02-06 21:43:22 +01:00
Simon Ser
36c404c50c
Allow Server to have access to upstreamConn
2020-02-06 21:20:22 +01:00
Simon Ser
726d7cb54b
Add per-upstream logger
2020-02-06 20:26:03 +01:00
Simon Ser
7876ddb9c8
Split IRC helpers to separate file
2020-02-06 19:24:32 +01:00
Simon Ser
ae7f162883
Join channels on upstream servers
2020-02-06 19:22:04 +01:00
Simon Ser
836a9c6986
Handle NOTICE from upstream servers
2020-02-06 18:10:13 +01:00
Simon Ser
343d4cfded
Handle MODE messages from upstream servers
2020-02-06 18:07:35 +01:00
Simon Ser
f2b471259a
Handle upstream RPL_MYINFO messages
2020-02-06 17:04:49 +01:00
Simon Ser
9a331b9d38
Ignore some upstream messages
2020-02-06 16:39:09 +01:00
Simon Ser
b5f3bad588
Split downstram and upstream code into separate files
2020-02-06 16:18:19 +01:00