Commit Graph

100 Commits

Author SHA1 Message Date
John Brooks 42a2cba547 cli: Handle inbound contact requests 2017-10-14 21:21:02 -06:00
John Brooks 5475eeddba core: Handle message acknowledgement and time deltas
Depending on further changes to go-ricochet, which are submitted
upstream and imported here as usual.
2017-09-25 13:24:43 -07:00
John Brooks 1ac9e4f065 cli: Use 'identity.json' by default 2017-09-25 12:30:04 -06:00
John Brooks d8a14fb4c5 Remove the concept of numeric contact IDs
In ricochet-qt, contacts were stored with a sequential numeric ID, and
that was used in various places to refer to the contact uniquely. The
habit carried over here in an attempt to keep configuration
compatibility.

These IDs are error prone (particularly over RPC) and unnecessary. This
removes the entire concept and uses addresses to index and refer
uniquely to contacts everywhere.
2017-09-24 17:00:44 -06:00
John Brooks 32230b77c1 core: Reuse protobuf structures for configuration
The existing configuration was partially compatible with Ricochet's,
but not enough to actually be useful. It also required a bunch of
boilerplate code to copy data between configuration data structures,
internal data structures, and RPC data structures.

Protobuf conveniently supports encoding messages to JSON, and we already
need to store most data (e.g. contacts) in protobuf structures. This
commit changes the configuration to be a protobuf JSON serialization of
the Config message, which can directly reuse RPC messages like Contact.

Additionally, the RWMutex-based configuration type was a deadlock
waiting to happen. There is now a read-only clone of the configuration
available atomically at any time. Writers need an exclusive lock on the
ConfigFile object, which commits its changes to disk and readers on
unlock.
2017-09-24 16:59:44 -06:00
John Brooks 914163c7de cli: Use host prefixes as unique identifiers
Using the contact ID (which is about to disappear, anyway) to refer to
contacts in commands makes for an awkward UX.

For a differently awkward UX, use the shortest (>3) unambiguous prefix
of the hostname instead. This is stable, always typable, kind of
memorable, and seems like a decent compromise for now.
2017-09-24 16:59:42 -06:00
John Brooks e0b7ab9ccb core: Fix generation of new onion keys
Bulb is rather picky about what it receives when generating new keys.
2017-09-24 16:56:29 -06:00
John Brooks b5301c2782 Implement inbound contact request protocol
This implements a handler for inbound contact request connections,
taking advantage of the synchronous Process API.

This is largely untested code at the moment.
2017-09-23 19:19:24 -06:00
John Brooks 11cdfeaad8 Implement outbound contact request protocol 2017-09-23 19:19:13 -06:00
John Brooks 0b19ae4b66 Implement conversation with the new protocol API
Conversation now acts as a ChatChannelHandler, so a Conversation is able
to directly recieve messages on the associated ChatChannel.
2017-09-23 19:18:24 -06:00
John Brooks 0c187e72a0 Port core to the new go-ricochet API
This includes connection management and enough to compile, but doesn't
reimplement most of the protocol messages and functionality yet. There
are problems noted throughout the code, also.
2017-09-23 19:17:43 -06:00
John Brooks 9ae0eac4f3 Update go-ricochet to new API (plus fixes)
go-ricochet upstream is in the midst of a massive API rewrite, moving
towards something that is more flexible and robust. It's a work in
progress, but already better than what we were on before.

This updates the vendored go-ricochet to a fork off of the latest
master, including a series of patches that were needed to fix or add
behavior needed by ricochet-go. All of these are submitted upstream, and
the goal is to point back there as soon as possible.

Current upstream is https://github.com/special/go-ricochet-protocol on
the api-rework-fixes branch.

The go-ricochet/vendor folder was manually deleted during the import,
because it vendors only dependencies that are also vendored by this
repository.
2017-09-23 19:13:53 -06:00
John Brooks 48aab2536a cli: Improve the feel of using commands in conversation mode 2017-09-23 16:37:45 -06:00
John Brooks 9bd509c3d8 vendor: Update chzyer/readline
Still using special/readline's refresh-race branch, but it was rebased
on the latest upstream master.
2017-09-23 16:37:40 -06:00
John Brooks 23e22f0260 core: Minor fixes for inbound contact requests 2017-08-11 18:04:28 -06:00
John Brooks 2e8b9f2828 cli: Only print 'new message' for inbound messages 2017-08-11 14:01:45 -06:00
John Brooks 03b6205850 core: Skip message 'SENDING' until go-ricochet supports ACKs 2017-08-11 13:59:22 -06:00
John Brooks dcda924d56 core: Implement inbound contact requests
This does not yet include persistence of inbound requests in the config,
and it's mostly untested, but it's more or less complete.
2017-08-10 11:26:09 -06:00
John Brooks 3d13263fac vendor: Switch go-ricochet back to upstream
The PR we needed has been merged upstream now.
2017-01-15 20:35:52 -07:00
John Brooks 48a869cb57 core: Actually define maximum nick/message lengths 2016-12-27 17:56:44 -07:00
John Brooks 7dbac1cdf7 core: Add functions to sanitize nicknames and messages 2016-12-27 17:42:16 -07:00
John Brooks 667b24433a Add minimal travis config 2016-12-03 16:58:30 -08:00
John Brooks 580d5f67d3 vendor: Add all vendor dependencies
These are all at latest upstream as of now, except:

 - github.com/s-rah/go-ricochet
   - Using github.com/special/go-ricochet on the api-handlers branch
 - github.com/chzyer/readline
   - Using github.com/special/readline on the refresh-race branch

