Commit Graph

69 Commits

Author SHA1 Message Date
rcorniere
7850d07d37 Renamed Hooks 2020-03-10 16:31:27 +01:00
rcorniere
e59a86c380 Refactor tests 2020-03-06 17:52:52 +01:00
rcorniere
8798ff6fc1 - Changed IQ stanzas to pointer semantics
- Fixed commands from v 0.4.0 and tests
- Added primitive Result Sets support (XEP-0059)
2020-01-31 11:48:03 +01:00
remicorniere
947fcf0432 PubSub protocol support (#142)
* PubSub protocol support
Added support for :
- XEP-0050   (Command))
- XEP-0060   (PubSub)
- XEP-0004   (Forms)

Fixed the NewClient function by adding parsing of the domain from the JID if no domain is provided in transport config.
Updated xmpp_jukebox example

* Delete useless pubsub errors

* README.md update
Fixed import in echo example

* Typo

* Fixed raw send on client example

* Fixed jukebox example and added a README.md
2020-01-09 15:33:11 +01:00
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
e62b7fa0c7
Update client.go 2019-12-24 10:47:25 +00:00
remicorniere
daf37cf5a8
Update Disconnect method on client
Remove wrong stanza sends
2019-12-24 10:44:01 +00:00
CORNIERE Rémi
390336b894 Added Roster IQs
Added an overly primitive "disconnect" for the client to use in the chat client example
2019-12-23 09:04:18 +01:00
rcorniere
fd48f52f3d Using precisely sized buffers for tcp tests 2019-12-10 15:10:19 +01:00
CORNIERE Rémi
6d8e9d325a Try removing decoder from IQ tests and changing writing method 2019-12-09 16:32:33 +01:00
CORNIERE Rémi
e675e65a59 Added callback to process errors after connection.
Added tests and refactored a bit.
2019-12-09 16:32:33 +01:00
remicorniere
b74c0f0374
Merge pull request #136 from Crypho/eventmanager-status
Fix updating of EventManager.CurrentState
2019-12-09 15:30:53 +00:00
Wichert Akkerman
f41177775a Make keepalive interval configurable
This fixes #133
2019-12-09 14:06:31 +01:00
Wichert Akkerman
f8c992a385 Fix updating of EventManager.CurrentState
The EventManager methods did not use a pointer as receiver, which
caused updated of CurrentState to be lost.
2019-12-09 12:30:37 +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
Mickael Remond
6aa1e668ee
Fix issues after refactor
Relates to #126
2019-11-08 12:07:55 +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
33446ad0ba Create a new stream 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
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
36e153f981 Allow transports to define their own ping mechanism 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
06a76160c8 Use transport factory function 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
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
a3c62e515e Introduce Transport interface 2019-10-28 16:38:10 +01: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
005c8823d9 Fixes issue with unescaped character %
Fixes #113
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
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
Mickael Remond
3de99e0e0e Add initial support for stream management
For now it support enabling SM, replying to ack requests from server,
and trying resuming the session with existing Stream Management state.
2019-08-06 16:02:33 +02:00
Mickael Remond
c41d068c9f
Improve comments 2019-07-27 15:19:32 -07:00
Mickael Remond
7deaf59642
Quickfix for build error
See #94
2019-07-27 09:22:04 -07:00
genofire
fe6cea870d use highest DNS-SRV entry for client connection 2019-07-27 09:11:00 -07:00
Mickael Remond
5992cc2231 Fix XMPP logger consistency
- Rename socketProxy to StreamLogger
- Ensure client send traffic through the logger
2019-06-29 10:47:07 +02:00
Mickael Remond
428787d7ab
Refactor and move parsing and stanza to a separate package 2019-06-26 17:14:52 +02:00
Mickael Remond
445bb8efa3
Fix crash on send when disconnected
Fixes #74
2019-06-26 15:58:42 +02:00
Mickael Remond
1c792e61c6 Adding tests and always use brackets in IPV6 addresses
Code also ensures that brackets are properly added when encoding an IPV6 address.
2019-06-26 12:37:59 +02:00
genofire
fde524ef98 fix connection to ipv6 address + use fallback to jid domain 2019-06-26 12:37:59 +02:00
Mickael Remond
d6d371df4d Do not export Router.route as it is not supposed to be called directly 2019-06-24 12:24:45 +02:00
genofire
d9fdff0839 Add constants (enumlike) for stanza types and simplify packet creation (#62)
* Add constants (enumlike) for stanza types
* NewIQ, NewMessage and NewPresence are now initialized with the Attrs struct
* Update examples
* Do not export backoff code. For now, we do not need to expose backoff in the documentation
* Make presence priority an int8
2019-06-22 11:13:33 +02:00
Mickael Remond
4d015e5b29
With go modules, we should be able to remove import comments 2019-06-18 16:28:30 +02:00
Mickael Remond
45c7ca74b1 Make client use the new Router 2019-06-18 14:36:56 +02:00
Mickaël Rémond
4d4710463d
Add basic support for keep-alive (#48)
Fix #35 

This should also help with #8
2019-06-11 15:29:08 +02:00
Mickael Remond
411619c2ef
Make channel type more specific (Packet instead of interface{})
Thanks to Genofire for spotting this
2019-06-10 10:58:41 +02:00
Mickael Remond
909cf753c9 Fix missing default channel creation 2019-06-09 13:08:25 +02:00