Commit Graph

1104 Commits

Author SHA1 Message Date
Simon Ser
d5db7c988f
Rename consumption to ringMessage 2020-03-16 14:05:48 +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
7fe0986859
Split user logic into its own file 2020-03-16 11:18:41 +01:00
Simon Ser
88877f3c5a
Strip client & network name from username 2020-03-16 09:32:18 +01:00
Simon Ser
3dbc205beb
Add sojuctl to .gitignore 2020-03-13 18:14:14 +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
dad8bc2173
schema: add Channel.key 2020-03-13 12:30:01 +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
85f28daf2d
Auto-save IRC networks 2020-03-12 21:28:09 +01:00
Simon Ser
0ef08dfbb5
Store NICK changes in the DB 2020-03-12 19:17:06 +01:00
Simon Ser
0c4e9b539c
Update DB on JOIN and PART 2020-03-12 18:33:03 +01:00
Simon Ser
461de13ecc
Fix nil dereference when network is specified in username 2020-03-12 18:21:41 +01:00
Simon Ser
2dfbbf18fd
schema: add UNIQUE constraints 2020-03-12 15:33:49 +01:00
Simon Ser
c732b82976
schema: make User.password NOT NULL 2020-03-12 15:23:46 +01:00
Simon Ser
f3656028f6
Add support for PASS to downstream 2020-03-11 19:09:32 +01:00
Simon Ser
a572b24702
cmd/jouncectl: new command
Allows to create users.
2020-03-11 19:01:03 +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
660e4c035d
Use a RWMutex for DB 2020-03-04 20:15:38 +01:00
Simon Ser
e25037f5a6
readme: pipe commands into sqlite3 instead of using -init
This makes it so sqlite3 exits after executing the file.
2020-03-04 20:13:20 +01:00
Simon Ser
9db953c7e5
go fmt 2020-03-04 19:23:24 +01:00
Simon Ser
57fd268f77
readme: add instructions to initialize database 2020-03-04 18:27:33 +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
eacd4e6f0c
Rename network to upstreamName 2020-03-04 16:02:45 +01:00
Simon Ser
03c546e8bf
Remove unused user.getChannel, move getUpstream to user 2020-03-04 16:00:19 +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
c366b5320c
Retry connecting to upstream servers
Rate-limit retries in case connecting immediately fails.
2020-03-03 15:26:19 +01:00
Simon Ser
6e12347f2b
cmd/jounce: fix non-TLS listener address 2020-03-03 15:15:57 +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
8997a70acb
Don't leave connections half-opened 2020-02-18 16:54:06 +01:00
Simon Ser
286fb4b18c
Add a -debug flag 2020-02-18 16:31:18 +01:00
Simon Ser
9fea758956
Fix panic when closing downstream connection 2020-02-18 15:08:06 +01:00
Simon Ser
1f5a72a7cf
Add config file 2020-02-18 14:10:23 +01:00
Simon Ser
603bd6bdef
Add CLI flags for listening address and hostname 2020-02-17 16:25:09 +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
70d811f5a8
Document Ring 2020-02-17 16:09:35 +01:00
Simon Ser
528c402bd0
Forward PRIVMSG coming from downstream 2020-02-17 15:56:18 +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
2a43dbd71a
Add downstreamConn.writeMessages
This logic will become more complicated in upcoming commits.
2020-02-17 12:41:27 +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