Commit Graph

278 Commits

Author SHA1 Message Date
Martin
7486b7a363
Add support for SASL2 and BIND2 (#187)
* Add basic support for SASL2 (XEP-0388) and Bind2 (XEP-0386).
2024-04-09 10:53:38 +02:00
Martin Dosch
da2377ecb0 Recv: Return error on stream error. 2024-04-07 11:25:16 +02:00
Martin Dosch
44095406a2 Update go modules. 2024-04-07 00:59:08 +02:00
Martin Dosch
d7aee6b636 Harmonize newlines. 2024-04-05 11:57:09 +02:00
Martin Dosch
0324b31f56 Update go modules. 2024-04-04 11:05:14 +02:00
Martin Dosch
ca4e49201e Do not try to read from the xml stream if it's going to be closed. 2024-04-02 16:32:30 +02:00
Martin Dosch
6e5d6e449e Remove checking for xml.Endelement in nextStart().
This seems to have negative side effects on parsing in next()
2024-04-02 15:48:34 +02:00
Martin Dosch
0ae62a33a2 Further reduce possible data races. 2024-04-02 13:39:45 +02:00
Martin Dosch
ce687243c1 NextEnd: Use Token() instead of RawToken()
I assumed RawToken would be better suited here, but there were errors
parsing messages that could be fixed by reverting to Token().
2024-03-31 15:50:04 +02:00
Martin Dosch
78d07e9eee XEP-0478: Further improve error message. 2024-03-28 18:17:45 +01:00
Martin Dosch
416bb6e7b7 XEP-0478: Be more verbose in error if max stanza size is exceeded. 2024-03-28 18:07:23 +01:00
Martin Dosch
aef1257ed1 Fix timeout when server doesn't reply with closing stream element. 2024-03-28 17:22:02 +01:00
Martin Dosch
da17a46e6f Also read stream limits after authentication
The [business rules](https://xmpp.org/extensions/xep-0478.html#rules)
mention the following:

> It is acceptable for the limits on a stream to change whenever new stream features are announced - such as before and after authentication of the connecting entity.

The first detection of the stream limits is not deleted as there is also
ANONYMOUS authentication.
2024-03-28 15:57:56 +01:00
Martin Dosch
eedd7259cb Generate new ID for session (fixes #67)
Co-authored-by: https://github.com/ikq
2024-03-28 15:53:09 +01:00
Martin Dosch
07196efcf3 Add support for XEP-0478: Stream Limits Advertisement. 2024-03-28 15:49:08 +01:00
Martin Dosch
bbd90cc04b Copy token in nextStart function.
See
bc81053dbc (commitcomment-140301890)
and bc81053dbc (commitcomment-140303962)
2024-03-27 21:12:42 +01:00
Martin Dosch
0c7ee22452 Revert "Don't copy token."
This reverts commit bc81053dbc.
2024-03-27 21:09:43 +01:00
Martin Dosch
862c21f845 Make XEP-0474 configurable (default off).
As it is still experimental we should not enable it per default.
2024-03-26 21:36:15 +01:00
Martin Dosch
bc81053dbc Don't copy token.
This should be unnecessary and is probably a
leftover of previous experiments to fix some races
when closing the connection.
2024-03-26 19:26:19 +01:00
Martin
94ab540b80
Merge pull request #186 from vcabbage/move-mutex
move nextMutex to Client to prevent blocking separate Clients
2024-03-26 19:18:05 +01:00
Kale Blankenship
f6a9836fdf move nextMutex to Client to prevent blocking separate Clients
Avoids a global mutex which could end up unexpectedly blocking a
separate client. For example, if there were a client with few messages
and a client with many messages, the client with few could hold the lock
waiting for a token blocking the client with many from receiving.
2024-03-26 11:02:05 -07:00
Martin Dosch
8ab32d885f Fix race condition for nextStart and nextEnd. 2024-03-16 19:04:09 +01:00
Martin Dosch
73f06c9f3d Catch stream error after bind request. 2024-03-10 13:44:33 +01:00
Martin Dosch
9c5e758356 Use RawToken() instead of Token() for finding nextEnd.
This should improve stability as RawToken() does not
verify that start and end elements match.
2024-03-10 11:30:39 +01:00
Martin Dosch
ea4874e8c9 SCRAM: Check for SASL failure after sending auth message. 2024-03-09 19:51:47 +01:00
Martin Dosch
dab6865bd2 Update go modules. 2024-03-06 21:01:03 +01:00
Martin Dosch
c051d69509 Improve closing the stream. 2024-03-03 12:10:45 +01:00
Martin Dosch
aed021cf3e Wait for the server closing the stream before closing the connection. 2024-03-02 14:17:47 +01:00
Martin Dosch
2c4708e724
[gofumpt]: Remove empty line. 2024-02-27 22:26:58 +01:00
Martin Dosch
746409f074
Update dependencies. 2024-02-26 23:04:17 +01:00
Martin Dosch
9684a8ff69 Close stream before closing connection. 2024-02-25 12:25:57 +01:00
Martin Dosch
b7ea9f4be1 Update dependencies. 2024-02-23 13:55:02 +01:00
Martin Dosch
e2bc7bf6d7 Remove unused type clientPubsub. 2024-02-22 18:59:22 +01:00
Martin Dosch
0bcc057225 Remove unused types. 2024-02-22 17:58:48 +01:00
Martin Dosch
49054ca9e9 Remove unused function saslDigestResponse. 2024-02-22 17:55:38 +01:00
Martin
b369b7df10
Merge pull request #183 from mdosch/update-docs
Update import path in examples.
2024-02-01 13:58:52 +08:00
Martin Dosch
cc481e54e7 Update import path in examples. 2024-02-01 13:58:04 +08:00
Martin
88855eac82
Merge pull request #182 from mdosch/gofumpt
[gofumpt] Improve formatting.
2024-02-01 13:56:27 +08:00
Martin Dosch
0cc0a72c15 [gofumpt] Improve formatting. 2024-02-01 13:54:58 +08:00
Martin
d6e9a15f29
Merge pull request #181 from mdosch/scram-improvement
Improve RFC5802 compatibility.
2024-02-01 13:52:47 +08:00
Martin Dosch
6ffd595a06 Improve RFC5802 compatibility.
According to RFC 5802 5.1 only the "m" attribute should
cause an authentication error.
2024-02-01 13:35:55 +08:00
Martin
62928b3483
Merge pull request #180 from mdosch/fix-134
Filter invalid UTF8 from message body.
2024-01-18 20:04:09 +01:00
Martin Dosch
d67787ca0f Filter invalid UTF8 from message body.
Closes #134
2024-01-18 19:46:18 +01:00
Martin Dosch
f8a24505f4 Update dependencies. 2024-01-14 00:15:36 +01:00
Martin
685570cbd8
Merge pull request #179 from mdosch/socks
Add support for SOCKS5 proxies.
2024-01-13 14:58:10 +01:00
Martin Dosch
7bfa331758 Add support for SOCKS5 proxies. 2024-01-13 14:05:35 +01:00
Martin
3f0cbac307
Merge pull request #178 from mdosch/server-end-point
Tls-server-end-point improvements.
2024-01-12 12:12:52 +01:00
Martin Dosch
7ccad52e63 (Indirectly) check that TLS was not renegotioated when using "tls-server-end-point". 2024-01-12 12:10:06 +01:00
Martin Dosch
705f68d1a5 Simplify tls-server-end-point channel binding code. 2024-01-12 11:56:32 +01:00
Martin Dosch
b49bdce100 Merge branch 'master' into server-end-point 2024-01-12 11:54:03 +01:00