CORNIERE Rémi
5eff2d7623
Added callback to process errors after connection.
...
Added tests and refactored a bit.
2019-12-06 15:42:01 +01:00
rcorniere
6a3833b27d
Removed last bits of codecov
2019-12-02 10:19:39 +01:00
remicorniere
51db430cff
Merge pull request #130 from remicorniere/master
...
Removed codeship and codecov. We now use github actions and coveralls.
2019-11-29 16:15:08 +00:00
rcorniere
bfe2b7a30f
Removed codeship and codecov. We now use github actions and coveralls.
2019-11-29 17:13:18 +01:00
remicorniere
a95b53d9ad
Update with coveralls badge. Removed codecov badge
2019-11-29 16:37:23 +01:00
remicorniere
10078e2a1b
Merge pull request #124 from Crypho/github-ci
...
Setup GitHub actions to run tests
2019-11-29 15:18:01 +00:00
remicorniere
80ba790555
Added coverage
...
Should detect race conditions, use the same covermove as the current mode in test.sh, and update code coverage on the repo.
See : https://github.com/marketplace/actions/coveralls-github-action
2019-11-29 15:56:27 +01:00
remicorniere
c60edf4771
Added "-race" flag to tests run command
...
Kind of testing edits on someone else's PR too
2019-11-28 17:40:19 +01:00
Jerome Sautret
3b84cb796e
Add 0.3.0 changelog
2019-11-28 17:39:10 +01:00
remicorniere
1822089db6
Tests for Component and code style fixes ( #129 )
...
* Tests for Component and code style fixes
2019-11-28 17:15:15 +01:00
Wichert Akkerman
6f35ae4103
Fix triggers
2019-11-28 09:51:49 +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
Mickael Remond
6aa1e668ee
Fix issues after refactor
...
Relates to #126
2019-11-08 12:07:55 +01:00
Wichert Akkerman
1539e4f193
Setup GitHub actions to run tests
2019-11-05 14:20:12 +01:00
Mickael Remond
47976624c9
Preparing v0.2.0 Changelog before version release
2019-11-04 16:48:48 +01:00
Mickael Remond
4efde692a2
Add placeholder in README for routing packets and get IQ responses
2019-11-04 16:36:45 +01:00
Mickael Remond
08878ed4a2
Update go.sum file
2019-11-04 16:32:59 +01:00
Mickael Remond
ce05c3226c
Fix failing tests
2019-11-04 16:32:29 +01:00
Mickael Remond
3e94880916
Merge branch 'master' of https://github.com/FluuxIO/go-xmpp
2019-11-04 16:25:07 +01:00
Wichert Akkerman
eda5c23c54
Add SendIQ to StreamClient and Sender
...
This makes it possible to use SendIQ from PostConnect and route handlers.
2019-11-04 16:22:05 +01:00
Wichert Akkerman
a0e74051fd
Use a channel based API for SendIQ
...
This makes sending IQ more idiomatic Go, but more importantly it solves
a problem with contexts that were not being cancelled correctly with
the previous API.
As a side-effect of this change `Route.route` must now be invoked in a
go-routine to prevent deadlocks. This also allows for stanzas to be processed
in parallel, which can result in a nice performance win.
2019-11-04 16:22:05 +01:00
Wichert Akkerman
83bc8581fd
Cleanup the IQ result route API
...
Simplify the API in several ways:
- provide the context to the IQ result handler, making it possible to pass in
extra context and handle timeouts within the handler.
- pass the stanza in as an IQ type, removing the need to always type-cast it
in the handler
- remove Router.HandleIqResult and Router.HandleFuncIqResult. Since the router
is private to Client nobody would ever use these, and they do not really make
things simpler anyway.
2019-11-04 16:22:05 +01:00
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