Commit Graph

43 Commits

Author SHA1 Message Date
Dan Ballard d895b46a03 fix typo 2017-06-10 16:19:56 -07:00
Sarah Jamie Lewis 5d767174b1 Brand new API v0.2 2017-05-02 16:33:51 -07:00
Sarah Jamie Lewis 5a720a08d0 Merge pull request #17 from special/api-handlers
Rework the API around connection events
2017-01-15 15:49:09 -08:00
John Brooks 860ae9a024 Rework the API around connection events
This is a rework of some parts of the API to make connection management
for applications more sane and reliable.

- The RicochetService interface is split into the ServiceHandler and
  ConnectionHandler interfaces. ServiceHandler is implemented by the
  application to handle inbound connections to a listener.
  ConnectionHandler is implemented to handle events for a single
  OpenConnection. Handler instances should no longer be shared for
  different listeners or connections.

- Instead of automatically starting a processConnection goroutine, the
  application is now responsible for calling OpenConnection.Process in a
  goroutine to act on the connection. This function blocks until the
  connection is closed. This change allows a better application pattern
  for setting the handler of a connection and reacting to connection
  loss.

- It is no longer necessary to have started a listener in order to make
  outbound connections.

- The Ricochet type is removed, because it no longer served any purpose,
  and this avoids having any shared state between different listeners or
  connections.
2016-12-03 16:53:13 -08:00
Sarah Jamie Lewis 630efa186e Fixing up EchoBot for golint 2016-11-08 15:12:50 -08:00
Sarah Jamie Lewis 9d6592e1e4 Fixing up some comments 2016-11-08 15:05:05 -08:00
Sarah Jamie Lewis c37f9008b6 gofmt simplify 2016-11-08 14:55:17 -08:00
Sarah Jamie Lewis 985e7d3c5c Update README.md 2016-11-08 14:45:51 -08:00
Sarah Jamie Lewis 13b2f9111d Counting main package in tests 2016-11-08 14:42:58 -08:00
Sarah Jamie Lewis 779dabed9c Fixing spelling 2016-11-08 14:40:38 -08:00
Sarah Jamie Lewis 00b636bf9d Updating travis 2016-11-08 14:14:57 -08:00
Sarah Jamie Lewis cfc7dc243c Add script for coveralls 2016-11-08 14:11:21 -08:00
Sarah Jamie Lewis a7c8ec5b0e Update README.md 2016-11-08 13:54:45 -08:00
Sarah Jamie Lewis 8c4ef5617b Merge pull request #14 from laanwj/2016_11_request_stop_message_loop
Make it possible to request stop of message loop
2016-11-08 13:51:40 -08:00
Wladimir J. van der Laan 5e3e873a16 networkresolver: fix gofmt output 2016-11-03 17:35:10 +01:00
Wladimir J. van der Laan c16dce9f60 Make it possible to request stop of message loop
Add a `RequestStopMessageLoop()` method to `Ricochet` to be able to
stop handling new connections. Right now, ProcessMessages is an infinite
loop.
2016-11-03 17:30:38 +01:00
Sarah Jamie Lewis f2788c929f Updating Travis CI config
Also removing Makefile
2016-10-02 18:02:40 -07:00
Sarah Jamie Lewis 0de7b76cbc Replacing proxy dependency with golang.org/x/net/proxy 2016-10-02 17:49:12 -07:00
John Brooks 47ba383334 Improve packet-layer buffering and parsing logic
SendRicochetPacket now has error handling, correctly encodes channel
ids, accepts any io.Writer, and ensures that all data is written. All
callers should be changed at some point to handle errors also.

RecvRicochetPackets is refactored to return only one packet per call and
avoid reading more data than it will consume, which simplifies the logic
and fixes a number of problems with short reads or large packets. Also
fixed an error in bounds checking that caused a remote panic for invalid
packet sizes. It also now accepts any io.Reader.

Tests are updated and expanded, and now pass.

Changes to Ricochet.processConnection are whitespace-only, because of
the removal of the inner packets loop.
2016-10-02 17:49:12 -07:00
John Brooks cc50e0dfe9 Fix buffering in version negotiation
The service-side version negotiation had a buffer overread that would
cause remotely triggerable panic.

Refactor that code to resolve that issue, follow the spec more exactly,
and avoid reading more data from the socket than is used for version
negotiation, in case clients write optimistically.
2016-10-02 17:49:12 -07:00
John Brooks 1c317fc186 Add OnDisconnect event 2016-10-02 17:49:12 -07:00
John Brooks 733e00d6f9 Set OpenConnection.OtherHostname after successful auth proof 2016-10-02 17:49:12 -07:00
John Brooks f6d6991f46 Add methods to run protocol over external sockets & listeners
The ServeListener and ConnectOpen methods take an active Listener or
Conn respectively, instead of creating their own.
2016-10-02 17:49:12 -07:00
Sarah Jamie Lewis bfe5b74364 Refactor GoRicochet
* New Service Interface
* Server functionality
* 90% Code Coverage
* Regression Testing of Protocol Compliance
2016-07-02 18:52:28 -07:00
Sarah Jamie Lewis 93754f2916 Refactor to a move event-driven library - incomplete 2016-02-28 16:18:25 -08:00
Sarah Jamie Lewis 5b013a76c3 Update README.md 2016-02-27 19:42:23 -08:00
Sarah Jamie Lewis 7837ad12ab Adding coverage stats to travis output 2016-02-27 19:28:54 -08:00
Sarah Jamie Lewis ad69913be9 Formatting 2016-02-27 19:26:43 -08:00
Sarah Jamie Lewis a411fb8695 More consistent interfaces, better test coverage 2016-02-27 19:24:50 -08:00
Sarah Jamie Lewis 2353fc41e2 Refactor of APIs to make testing easier.
Also travis.ci integration
2016-02-27 16:20:40 -08:00
Sarah Jamie Lewis 91036c918d Fixing up some error handling 2016-01-05 20:42:49 -08:00
Sarah Jamie Lewis 04f99b298f Cleaning up error handling
Getting rid of lots of FATALs, now they can be handled by the calling
function.
2016-01-04 19:53:10 -08:00
Sarah Jamie Lewis 97f5982754 Adding ability to check contact is known 2016-01-03 15:33:10 -08:00
Sarah Jamie Lewis f684fd8694 Fleshing out error cases 2016-01-02 00:47:32 -08:00
Sarah Jamie Lewis 3469935bcb Adding examples 2016-01-01 18:08:28 -08:00
Sarah Jamie Lewis 64d08bdff0 Refactoring to more easily adapt to multiple channels
Also adding chat message support.
2016-01-01 17:44:14 -08:00
Sarah Jamie Lewis 2d93acf065 Add the ability to turn on/off debug logging 2015-10-15 23:27:16 -07:00
Sarah Jamie Lewis 4ff30ee723 Removing Panics 2015-10-15 23:16:37 -07:00
Sarah Jamie Lewis 42f64e94df Adding Hidden Service Resolution
New option to use either hidden service address or localhost
address for who to connect to.
2015-10-15 23:12:12 -07:00
Sarah Jamie Lewis 1d50af7c5f Update README.md 2015-10-12 16:06:39 -07:00
Sarah Jamie Lewis 38bb90b6b5 Adding capability to OpenChannel and SendMessage 2015-10-12 16:04:18 -07:00
Sarah Jamie Lewis f58b282005 Create LICENSE 2015-10-10 21:38:58 -07:00
Sarah Jamie Lewis dba6ae8097 Initial Commit
This commit provides connection, authentication and the
start of contact requests.
2015-10-10 21:33:07 -07:00