Both of these are for PRs that are pending with upstream.
2016-12-03 16:58:29 -08:00
John Brooks df56cd1757 Update RPC generated code 2016-11-30 19:37:46 -08:00
John Brooks c38ad18888 Update to match my protocol API changes branch 2016-11-30 19:37:19 -08:00
John Brooks a56dbfa5b9 core: Improve OnionConnector backoff and retry behavior
OnionConnector will now reset the backoff timer and try again
immediately when network connection status changes. Connection attempts
now scale up to 15 minutes, instead of waiting only 10 seconds each
time.
2016-11-06 19:35:15 -07:00
John Brooks fe1107b117 core: Replace old contact connections properly
Always take a new connection over a connection that is >30 seconds
old, before considering the fallback resolution-by-hostname.
2016-11-05 22:58:55 -06:00
John Brooks 4fa48bfa8f cli: Add -tor-control and -connect flags 2016-11-05 22:19:13 -06:00
John Brooks 1be58828fe core: Remove hardcoded tor control address
The default address will be set from the environment, or fall back to
trying 127.0.0.1:9051. There is now an API to allow this to be
overriden as well.
2016-11-05 22:09:18 -06:00
John Brooks 9c0110dca2 core: Use consistent functions to validate and convert address formats 2016-11-05 21:27:13 -06:00
John Brooks 91dbe5a261 core: Remove outdated todo comments 2016-11-05 20:44:20 -06:00
John Brooks 12422351d2 core: Make config slightly more reliable in handling errors 2016-11-05 20:05:37 -06:00
John Brooks bbc58e5815 Delete backend and rename cli to ricochet-cli
ricochet-cli can act as a headless backend, so for now there is no point
to having a separate backend program. It may be reintroduced later for
multiprocess use by other frontends -- to be determined.
2016-11-05 16:59:22 -06:00
John Brooks 569a138e21 core: Config path is a file, not a directory 2016-11-05 16:48:54 -06:00
John Brooks f0c4c5afcd cli: Add flags to control backend listen/attach 2016-11-05 16:19:33 -06:00
John Brooks 3dc6c65468 cli: Use in-process backend by default and add -backend param
The in-process backend uses 'innernet', which is a net.Listener and
net.Conn implementation using in-process buffers instead of real
sockets.

Out-of-process backends can be used with the '-backend' parameter. An
additional flag is required to allow connections to non-localhost TCP
backends.
2016-11-04 23:25:05 -06:00
John Brooks 2ee0c07942 core: Move RpcServer into core 2016-11-03 22:37:00 -06:00
John Brooks 2a0e5b7976 core: Make onion listeners delete the service on close 2016-10-28 16:17:19 -06:00
John Brooks 1c0c3242eb core: Improve start/stop of contact connections 2016-10-28 16:17:19 -06:00
John Brooks 6f7e030811 core: Handle response to outbound contact requests 2016-10-28 16:17:18 -06:00
John Brooks b6fd295ac1 cli: Implement add-contact and delete-contact 2016-10-28 09:49:10 -06:00
John Brooks 0e350c85a4 cli: Fix another case of the prompt changing incorrectly 2016-10-28 09:47:46 -06:00
John Brooks 8baf1034f6 core: RPC and config for outbound contact requests 2016-10-27 14:18:00 -06:00
John Brooks 2fd3cd2ea0 rpc: Add 'go generate' commands and update ContactRequest
It's now possible to regenerate the protobuf files by calling 'go
generate' in rpc/. You will need protoc and protoc-gen-go in PATH.
This is only necessary after changing the protobuf definitions.
2016-10-27 13:50:34 -06:00
John Brooks ffe15e6f0c cli: Track and use conversation active state properly 2016-10-26 16:12:16 -06:00
John Brooks db6295d5c8 cli: Prettify contacts list 2016-10-26 15:26:21 -06:00
John Brooks 60cdd16311 cli: Count unread messages and handle message updates 2016-10-26 15:17:40 -06:00
John Brooks e7a9f991f9 cli: Fix conversation prompt update logic 2016-10-26 14:57:48 -06:00
John Brooks 3ed991898a cli: Smarter prompts, and always use correct stdout 2016-10-23 15:42:02 -07:00
John Brooks eb9814c14b cli: Improve use of readline slightly 2016-10-23 11:37:57 -07:00