Commit graph

16 commits

Author SHA1 Message Date
remicorniere 94aceac802 Changed "Disconnect" to wait for the closing stream tag. (#141)
Updated example with a README.md and fixed some logs.
2019-12-26 14:47:02 +01:00
remicorniere 7d89353156 Fix SIGSEGV in xmpp_component (#126)
* SIGSEGV in xmpp_component example with Prosody #126
2019-11-22 15:07:40 +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
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 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 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 a189748b9c Fix test for ws connection 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 66e219844b Add a websocket transport 2019-10-28 16:38:10 +01:00