Commit Graph

55 Commits

Author SHA1 Message Date
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 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 23e22f0260 core: Minor fixes for inbound contact requests 2017-08-11 18:04:28 -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 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 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 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 569a138e21 core: Config path is a file, not a directory 2016-11-05 16:48:54 -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 8baf1034f6 core: RPC and config for outbound contact requests 2016-10-27 14:18:00 -06:00
John Brooks d37d40def4 Change imports after moving repository 2016-10-16 22:26:35 -06:00
John Brooks 7c20d535c7 core: Fix build 2016-10-16 15:50:59 -06:00
John Brooks 70af42e39e core: Remove old placeholder files 2016-10-15 19:17:54 -06:00
John Brooks bb530cfc2f core: Track unread state of received messages 2016-10-15 19:00:16 -06:00
John Brooks 7fe2363801 core: More of the conversation implementation
Improved parts of the conversation implementation, moved the
conversation event monitor to Identity, added event monitor
population, and other minor changes.
2016-10-15 18:04:19 -06:00
John Brooks f9bc09c520 core: Adapt to protocol API changes 2016-10-09 17:31:26 -07:00
John Brooks ee0c19b28b core: Minimal message-sending functionality
This is broken in many ways.
2016-10-06 16:50:07 -07:00
John Brooks 623dccb26d core: Early proof-of-concept conversations API 2016-10-05 14:38:18 -07:00
John Brooks f56204116c core: Make outbound contact connections
Refactor the connection management on contacts to have a goroutine
responsible for tracking the state of a contact's connection, launching
and canceling outbound attempts when appropriate, etc.
2016-09-29 22:13:55 -07:00
John Brooks fc0c6b3c95 core: Add OnionConnector for outbound connections 2016-09-29 22:11:37 -07:00
John Brooks ec8d6f5430 core: Add Network WaitForProxyDialer method 2016-09-27 15:24:16 -06:00
John Brooks fe117d10c8 core: Choose a SOCKS port from tor's listeners 2016-09-20 16:37:59 -06:00
John Brooks 114720bd6d core: Handle connection close for contacts 2016-09-19 21:32:16 -06:00
John Brooks 289d0f4dc2 core: Send contact update events on status change 2016-09-19 19:53:21 -06:00
John Brooks a52de9078c core: Attach protocol connections to Contact 2016-09-15 18:32:58 -06:00
John Brooks 346971368b core: Refactor network reconnection to fix onion republication
A race would cause a call to AddOnionPorts that was blocked waiting for
a control connection to try to publish the service twice, because the
onion republication wasn't done until after the connection status
change.

This is fixed by refactoring the control connection setup to do all
setup before signalling the state change, including copying the list of
onions to publish. The code is slightly cleaner now as well.
2016-09-15 18:16:00 -06:00
John Brooks cf903a3b7d core: Add protocol from s-rah and accept inbound connections
Start using Sarah's protocol implementation (plus some patches to be
merged there), publish the local onion service, and handle inbound
connections.
2016-09-11 21:38:04 -06:00
John Brooks 65f36de79e core: Add forgotten utils/misc.go file 2016-09-11 21:38:03 -06:00
John Brooks 83d4d8841d core: Change the 'Ricochet' API again 2016-09-10 23:00:26 -06:00
John Brooks 20700414fc core: Implement contact list monitor and contact removal 2016-09-02 11:51:24 -05:00
John Brooks 2c4a1c8b37 core: Load contacts from config 2016-08-29 20:46:41 -06:00
John Brooks b74073fd09 core: Load identity from config
Also, slightly refactor Ricochet to be an interface to get the various
top-level components, and let the implementation define it (such as
backend's RicochetCore RPC type)
2016-08-29 19:50:10 -06:00
John Brooks ca3c672975 core: Basic thread-safe and writable config API
This is ugly API for now, but it's a simple and relatively safe
solution. It should be cleaned up later.

Data from the Config object can only be accessed by opening the "root"
for reading (OpenRead) or writing (OpenWrite). Multiple readers may be
open simultaneously, but only one writer, which guarantees atomic
behavior. There are ugly edge-cases for save errors and pointer-style
objects in the config tree, so use good behavior.
2016-08-28 21:36:42 -06:00
John Brooks be5a8f1f4e core: Add functions for publishing onion services 2016-08-28 19:59:49 -06:00
John Brooks bec3784f2f core: Track Tor's connectivity state and other details 2016-08-28 19:59:49 -06:00
John Brooks d5cb5feff1 core: Clean up network implementation 2016-08-02 23:39:13 -06:00