Commit graph

429 commits

Author SHA1 Message Date
Wichert Akkerman 8088e3fa7e Add Client.SendIQ method 2019-11-04 16:22:05 +01:00
Wichert Akkerman 070934743f Add tests for iq result routes 2019-11-04 16:22:05 +01:00
Wichert Akkerman 6a25856e85 We need to lock isResultRoutes
The map is updated from multiple goroutines, so it needs to be locked.
2019-11-04 16:22:05 +01:00
Wichert Akkerman 8e1dac6ffa Add IQ result routes to the Router
These are used to quickly match IQ result stanzas and invoke a handler
for them. IQ result routes take precendence of normal routes.
2019-11-04 16:22:05 +01:00
Wichert Akkerman 21f6a549db Always add an id to IQ queries 2019-11-04 16:22:05 +01:00
Mickael Remond 1d7db9ceee
Comments clean-up 2019-11-04 12:58:10 +01:00
Wichert Akkerman 0227596f90 Increase size of XML decoder internal buffers
Since a transport (and a streamlogger) does not implement io.ByteReader
xml.Decoder wraps it using `bufio.NewReader(transport)` so it can easily read
bytes one at a time. This has the unfortuante effect of resulting in a panic if
we try to parse a stanza that is larger than the default buffer size of 4096
bytes.

To fix this we wrap the transport using `bufio.NewReaderSize()` with a much
larger buffer size.
2019-11-04 09:58:04 +01:00
Mickael Remond ebb6e845bf
Update requirements to go1.13 as required by new websockets dependencies 2019-10-29 14:52:31 +01:00
Mickael Remond a16483397d
Update test platform to go1.13 2019-10-29 14:47:04 +01:00
Mickael Remond ef2c0b465e
Update examples 2019-10-29 14:39:58 +01:00
Wichert Akkerman 2f8ec7b36f Only try startTls if the connection is not secure 2019-10-28 16:38:10 +01:00
Wichert Akkerman 6da1962962 Correctly open new streams after StartTLS and auth 2019-10-28 16:38:10 +01:00
Wichert Akkerman 33446ad0ba Create a new stream after StartTLS 2019-10-28 16:38:10 +01:00
Wichert Akkerman 390f9b065e Replace readWriter and decoder after StartTLS 2019-10-28 16:38:10 +01:00
Wichert Akkerman 60e2cdd088 Close the transport if NewSession fails
The makes sure we always send the `</stream:stream>` or `<close/>` correctly.
2019-10-28 16:38:10 +01:00
Wichert Akkerman a6709a1f71 Do not try to create a stream logger before we have a net.Conn 2019-10-28 16:38:10 +01:00
Wichert Akkerman 38bdcaec36 Do not copy more bytes than were read 2019-10-28 16:38:10 +01:00
Wichert Akkerman ffadd331dd Add a go function to always read websockets
Websocket need to have a Reader running at all times in order to
allow Ping to work (because a Reader is the only thing that will
correctly handle control frames). To faciliate this a go function
is introduced that will always read from the websocket until it
is cancelled. Read data is passed to the transport via a channel.
2019-10-28 16:38:10 +01:00
Wichert Akkerman 92329b48e6 Transports need to handle open/close stanzas
XMPP and WebSocket transports require different open and close stanzas. To
handle this the responsibility handling those and creating the XML decoder is
moved to the Transport.
2019-10-28 16:38:10 +01:00
Wichert Akkerman 25fd476328 Negotiate xmpp websocket subprotocol 2019-10-28 16:38:10 +01:00
Wichert Akkerman 36e153f981 Allow transports to define their own ping mechanism 2019-10-28 16:38:10 +01:00
Wichert Akkerman d0f2b492ac Fix XMPP TLS config 2019-10-28 16:38:10 +01:00
Wichert Akkerman 87ff01ac68 Fix websocket connect timeout 2019-10-28 16:38:10 +01:00
Wichert Akkerman 01d78a1e5c Fix error result from Transport.Connect errors 2019-10-28 16:38:10 +01:00
Wichert Akkerman 8fb3e33a1f Only do ensurePort for XMPP transport
If we always do this the address gets mangled, breaking the transport
selection.
2019-10-28 16:38:10 +01:00
Wichert Akkerman a189748b9c Fix test for ws connection 2019-10-28 16:38:10 +01:00
Wichert Akkerman 06a76160c8 Use transport factory function 2019-10-28 16:38:10 +01:00
Wichert Akkerman 8db608ccc1 Add IsSecure() to Transport 2019-10-28 16:38:10 +01:00
Wichert Akkerman 7fa4b06705 Move address into transport config
This makes it possible to use a factory function to create a transport of the right type and not having to repeat the address when calling Transport.Connect()
2019-10-28 16:38:10 +01:00
Wichert Akkerman f8d0e99696 Move XMPP transport to separate file 2019-10-28 16:38:10 +01:00
Wichert Akkerman e97d290e2b Use Transport in Component 2019-10-28 16:38:10 +01:00
Wichert Akkerman 96fccbd399 Split out TransportConfiguration
This allows using the same transport configuration from both clients and components.
2019-10-28 16:38:10 +01:00
Wichert Akkerman 66e219844b Add a websocket transport 2019-10-28 16:38:10 +01:00
Wichert Akkerman a3c62e515e Introduce Transport interface 2019-10-28 16:38:10 +01:00
Mickael Remond 2781563ea7 Update go.sum file 2019-10-01 11:40:31 +02:00
Mickael Remond 4f68c5eee2 Add X-OAUTH2 authentication and example 2019-10-01 11:40:31 +02:00
Mickael Remond 9c8353d081 Introduce Credential structure to define auth type
For now we are planning to support Password and OAuthToken.
In the future, we would like to add certificate-based authentication.
2019-10-01 11:40:31 +02:00
Mickael Remond 3b66e31888 We do not need the Content to be innerxml. cdata is enough.
Fixes #110
2019-09-27 18:25:27 +02:00
Mickael Remond 005c8823d9 Fixes issue with unescaped character %
Fixes #113
2019-09-27 16:32:53 +02:00
Mickael Remond 2cdda48467 Update xerrors dependency for go 1.13 2019-09-27 16:32:53 +02:00
Mickael Remond 8794ea6ed8
Check if we have a connection open before trying to close it
Fixes #22
2019-09-06 10:28:49 +02:00
Martin/Geno 7e596fc33c quick fix for component see #47 2019-09-06 09:27:38 +02:00
Martin/Geno 6f9808fe16 fix(doc): typos 2019-09-05 10:54:28 +02:00
Wichert Akkerman 7b1f83f6b7 Expose Route.AddMatcher
This fixes #102
2019-09-03 14:38:34 +02:00
Martin/Geno 6005a964ba fix stream management for component + add test 2019-09-02 11:50:29 +02:00
Mickael Remond d3b45b42a5
Fix typo 2019-08-06 18:27:51 +02:00
Martin/Geno 6e65ba2a0b fix naming from fluxxmpp to fluuxmpp 2019-08-06 18:06:34 +02:00
Martin/Geno 76f59be5ed merge commandline tools 2019-08-06 18:06:34 +02:00
Mickael Remond 80d2e0fa1e Remove debug print-out 2019-08-06 16:02:33 +02:00
Mickael Remond 2e864ff7f6 Clean-up: remove test/debug code 2019-08-06 16:02:33 +02:00