Commit Graph

1027 Commits

Author SHA1 Message Date
Brian Warner
34116c7b1f CLI: document and return correct errors
Also clean up test_scripts.PregeneratedCode:

* fetch results from both sides at the same time
* only check rc when using a subprocess, since the direct call doesn't
  use rc=0 anymore
* no need to cancel the other side's Deferred when one errors
* provide more information if stderr was non-empty
2016-04-25 17:52:59 -07:00
Brian Warner
e4a19748db CLI: don't catch+wrap WrongPasswordError
Also remove .explain, now that we no longer wrap it in TransferError
2016-04-25 17:52:59 -07:00
Brian Warner
b96b052c96 start on cleanups: error catching in CLI dispatch 2016-04-25 17:52:59 -07:00
Brian Warner
a4c1ba9e4e transcribe: stop automatically doing close() on error
And provide a close() that can live at the end of a Deferred chain, so
callers can do d.addBoth(w.close).

I like auto-close-on-error in general, but I'm removing it so I can
clean up the error-handling pathways. It will probably come back later.
The constraint is that it must be possible to wait on the return
Deferred that close() gives you (to synchronize tests, or keep the CLI
program running long enough to deallocate the channel) even if something
else (and error handler) called close() earlier. This will require
either a OneShotObserverList, or keeping a "deallocated" Deferred around
in case more callers want to wait on it later.
2016-04-25 17:50:52 -07:00
Brian Warner
8d0bcf9f82 transcribe._sleep: make it usable from deallocate()
If we're closing because of an error, we need to sleep through the old
error, to be able to wait for the "deallocated" message. This might want
to be different: maybe clear the error first, or store the errors in a
list and sleep until a second error happens.
2016-04-25 17:34:57 -07:00
Brian Warner
4eaf88d7d2 cmd: remove _twisted suffix from function names
No longer necessary now that all commands are twisted-based.
2016-04-24 22:49:18 -07:00
Brian Warner
b0da2a9ac7 cmd_send: fold helper routines back into main function
These were split out to make the blocking- and twisted- based
implementations share some code, but now that we're down to just
Twisted, it's clearer to merge them back in.
2016-04-24 22:46:21 -07:00
Brian Warner
35639dafed cmd_send: rearrange functions, no code changes 2016-04-24 22:40:25 -07:00
Brian Warner
754cabbdd8 Fail better when input-code is interrupted
Hitting Control-C (which sends SIGINT) while we're waiting in the
readline-based input_code() function didn't shut down the process
properly: the reactor would wait for the readline thread to exit, which
wouldn't happen until it finished getting a code, which requires the
user to hit Return. I haven't found a good way to force the thread to
exit, or to synthetically inject a newline into stdin. So my compromise
is to tell the user that they need to hit Return to finish interrupting
the command.

See the _warn_readline() function for a list of other potential
approaches.
2016-04-24 22:20:27 -07:00
Brian Warner
e8d3689a3a runner: display TransferErrors better
These are known failures (like file-not-found, transfer rejected, etc).
Display the error message, but not a traceback.
2016-04-24 12:10:51 -07:00
Brian Warner
86edf96412 switch to tqdm for nicer CLI progress bars 2016-04-24 12:04:05 -07:00
Brian Warner
16c6c0977e progress: make it easier to change display width 2016-04-23 22:43:42 -07:00
Brian Warner
1e7c714453 CLI: don't hide errors so much 2016-04-20 22:36:43 -07:00
Brian Warner
1b16127cad fix --tor
* twisted/transcribe: call correct tor_manager method
* tor_manager: remove now-unused web agent endpoint factory
2016-04-20 22:34:58 -07:00
Brian Warner
b2c3f49038 unsplit txwormhole step 2: edit files 2016-04-20 19:18:41 -07:00
Brian Warner
0ae8463331 unsplit txwormhole step 1: move files 2016-04-20 19:15:33 -07:00
Brian Warner
7c45f3d472 unsplit wormhole_server step 2: edit files 2016-04-20 19:15:33 -07:00
Brian Warner
ec13404fca unsplit wormhole_server step 1: move files 2016-04-20 19:15:33 -07:00
Brian Warner
85b6264826 unsplit cli step 2: edit files 2016-04-20 19:15:33 -07:00
Brian Warner
a3c836bcd3 unsplit cli step 1: move files 2016-04-20 18:54:36 -07:00
Brian Warner
7a5a99a1a8 unsplit tests step 3: modify files 2016-04-20 18:54:10 -07:00
Brian Warner
fc33ea41ff unsplit tests step 2: delete test_load 2016-04-20 18:51:03 -07:00
Brian Warner
c890a850aa unsplit tests step 1: move files 2016-04-20 18:44:33 -07:00
Brian Warner
5f25e92a2d cmd_send.py: add note about future speedup opportunity 2016-04-20 18:14:58 -07:00
Brian Warner
34f4c284b0 txwormhole: use websockets, not HTTP
This should speed up the protocol, since we don't have to wait for
acks (HTTP responses) unless we really want to. It also makes it easier
to have multiple messages in flight at once. The protocol is still
compatible with the old HTTP version (which is still used by the
blocking flavor), but requires an updated Rendezvous server that speaks
websockets.

set_code() no longer touches the network: it just stores the code and
channelid for later. We hold off doing 'claim' and 'watch' until we need
messages, triggered by get_verifier() or get_data() or send_data().

We check for error before sleeping, not just after waking. This makes it
possible to detect a WrongPasswordError in get_data() even if the other
side hasn't done a corresponding send_data(), as long as the other side
finished PAKE (and thus sent a CONFIRM message). The unit test was doing
just this, and was hanging.
2016-04-20 18:14:47 -07:00
Brian Warner
a57845eb0b tor_manager: accept websocket URLs too 2016-04-20 12:15:59 -07:00
Brian Warner
611a7d05e9 cmd_receive: use wait=True for the last ack
This prevents the process from shutting down before the ack makes it to
the server.
2016-04-20 12:13:53 -07:00
Brian Warner
9c1af2667e send_data(): add wait=True
This doesn't do anything yet (the HTTP-based Channel always waits), but
will matter in an upcoming implementation change.
2016-04-20 12:13:53 -07:00
Brian Warner
8068aeeca4 CLI runner: use task.react, remove sync wrapper 2016-04-20 12:13:53 -07:00
Brian Warner
44ca031047 transcribe.py: accept reactor=, for tests 2016-04-20 12:13:53 -07:00
Brian Warner
28b3f685d6 rendezvous: allow both allocate and claim (of the same channelid)
This allows the Wormhole setup path to be simpler: consistently doing a
claim() just before watch(), regardless of whether we allocated the
channelid (with get_code), or dictated it (with set_code or
from_serialized).
2016-04-20 11:20:53 -07:00
Brian Warner
558f01818f server: log websocket URL 2016-04-20 11:14:52 -07:00
Brian Warner
88b78d1c46 fix comment: bodies are hex, not base64 2016-04-20 11:13:40 -07:00
Brian Warner
92c4ad19bc rendezvous_websocket: fix Error 2016-04-20 11:12:50 -07:00
Brian Warner
aa8f714a48 websocket: change 'all-channelids' to 'channelids'
Yeah, names are easier to work with when they're also valid identifiers.
2016-04-18 23:49:11 -07:00
Brian Warner
aec0615d66 Add WebSocket-based rendezvous protocol frontend
The websocket lives on a Resource of the main rendezvous web site, and
the websocket URL is derived from the main "relay_url", so there's no
extra port to allocate, and no extra service to shut down.
2016-04-18 18:03:26 -07:00
Brian Warner
efc23bd078 Rendezvous: change internal API
Deliver not-yet-JSONed objects to listeners (both in broadcast_message
and as the "catch-up" responses to add_listener). Also make the (web)
frontend responsible for adding "sent" timestamps. This all makes
rendezvous.py less web-centric.
2016-04-18 17:40:12 -07:00
Brian Warner
c3bd9e936e split rendezvous server into web, nonweb files
Also rename files/classes from "relay" to "rendezvous".
2016-04-18 17:40:08 -07:00
Brian Warner
3b215c106a use "hkdf" from PyPI instead of wormhole.hkdf 2016-04-18 16:49:29 -07:00
Brian Warner
95706c752c move tests step 1: rename files 2016-04-18 16:45:03 -07:00
Brian Warner
17613ce8c1 move hkdf out of util/, remove now-empty directory 2016-04-18 16:45:03 -07:00
Brian Warner
36e63e2347 split wormhole_cli step 2: fix imports, setup.py 2016-04-18 16:43:18 -07:00
Brian Warner
2e7bb1a8f1 split wormhole_cli step 1: move files 2016-04-18 16:43:18 -07:00
Brian Warner
1688da74d9 split txwormhole step 2: fix imports 2016-04-18 16:41:56 -07:00
Brian Warner
323175ddfe split txwormhole step 1: move files 2016-04-18 16:41:52 -07:00
Brian Warner
0b162af09e move ipaddrs.py from wormhole.util to wormhole.twisted 2016-04-18 16:24:13 -07:00
Brian Warner
87266f1292 split wormhole_server step 3: fix tests 2016-04-18 16:18:51 -07:00
Brian Warner
190ce2c027 split wormhole_server step 2: new files, fix imports
remove server commands from old src/wormhole/scripts/runner.py
2016-04-18 16:18:47 -07:00
Brian Warner
bde4696a8b split wormhole_server step 1: move files 2016-04-18 16:18:45 -07:00
Brian Warner
1a455c05f5 remove wormhole.twisted.util port-allocation functions 2016-04-18 16:16:27 -07:00
Brian Warner
e20026488a remove unused observer.py 2016-04-18 16:16:27 -07:00
Brian Warner
a8446d2bc5 merge transit_common into twisted.transit 2016-04-18 16:16:27 -07:00
Brian Warner
db137c26e5 remove blocking.transit 2016-04-18 15:52:29 -07:00
Brian Warner
4e937c2100 rename cmd_send_twisted to cmd_send, same for cmd_receive 2016-04-18 15:52:29 -07:00
Brian Warner
a1033b06a3 merge send_common into cmd_send_twisted 2016-04-18 15:52:29 -07:00
Brian Warner
9b53bb96c6 merge cmd_receive_blocking into cmd_receive_twisted 2016-04-18 15:52:29 -07:00
Brian Warner
8c67a98259 merge test_transit.py into test_server.py 2016-04-18 15:52:29 -07:00
Brian Warner
68b22bec97 remove --twisted, stop using blocking-flavor scripts 2016-04-18 15:52:18 -07:00
Brian Warner
94a3be91b2 add tab-completion to twisted-style input_code() 2016-04-15 17:27:32 -07:00
Brian Warner
589226f076 tor: add comments, let it pick its own control port 2016-03-28 02:26:11 -07:00
Brian Warner
618706681a record time spent importing code 2016-03-28 02:25:40 -07:00
Brian Warner
9630ab9aae find-tor: record more detailed timings 2016-03-28 02:25:32 -07:00
Brian Warner
12c4c51fd8 record tor-launch time in DebugTiming 2016-03-28 02:25:01 -07:00
Brian Warner
01ed9902de add --tor support 2016-03-28 02:25:01 -07:00
Brian Warner
ed6e5ff169 get a TorManager working 2016-03-28 02:25:01 -07:00
Brian Warner
049fac01db tolerate trailing slash on "wormhole send dirname/"
Previously, the trailing slash would cause the receiving side to get an
empty-named directory.
2016-03-24 08:46:29 -07:00
Brian Warner
c5415495c0 dump-timing: store server-sent time too
Adjust dump-timing to ignore the extra data, for now. Also do some
general instrumentation cleanup.
2016-03-03 18:03:27 -08:00
Brian Warner
aaf4e70a33 remove obsolete TODO 2016-03-03 17:56:15 -08:00
Brian Warner
626732b730 relay_server: include 'sent' timestamp with each message
This will be used by client-side timeline instrumentation, to guide
performance improvements.
2016-03-03 17:52:59 -08:00
Brian Warner
e342236b7d relay_server: internal rearrangement
Construct the response in the render_* method, rather than
add_messages(), to prepare for adding server timestamps. Use
json_response() everywhere.
2016-03-03 16:57:44 -08:00
Brian Warner
9d7b9dd8d2 add --no-listen, for debugging 2016-03-03 14:52:14 -08:00
Brian Warner
418fe9419e twisted: use persistent connections, slight speedup
This uses a single TCP connection to the relay server for all
requests (although it probably uses a second one for the downstream
EventSource feed). This should squeeze out some of the round-trip times.
2016-03-03 13:39:09 -08:00
Brian Warner
4f5e037d39 cmd-twisted: report exceptions better
The previous scheme would swallow the real traceback, making debugging
difficult.
2016-03-03 12:33:26 -08:00
Brian Warner
08a5e6043a twisted.transit: tolerate the lack of a listener
In Tor mode, there is no local listener. Eventually we'll add an Onion
Service listener, but it's not guaranteed that we can run one.
2016-03-03 12:32:26 -08:00
Brian Warner
8d92b40139 twisted.transcribe: use same Agent for ReconnectingEventSource
This will be especially important when we add Tor support.
2016-03-03 12:29:57 -08:00
Brian Warner
be2c66a5f5 transit: ignore errors on sockets we were about to close anyways 2016-03-02 14:28:04 -08:00
Brian Warner
26f512fba4 add --twisted to use the twisted CLI flavor 2016-03-02 01:07:37 -08:00
Brian Warner
6d3d0c1cb3 unify synchronous calling of twisted CLI commands 2016-03-02 00:51:21 -08:00
Brian Warner
4d405c8cef cmd_send_twisted: fix display message ordering
By creating the ProgressingFileSender too early, it printed a progress
message before the "Sending" line.
2016-03-02 00:50:22 -08:00
Brian Warner
df2384bea2 twisted.transit: move FileConsumer into RecordPipe
This adds an expected= argument to Connection.connectConsumer(), which
then returns a Deferred that fires when enough bytes have been written
to the consumer. It also adds Connection.writeToFile(), a helper method
that writes bytes to a filehandle.
2016-03-02 00:48:43 -08:00
Brian Warner
7234e25897 twisted.transit: handle multiple records in one chunk
I made the classic dataReceived() mistake, and exited the function after
delivering the first record. Keep at it until there are no complete
records left.
2016-03-02 00:48:43 -08:00
Brian Warner
8d82726c51 add DebugTiming object, --dump-timing= option
This writes timeline data to a .json file, which can be examined later
to find likely candidates for optimization.
2016-03-01 18:23:06 -08:00
Brian Warner
84def8a54b add some inlineCallbacks for simplicity
This control flow was getting too hairy.
2016-03-01 18:22:03 -08:00
Brian Warner
fd143caded tests.ServerBase: print message when threadpool is not idle
The previous commits improve test failures by dropping relay connections
at shutdown, and flunking a test quickly when one client fails but the
other one hangs.

If that doesn't work (say, some client has a time.sleep(), or other
stall that isn't affected by the relay shutdown), we'll be left with an
active thread holding that hanging client.

This patch adds a check to wormhole.test.common.ServerBase.tearDown that
looks for active threads, waits a second (after stopService), then
checks the threadpool again. If the threadpool is empty, everything is
fine. If not, it prints a message (to stdout) to inform the impatient
user why the test is probably hanging.
2016-03-01 17:07:48 -08:00
Brian Warner
b1dae14e6d test_scripts: handle hangs in one client
When test_scripts ran two clients at the same time, an error in one
could leave the other hanging (in a thread). One Deferred would errback,
the other would hang. Tests wait on one Deferred at a time, so if we're
unlucky and were waiting on the hanging Deferred (instead of the
erroring one), we'll wait forever, or at least until the default test
timeout of 180 seconds.

This adds an errback to notice when either client has errored, and
cancels the other Deferred, so it doesn't matter which one we wait upon
first.
2016-03-01 17:07:43 -08:00
Brian Warner
3fc3a563bf relay_server: disconnect clients upon shutdown 2016-03-01 17:07:37 -08:00
Brian Warner
0771aae7c7 server: Relay wasn't pruning channels
I forgot to hook it up to the service parent, so the timer was never
started.
2016-02-29 08:59:53 -08:00
Brian Warner
c225d57f8c cmd_receive_twisted.py: twisted-based implementation 2016-02-29 07:31:34 -08:00
Brian Warner
01064325a2 cmd_receive: refactor (slight message changes)
This prepares the way for a twisted-based implementation.
2016-02-29 07:30:40 -08:00
Brian Warner
6654efb429 move describe() from Transit to RecordPipe 2016-02-28 01:42:46 -08:00
Brian Warner
1903c58248 ipaddrs: return 127.0.0.1 if everything else fails
This helps the windows tests where ipaddrs currently fails entirely.
2016-02-27 17:37:12 -08:00
Brian Warner
ca06e95bbd test_blocking: avoid using real hints 2016-02-27 17:29:04 -08:00
Brian Warner
8067acbf82 cmd_receive: close the file before renaming
I'm always forgetting this one. It's more obvious on windows.
2016-02-27 17:20:43 -08:00
Brian Warner
ed1eb06ae8 blocking/transit: use descriptive error message 2016-02-27 14:48:12 -08:00
Brian Warner
1ff0792b32 test_scripts: prep for windows compatibility
newlines, os.mkfifo errors, JSON type differences
2016-02-27 14:46:38 -08:00
Brian Warner
14dcfeed73 tolerate lack of readline at runtime
'readline' is part of the python stdlib, so declaring a dependency on it
doesn't help. It doesn't exist on windows, and the pypi 'readline'
module doesn't work on windows. So instead, just attempt to import
readline, and if that fails, fall back to a non-completion flavor.
2016-02-27 14:16:58 -08:00
Brian Warner
b7319f90c8 windows "route.exe" is not absolute, and that's ok 2016-02-27 14:15:36 -08:00
Brian Warner
dbba482c62 cmd_receive_blocking.py: refactor 2016-02-17 21:35:53 -08:00
Brian Warner
e6fba34570 start on twisted receive: move old files into new homes 2016-02-17 19:25:19 -08:00
Brian Warner
7f056ca075 send-twisted: set transit key before sending phase1
This ensures that we'll be ready for them. Previously there was a race
between us revealing the direct hints to the peer, and us setting the
transit key (thus allowing us to check inbound handshake requests). The
Transit instance didn't handle the race, causing errors to be thrown
when the other side connected quickly.
2016-02-17 19:02:36 -08:00
Brian Warner
aa27bfd32c add twisted form of sender
Currently this is only invokable from tests.
2016-02-17 19:02:36 -08:00
Brian Warner
7ceffd783a add more assertions around transit_key 2016-02-17 19:02:35 -08:00
Brian Warner
3ffceff9d5 send-blocking: set transit key before sending phase1
This ensures that we'll be ready for them. Previously there was a race
between us revealing the direct hints to the peer, and us setting the
transit key (thus allowing us to check inbound handshake requests). The
Transit instance handles this race (with an interlock on the transit
key), but it's still nicer to do it cleanly.

This exposed a new race in Transit, where the inbound connection would
complete before transit.connect() had been called. The previous commit
adds an interlock to wait for that too. Until this change, the transit
key lock was covering that one up.
2016-02-17 19:02:35 -08:00
Brian Warner
142f3fc154 send-blocking: don't create Transit unless we need it 2016-02-17 19:02:35 -08:00
Brian Warner
dba42aff01 blocking transit: tolerate inbound connections before connect() starts 2016-02-17 19:02:35 -08:00
Brian Warner
369854b4cc test build_phase1_data 2016-02-17 18:07:35 -08:00
Brian Warner
79decea9ea rearrange scripts: make room for twisted 2016-02-17 16:26:03 -08:00
Brian Warner
d36d1cb063 runner.py: new approach to dispatching 2016-02-17 16:03:30 -08:00
Brian Warner
3b447df0f4 move argparser out to a separate module 2016-02-17 15:55:11 -08:00
Brian Warner
5d572137f4 improve test error message 2016-02-17 14:00:03 -08:00
Brian Warner
fd7d1b97d4 test scripts in a thread, not a subprocess, mostly 2016-02-17 14:00:01 -08:00
Brian Warner
903129f4a2 add --hide-progress, mostly for tests 2016-02-17 13:58:41 -08:00
Brian Warner
c5b2800a3e runner: strictly use cwd/stdout/stderr from 'args'
This will make it easier to test the scripts in a controlled fashion.
2016-02-17 13:53:20 -08:00
Brian Warner
e2f3bebe38 allow --relay-helper="" to disable relay
test_scripts now uses this to avoid accidentally using a relay
2016-02-17 13:53:18 -08:00
Brian Warner
d14d35f3cd cmd_send_blocking: close the transit when we're done 2016-02-17 13:52:26 -08:00
Brian Warner
5e928ac9f0 rewrite ProgressPrinter as a class, add tests 2016-02-17 12:46:12 -08:00
Brian Warner
00833a4bde test_scripts: factor out common test code 2016-02-17 10:22:31 -08:00
Brian Warner
99ff75259a catch 'send' of non-file/non-directory 2016-02-17 09:36:31 -08:00
Brian Warner
8079340bff more rearranging 2016-02-15 21:59:18 -08:00
Brian Warner
512c7c0a59 cmd_send: rearrange in preparation for twisted version 2016-02-15 21:40:57 -08:00
Brian Warner
a235b507c8 twisted.transit: implement producer/consumer flow control 2016-02-15 21:23:20 -08:00
Brian Warner
763d72f582 twisted.transit: implement Deferred-based receive_record() 2016-02-15 11:40:21 -08:00
Brian Warner
fb1461fa8c add twisted.transit, with tests 2016-02-14 17:57:09 -08:00
Brian Warner
7212e9e9f4 transit: split common code out to a new file
This will be shared between blocking.transit and the soon-to-land
twisted.transit .
2016-02-14 17:51:46 -08:00
Brian Warner
36cc0e2bca tests: don't use network
Some tests failed to override --transit-helper, which meant they
intermittently talked to the real transit server (briefly, before
deciding the local+direct connection was better).
2016-02-12 17:11:06 -08:00
Brian Warner
7ded461342 show-usage: give more room for "rendezvous-lonely" 2016-01-14 14:30:08 -08:00
Brian Warner
bd912a73ee Transit: blur the file sizes too 2016-01-12 16:32:38 -08:00
Brian Warner
35c9e29eb3 transit handshake: wait for newline, not just expected string 2016-01-12 15:04:52 -08:00
Brian Warner
9ed39be346 don't log HTTP requests when blur-usage is on 2015-12-04 17:35:56 -08:00
Brian Warner
1ab66d2fd0 privacy: only store coarse timestamps in the usage table 2015-12-03 21:15:19 -08:00
Brian Warner
ee86059b0a transit_server: clean up logging slightly 2015-12-03 20:44:34 -08:00
Brian Warner
6c88396f14 CLI: make 'wormhole server usage' show transit too 2015-12-03 20:15:29 -08:00
Brian Warner
909cdfa3dc track transit usage in DB 2015-12-03 19:45:34 -08:00
Brian Warner
a3656c162b schema change: prep usage table for including transit too 2015-12-03 19:44:47 -08:00
Brian Warner
fb493da8c7 transit_server.py: underscore-ify private attributes 2015-12-03 19:25:40 -08:00
Brian Warner
6369c17595 test_transit: use better error in Accumulator
apparently this was broken before, but never got triggered
2015-12-03 19:25:40 -08:00
Brian Warner
568903ac48 add test for Transit (blocking only) 2015-12-03 16:24:52 -06:00
Brian Warner
229c702ccc transit: fix py3 2015-12-03 16:23:12 -06:00
Brian Warner
95d0e68cf2 transit: avoid near-infinite loop upon connector error
Now we will never try any hint more than once. Previously we'd hit the
relay hint over and over until the timeout fired.
2015-12-03 16:22:03 -06:00
Brian Warner
11f806a316 transit_relay: add Producer/Consumer flow control
This limits the buffering to about 10MB (per connection*direction).
Previously, if the sender had more bandwidth than the receiver, the
transit relay would buffer the entire file. With this change, the sender
will be throttled to match the receiver's downstream speed.
2015-12-03 15:07:47 -06:00
Brian Warner
c103441648 test_transit: fix py3.3, no %s in bytestrings 2015-12-02 03:02:50 -06:00
Brian Warner
8240d9e910 add test of transit server, make it work under py3
Also have transit send logs to log.msg, not stdout.
2015-12-02 01:47:52 -06:00
Brian Warner
80603aaa32 finish py3/async support, needs Twisted >= 15.5.0
The latest Twisted fixes the web.Agent code we need for proper async
support. There's still a daemonization bug that prevents 'wormhole
server start' from succeeding (it hangs).
2015-12-01 00:15:24 -06:00
Brian Warner
5b46df133f implement (and test) --output-file for receive-file 2015-11-29 01:40:25 -06:00
Brian Warner
3a343f9895 test send/receive directory 2015-11-29 01:33:15 -06:00
Brian Warner
6fefcde061 add send/receive of whole directories 2015-11-25 01:53:04 -06:00
Brian Warner
6958241f3f preliminary refactoring 2015-11-25 01:47:24 -06:00
Brian Warner
1428507909 refactor cmd_receive.py, split accept_file() to a separate function 2015-11-25 01:40:17 -06:00
Brian Warner
a96f29d01f wormhole server show-usage / tail-usage
Use a separate "tail-usage" command instead of "show-usage -f". Make
both work on py3 too.
2015-11-24 13:20:58 -08:00
Brian Warner
0c36fad720 add "wormhole server usage" to dump usage DB 2015-11-24 13:03:53 -08:00
Brian Warner
1d6c3d1f96 clients: use "watch" endpoint, not "get" 2015-11-23 16:50:54 -08:00
Brian Warner
2318c94169 test_server: error properly when EventSource fails 2015-11-23 16:49:46 -08:00
Brian Warner
c482c248ff server: add "watch" endpoint, deprecate non-ES "get"
I'm planning to leave non-EventSource "/get" in until after 0.6.0, then
remove it. I think it's cleaner for the logs to have the two
forms (EventSource and immediate) use different URLs.
2015-11-23 16:43:25 -08:00
Brian Warner
82cdadae80 check welcome message 'send' too 2015-11-23 16:33:09 -08:00
Brian Warner
badf5168ef test_server: rename some functions 2015-11-22 18:06:42 -08:00
Brian Warner
5e0a7e4c93 remove stale copy of server URLs 2015-11-22 17:44:25 -08:00
Brian Warner
00bb816d11 remove close-on-error from derive_key(), for now
In the twisted-style code, the close_on_error() decorator forces the
return value to be a Deferred, which is all wrong for internal uses of
derive_key() (verification string and confirmation message). It might be
useful to have a synchronous form of close_on_error(), but since the
actual close() is async, that's not very straightforward.

So for now, tolerate unclosed Wormhole objects when someone calls
derive_key() too early, or with a non-unicode type string.
2015-11-19 17:11:27 -08:00
Brian Warner
22a1ce2eda add close-with-mood-on-error to twisted style too 2015-11-19 17:08:21 -08:00
Brian Warner
9827a2e50c add twisted/blocking interop test 2015-11-19 16:21:10 -08:00
Brian Warner
fd9a62e8ff change confirmation message: must be different on each side
The previous same-message-for-both-sides approach failed, because the
Channel filters out duplicates.
2015-11-19 16:06:30 -08:00
Brian Warner
1ad001bbc3 WIP: test that we tolerate missing key-confirmation messages 2015-11-16 18:25:28 -08:00
Brian Warner
6b57d7d05d check key-confirmation messages, if present 2015-11-16 18:24:39 -08:00
Brian Warner
3220014605 send key-confirmation message upon receipt of PAKE
This will allow the first peer to detect a wrong password even though
the second peer bails before sending something encrypted.
2015-11-16 17:02:02 -08:00
Brian Warner
4ad7342459 make self.channel internal (twisted) 2015-11-16 16:54:00 -08:00
Brian Warner
ae2a6c6a05 add Channel.get_first_of()
This allows the Wormhole code to wait for multiple messages, which will
be useful for getting Confirmation messages soon.
2015-11-16 16:47:52 -08:00
Brian Warner
b709a45891 get_data/set_data: reserve _ for internal uses 2015-11-16 16:20:00 -08:00
Brian Warner
6956f35e9a receive: fetch channel list before completion, to get welcome message 2015-11-15 10:53:13 -08:00
Brian Warner
47d3eee6fe server: treat missing moods (from older clients) as "quiet" 2015-11-15 10:34:40 -08:00
Brian Warner
4f0dde9529 server: summarize transfers, store in DB 2015-11-15 10:34:29 -08:00
Brian Warner
26c7008c23 DB: use 'messages' to track allocations, not 'allocations'
This removes the 'allocations' table entirely, and cleans up the way we
prune old messages. This should make it easier to summarize each
connection (for usage stats) when it gets deallocated, as well as making
pruning more reliable.
2015-11-13 18:24:36 -08:00
Brian Warner
bb97729a23 server: more refactoring
flattening some attribute access paths
2015-11-13 18:20:47 -08:00
Brian Warner
0b9f858761 server: internal refactoring 2015-11-13 18:12:47 -08:00
Brian Warner
101c800237 deallocate: ignore all 'requests' exceptions 2015-11-12 10:11:30 -08:00
Brian Warner
2e393c145e make default mood "happy", change other mood names 2015-11-12 09:31:03 -08:00
Brian Warner
80beb20631 make blocking.Wormhole into a context manager 2015-11-11 21:59:16 -08:00
Brian Warner
a881d6055f auto-close Channel (with a "mood") upon server or crypto error 2015-11-11 21:54:45 -08:00
Brian Warner
0748647049 allow multiple close() calls, throw error when using a closed Wormhole 2015-11-11 18:17:52 -08:00
Brian Warner
3daef13ac0 indent commands: no functional changes 2015-11-11 18:11:53 -08:00
Brian Warner
cb5ad8ced1 Use exception for Timeout, not return value 2015-11-11 18:01:22 -08:00
Brian Warner
6de677c1df use timeouts for allocate and list_channels too 2015-11-11 18:00:06 -08:00
Brian Warner
fa3be3523d pass timeouts down 2015-11-11 17:56:08 -08:00
Brian Warner
07686f3de7 make self.channel internal 2015-11-11 17:52:13 -08:00
Brian Warner
9ead3f48a8 fix 'wormhole server restart'
It got broken when I added --no-daemon to 'server start'.
2015-11-11 17:30:31 -08:00
Brian Warner
ec51adb713 add 'wormhole send --text -' to read message from stdin 2015-11-11 17:27:26 -08:00
Brian Warner
b83062701d server: give old 0.4.0 senders a "you must upgrade" error
Without this, old senders will throw a messy 404 traceback when talking
to a modern server.

Unfortunately 0.4.0 receivers don't make API calls in the right order,
so they throw a 404 before seeing our "you need to upgrade" message.
2015-11-11 17:06:33 -08:00
Brian Warner
595a0e5845 server API: include "mood" when closing the channel
This will be used as a simple unverifiable counter of success/failure.
2015-10-08 18:35:26 -07:00
Brian Warner
0a6ab83bc5 test distinctness of encryption nonces 2015-10-07 16:31:45 -07:00
Brian Warner
385762b36d demo.py: make it easier to modify for local testing 2015-10-07 16:31:45 -07:00
Brian Warner
df3aee2a86 fix EventSource (server and parsers)
I was really confused about the Server-Sent Events syntax. This new one
is compatible with actual web browsers and the spec:

 http://www.w3.org/TR/eventsource/
2015-10-07 16:31:45 -07:00
Brian Warner
e77b39313a use TypeError for type errors, not UsageError 2015-10-06 20:52:47 -07:00
Brian Warner
ce236ae70c test_blocking: stop aliasing Wormhole 2015-10-06 20:44:32 -07:00
Brian Warner
bf43dae2ad add multiple phases, change key-derivation strings
Because of the key-derivation change, clients will not be compatible
across this commit.
2015-10-06 20:39:20 -07:00
Brian Warner
d0a7da3a63 twisted/demo.py: fix receive, code must be unicode 2015-10-06 20:33:17 -07:00
Brian Warner
6e8a1d8adb codes.py: fix input-with-completion on py3
The input() function returns str(bytes) on py2, and str(unicode) on py3.
We want unicode in both cases.
2015-10-06 20:04:56 -07:00
Brian Warner
35768d6738 wormhole/invitation code is now unicode 2015-10-06 19:42:10 -07:00
Brian Warner
7f6410812c transit URL, transit hints are now unicode 2015-10-06 19:29:59 -07:00
Brian Warner
574d5f2314 scope channelids to the appid, change API and DB schema
This requires a DB delete/recreate when upgrading. It changes the server
protocol, and app IDs, so clients cannot interoperate with each other
across this change, nor with the server. Flag day for everyone!

Now apps do not share channel IDs, so a lot of usage of app1 will not
cause the wormhole codes for app2 to get longer.
2015-10-06 19:21:53 -07:00
Brian Warner
8692bd2cd7 eventsource.py: use py3-style print 2015-10-06 19:21:53 -07:00
Brian Warner
9e1a00cbd9 appid and derive_key(purpose) are now unicode 2015-10-06 19:21:53 -07:00
Brian Warner
9ba7de6e1e relay-url is now unicode 2015-10-06 19:19:39 -07:00
Brian Warner
13dd359f90 internal rename: appid -> _appid 2015-10-06 19:12:41 -07:00
Brian Warner
e6d1b1fb83 internal rename: relay -> relay_url 2015-10-06 19:12:41 -07:00
Brian Warner
e0cc32af9d add ChannelMonitor to track unclosed channels with weakrefs, not __del__ 2015-10-06 19:12:41 -07:00
Brian Warner
fc30fa6cd4 rename channel-id to channelid. changes DB schema. 2015-10-06 19:12:41 -07:00
Brian Warner
fc641622ba demo.py: update to match merged file/text commands 2015-10-06 19:12:09 -07:00
Brian Warner
2da94d5069 move channel-pruning responsibility down into Relay 2015-10-04 15:49:06 -07:00
Brian Warner
b2336591a7 relay.py: rename to relay_server.py 2015-10-04 12:46:09 -07:00
Brian Warner
0fa0abfbb1 server: split into separate files 2015-10-04 12:40:12 -07:00
Brian Warner
00caa9f6d9 oops, update tests to match 2015-10-03 23:27:28 -07:00
Brian Warner
56f8327c71 improve "wormhole send" args for text-vs-file
There are now three ways to invoke send:

* "wormhole send": ask for a text message
* "wormhole send FILENAME": send a file
* "wormhole send --text TEXT": send text message
2015-10-03 23:25:11 -07:00
Brian Warner
e7e5c2d079 merge send/receive "file" and "text" into a single command 2015-10-03 22:45:43 -07:00
Brian Warner
f24e05d4cb new Wormhole API: separate send_data()/get_data() calls 2015-10-03 22:03:27 -07:00
Brian Warner
7a28400586 split transcribe.py into two layers: comms and crypto 2015-10-03 17:51:35 -07:00
Brian Warner
617bb03ad5 rewrite server API
This removes "side" and "msgnum" from the URLs, and puts them in a JSON
request body instead. The server now maintains a simple set of messages
for each channel-id, and isn't responsible for removing duplicates.

The client now fetches all messages, and just ignores everything it sent
itself. This removes the "reflection attack".

Deallocate now returns JSON, for consistency. DB and API use "phase" and
"body" instead of msgnum/message.

This changes the DB schema, so delete the DB before upgrading the server.
2015-10-03 17:38:31 -07:00
Brian Warner
bc3b0f03b9 blocking/transit.py: hush a transient failure
Not entirely sure what's going on here, but this is probably safe.
2015-10-03 16:53:08 -07:00
Brian Warner
ccea1a7d3c py3: don't emit noisy b"" prefix for --verify 2015-09-28 16:59:15 -07:00
Brian Warner
429c5cd962 tests: clean up pairs-of-Deferreds patterns 2015-09-28 16:52:12 -07:00
Brian Warner
8d3ed79ce6 add verifier tests 2015-09-28 16:49:36 -07:00
Brian Warner
5ae1c2d020 tests: switch to defer.gatherResults 2015-09-28 16:44:00 -07:00
Brian Warner
336eea5e78 tests: handle argparse on py3.3
which sends --version to stderr, not stdout. This might make the py3.3
tests pass.
2015-09-28 16:31:35 -07:00
Brian Warner
b088747ae3 rename to ServerEndpointService, for consistency with Twisted 2015-09-28 16:23:00 -07:00
Brian Warner
540fceb795 add py3.4 compatibility
The "bytes % bytes" syntax only appeared on py3.5, so don't use it.

Updated travis to expect py3.4 works.

The twisted side is probably even more broken for py3.4 than it is for
py3.5.
2015-09-28 16:15:55 -07:00
Brian Warner
1522658c9b skip test_twisted on py3 until more of Twisted has been ported 2015-09-28 00:45:33 -07:00
Brian Warner
2d7f701849 eventsource_twisted: return unicode, not bytes
This roughly parallels the way that blocking/eventsource.py and the pypi
"requests" modules work: the server can set the encoding (with
"Content-Type: text/event-stream; charset=utf-8"), and the EventSource
parser will decode accordingly. However eventsource_twisted.py *always*
returns unicode (on both py2/py3), even when the server hasn't set an
encoding. blocking/eventsource.py returns bytes (on py3, and str on py2)
when the server doesn't set an encoding.

In the future, eventsource_twisted.py should return bytes when the
server doesn't set an encoding.

eventsource_twisted.py includes an alternate approach that might be
necessary (a to_unicode() function instead of always using .decode), but
I won't be sure until enough of Twisted has been ported to allow the
EventSourceParser to be tested.

Also fix demo.py for python3.
2015-09-28 00:44:32 -07:00
Brian Warner
b5d470fcda make blocking/send-file work on py3
* declare transit records and handshake keys are bytes, not str
* declare transit connection hints to be str
* use six.moves.socketserver, six.moves.input for Verifier query
* argparse "--version" writes to stderr on py2, stdout on py3
* avoid xrange(), use subprocess.Popen(universal_newlines=True)
2015-09-28 00:24:36 -07:00
Brian Warner
8fe41e135d make blocking/send-text work on py3, add dependency on 'six'
* use modern/portable "next(iter)" instead of "iter.next()"
* use six.moves.input() instead of raw_input()
* tell requests' Response.iter_lines that we want str, not bytes
2015-09-28 00:24:36 -07:00
Brian Warner
a7213d9c9a enforce bytes-vs-str in the API
The main wormhole code is str (unicode in py3, bytes in py2). Most
everything else must be passed as bytes in both py2/py3.

Keep the internal "side" string as a str, to make it easier to merge
with other URL pieces.
2015-09-28 00:24:36 -07:00
Brian Warner
6614783c43 make relay work under py3
Current twisted.web wants bytes in most places (this will probably
change when twisted.web is properly ported to py3).
2015-09-28 00:24:00 -07:00
Brian Warner
15cc0a1429 test_server: make sure the server is reachable
used to exercise py3 issues with the server
2015-09-28 00:24:00 -07:00
Brian Warner
5d93dccb88 appid and derive_key(purpose=) must be bytes, not unicode 2015-09-28 00:24:00 -07:00
Brian Warner
e8626fcea2 relay: deliver EventSource as utf-8
This allows the client (requests.py) to produce unicode fields and
lines, instead of binary, which is necessary for py3 compatibility.
2015-09-27 14:35:10 -07:00
Brian Warner
2b37c62150 server: add -n/--no-daemon, to run on py3
The twisted.python.logfile in Twisted-15.4.0 is not yet compatible with
py3, but can be bypassed by not daemonizing the server (so it doesn't
write to a logfile). This has been fixed in twisted trunk, so when
15.4.1 or 15.5.0 comes out, this will no longer be needed. But I think
we'll leave it in place, since sometimes it's handy to run a server
without daemonization.
2015-09-27 14:24:03 -07:00
Brian Warner
e9d87828c2 scripts/runner: make py3-compatible 2015-09-27 13:54:20 -07:00
Brian Warner
2e2bd1bb5f tests: split blocking out to its own file
also clean up the output when pip-e -vs- entrypoint -vs- Versioneer
makes the entrypoint script refuse to run from a version mismatch.
2015-09-27 10:43:25 -07:00
Brian Warner
adf55175fb test_scripts: wormhole should live next to python
not necessarily beneath the current working directory
2015-09-26 18:29:46 -07:00
Brian Warner
d3ef3aa29a more verbose, to figure out travis failure 2015-09-26 18:21:56 -07:00
Brian Warner
5ee37cab64 test_scripts: make found-wrong-wormhole error more verbose 2015-09-26 18:17:50 -07:00
Brian Warner
be124e686a relay: avoid using Twisted strports
strports aren't ported to py3 yet, so we stick with Endpoints and
Services, which have been.
2015-09-26 18:15:35 -07:00
Brian Warner
b069e69d35 test scripts too (with spawnToThread) 2015-09-26 18:02:02 -07:00
Brian Warner
1e6fc4601e tests: split common code out 2015-09-26 18:02:02 -07:00
Brian Warner
bdb8b395b5 database: make py3-compatible 2015-09-26 17:51:21 -07:00
Brian Warner
cbc40697f7 use "except x as y:" everywhere, for py3 2015-09-26 17:47:13 -07:00
Brian Warner
4c4b5d081b RelayServer: use in-memory DB for tests
This avoids problems where a leftover DB from one run causes "wrong
code" errors in the next.
2015-09-26 17:44:20 -07:00
Brian Warner
797074d03e runner.py: cosmetic changes 2015-09-23 18:13:35 -07:00
Brian Warner
532aa0811c update idSymmetric= to match SPAKE2-0.3 2015-09-22 01:07:46 -07:00
Brian Warner
88dab265de test blocking code, using twisted+deferToThread
Unfortunately Twisted still requires python2, so we can't use this to
test the intended python3-compatibility of the blocking code.
2015-09-21 23:21:40 -07:00
Brian Warner
46f1fd2cd0 factor error classes into a common file 2015-09-21 23:21:26 -07:00
Brian Warner
8f1ce1f835 update twisted/demo.py 2015-07-24 18:04:15 -07:00
Brian Warner
aec8b65724 rename twisted/eventsource.py in prep for directory merge 2015-07-24 17:55:23 -07:00
Brian Warner
efd6d27cc6 rename SymmetricWormhole to just "Wormhole"
Update docs too. Now both blocking/ and twisted/ use "Wormhole".
2015-07-24 17:47:46 -07:00
Brian Warner
d8ca850d1a blocking: finish alignment 2015-07-24 17:28:55 -07:00
Brian Warner
2ad65e13fe blocking: more alignment with twisted/transcribe.py 2015-07-24 17:22:02 -07:00
Brian Warner
2e44181e6d blocking: introduce _post_message()/_post_json() 2015-07-24 17:16:33 -07:00
Brian Warner
5951015f79 rearrange twisted+blocking to look roughly the same 2015-07-24 17:02:32 -07:00
Brian Warner
cebfa71563 minor reformatting, improve test error messages 2015-07-24 16:57:19 -07:00
Brian Warner
cdeaac0ad0 twisted: deallocate in more errorful situations 2015-07-24 16:56:41 -07:00
Brian Warner
62ebd07036 twisted/transcribe: refactoring 2015-07-24 16:46:39 -07:00
Brian Warner
77b80495c9 improve typechecking, nacl.utils.EncryptedMessage is not a bytestring
but it derives from one
2015-07-24 16:45:20 -07:00
Brian Warner
a46a405487 refactor: _get_message() (singular) does unhexlify too 2015-07-24 16:33:29 -07:00
Brian Warner
5e1690cad8 rearrange slightly 2015-07-24 16:26:01 -07:00
Brian Warner
e5fcc6a8c8 rename some methods to make them more private 2015-07-24 16:18:03 -07:00
Brian Warner
effbd27047 minor rearrangement 2015-07-24 16:00:13 -07:00
Brian Warner
cfe51f73c1 replace base asserts with UsageError 2015-07-24 15:55:42 -07:00
Brian Warner
056cf107fc replace blocking Initiator/Receiver with just symmetric Wormhole
first pass, seems to work
2015-07-17 17:23:07 -07:00
Brian Warner
bc54a0bbca move blocking/eventsource out to a separate file 2015-07-17 16:55:29 -07:00
Brian Warner
894da44244 relay: make it possible to omit the Transit server 2015-06-21 21:08:21 -07:00
Brian Warner
dc65b4354d twisted: split allocate_ports() out to util.py
so it can be used by downstream projects
2015-06-21 21:04:33 -07:00
Brian Warner
6ee09f5316 add demo of twisted flow, update docs
python -m wormhole.twisted.demo send-text TEXT -> CODE
python -m wormhole.twisted.demo receive-text CODE -> TEXT
2015-06-20 19:18:29 -07:00
Brian Warner
25472423c6 make twisted work, get serialization into shape, add proper tests 2015-06-20 19:18:21 -07:00
Brian Warner
0f58f3906d rough out twisted.SymmetricWormhole 2015-06-20 18:55:08 -07:00
Brian Warner
85dd3ba948 make twisted/ a real package 2015-06-20 18:55:07 -07:00
Brian Warner
951da1a59b eventsource: add Agent, deliver eventtype correctly
import eventual.py from the right place
2015-06-20 18:54:37 -07:00
Brian Warner
5241c07b8c copy eventsource.py from petmail c98d5a0 2015-06-20 18:34:26 -07:00
Brian Warner
b6b6c6aea4 upgrade to versioneer-0.15, fixes 'setup.py develop' 2015-05-31 16:39:39 -07:00
Brian Warner
d7415b7053 minor expiration cleanups 2015-05-04 18:28:54 -07:00
Brian Warner
183303e11e rework expiration, prune after 3 days, check every 2 hours 2015-05-04 18:28:04 -07:00
Brian Warner
dc3f2eee43 server: build ChannelList from db, not self.channels 2015-05-04 18:25:52 -07:00
Brian Warner
1aab908091 allocate_channel_id: use DB to get list of previous allocations 2015-05-04 18:24:23 -07:00
Brian Warner
a03fb3900e relay: track allocations through DB 2015-05-04 18:24:23 -07:00
Brian Warner
043392ee2a relay: add database, not used yet 2015-05-04 18:24:23 -07:00
Brian Warner
c3b048a4d3 relay: remove/disable unused code, hush pyflakes 2015-04-20 18:34:45 -07:00
Brian Warner
c393e09e8a server: add --advertise-version option 2015-04-20 18:34:13 -07:00
Brian Warner
790ae9a0dc change channel-allocation web API (incompatibly)
This will make it easier to manage channel allocation later, when we
switch to a database.
2015-04-10 22:03:08 -05:00
Brian Warner
819a37476b add "-0" mode: no codes, no auth, fixed channel
Like roulette but with forward security.
2015-04-09 23:06:57 -05:00
Brian Warner
5f35fcee61 send --verify: tell user to include --verify on receiver too
In the long run, this needs to be included in the second PAKE message,
and the MitM consequences thought through.
2015-04-09 22:56:39 -05:00
Brian Warner
5e593509b4 allow pre-generated (human-offline-created) codes
Just make up a code like NUMBER-STUFF, and add --code= to the
send-text/send-file command. Also don't use tab-completion on the
codewords part of the receiving side, unless you stuck to the even/odd
PGP wordlist. (tab still works for the channel-id).
2015-04-09 22:50:07 -05:00
Brian Warner
3aa7e22708 relay: don't require allocate(): first message creates the Channel
this enables pre-generated (human-offline-created) codes, as long as
they use a channel id high enough to avoid colliding with any allocated
ones.
2015-04-09 22:46:18 -05:00
Brian Warner
c8d2fc8750 relay: improve the way we allocate channels
Now the server allocates a channel randomly from set of available ids
with the shortest possible length. So concurrency=1 will always yield a
channel-id between 1 and 9 (inclusive). If we have 9 simultaneous
sessions, we'll start allocating channels from 10 to 99. 100
simultaneous connections kicks us into the 100-999 bucket, etc.
2015-04-09 22:45:04 -05:00
Brian Warner
ecc04ff675 display message-of-the-day, if the server offers one 2015-04-09 12:45:12 -07:00
Brian Warner
5ff59c92e0 display current-version-is-different even when erroring out 2015-04-09 12:35:07 -07:00
Brian Warner
e881d169a6 error out if server gives a "sorry we're closed" error 2015-04-09 12:29:26 -07:00
Brian Warner
6da9f3ec3a warn (to stderr) if the client version differs from the server's
This is a proxy for the other client's version, and encourages both
sides to upgrade to the current version each time the server is
upgraded (which will be once per release).
2015-04-09 11:46:23 -07:00
Brian Warner
782214813b server+client: fix SSE alternate-event-type handling
I think the server needs to put blank lines after *every* field, not
just the data: fields.
2015-04-09 11:37:50 -07:00
Brian Warner
9d7cd1d7de server: add "welcome message" to all responses, including server version 2015-04-08 21:03:27 -07:00
Brian Warner
dc9bc0c575 Use "wormhole server start" to launch a relay server. 2015-04-08 18:39:33 -07:00
Brian Warner
cf592d0766 CLI: avoid importing anything until command is actually run
In prep for moving the server launch command into the main CLI path,
without imposing dependency on pynacl/etc.
2015-04-01 16:01:32 -07:00
Brian Warner
0217a13da6 change relay URL: use more distinctive path prefix
This might make it easier for an application's web site to include a
relay, without competing with some other resource named "relay".
2015-03-25 16:51:55 -07:00
Brian Warner
883cacf903 wormhole receive-file: add --overwrite 2015-03-25 16:31:35 -07:00
Brian Warner
717bfa3b0b move public relays to new hostnames and ports 2015-03-25 14:46:35 -07:00
Brian Warner
106991fe0d require caller to provide transit relay too 2015-03-25 13:07:17 -07:00
Brian Warner
fae14ebe6a Add --verify (display/check key-verifier). Not entirely usable yet.
To be useful, both sides must add -v. If the sender uses -v but the
receiver doesn't, the receiver won't show the verification string, so
the sender can't compare it to anything (and must either abort the
transfer or accept it blindly). Maybe the receiver should show the
verification string unconditionally. Maybe the sender should
indicate (in unprotected plaintext, along with the PAKE message) whether
the receiver should show it or not.
2015-03-24 00:28:02 -07:00
Brian Warner
ed1809d521 change API to support upcoming --verify flag 2015-03-24 00:03:10 -07:00
Brian Warner
af1e3c51ec add --code-length, to configure the size of the PAKE code (in bytes/words) 2015-03-23 23:53:28 -07:00
Brian Warner
8e456dea5e rewrite CLI tools to use argparse, remove Twisted dependency
We used to use twisted.python.usage.Options, hence we depended upon
Twisted. Now we depend upon "argparse" instead, which is in the py2.7
stdlib (and on pypi for 2.6). This package will still (eventually)
provide Twisted support, but applications which need it will already
express a dependency on twisted themselves, so by removing the
dependency here, we make life easier for applications that don't use it.
2015-03-22 16:52:35 -07:00
Brian Warner
9e7d807171 rename const.py to public_relay.py, to make it clear what it offers 2015-03-22 11:55:13 -07:00
Brian Warner
7c5cb058a2 require caller to provide relay, no more default
Applications should feel free to pass wormhole.const.RENDEZVOUS_RELAY
here, but I figure it should be clear that you're using a public service
that's hosted *somewhere* external.
2015-03-22 11:53:48 -07:00
Brian Warner
fd3e4f3508 change relay URL scheme, allow arbitrary relay-phase messages 2015-03-22 11:45:16 -07:00
Brian Warner
55577d9721 send-file: tolerate zero-byte files 2015-03-20 17:53:19 -07:00
Brian Warner
cc37d2dc2f add CLI args to override the relay hosts (rendezvous and transit) 2015-03-20 17:45:03 -07:00
Brian Warner
84aa7ff248 receive-file: add --output-file to override local output filename 2015-03-16 00:18:53 -07:00
Brian Warner
5fd85fd884 cmd_receive_text: remove unused 'time' import 2015-03-16 00:17:11 -07:00
Brian Warner
cef9abcdd7 receive-text/file: accept CODE in argv 2015-03-15 23:26:06 -07:00
Brian Warner
12414fd8be code-completer: re-fetch channelids upon TAB, if necessary
This fixes the situation where you start the receiver first, then start
the sender, then you hit TAB on the receiver.

This somewhat improves the situation where you start the receiver first,
hit TAB (getting nothing), then start the sender, then hit TAB on the
receiver again. The second TAB will list the channel-ids, but won't
insert the only one as it's supposed to. You must type something (which
you can erase) and then hit TAB again to get a unique channel-id
inserted. But at least you can tell which one to type.

The first TAB runs the completer with readline.get_completion_type()
equal to 9=TAB=try-to-insert. The second (and subsequent) TABs use
63=?=list-matches, and it won't go back to 9 until you type something.
2015-03-13 01:50:21 -07:00
Brian Warner
3456d36039 cosmetic changes to frontend commands 2015-03-12 23:32:58 -07:00
Brian Warner
315d7c5614 make rendezvous happen in real-time: replace polling with EventSource 2015-03-12 23:07:47 -07:00
Brian Warner
a8b6cad827 transcribe: refactor in anticipation of EventSource client 2015-03-12 23:03:57 -07:00
Brian Warner
8741d5adaa relay: refactor in anticipation of a realtime EventSource-based protocol 2015-03-12 19:44:31 -07:00
Brian Warner
cda5634b1d relay.py: minor refactoring in anticipation of multi-pass rendezvous 2015-03-12 19:22:34 -07:00
Brian Warner
fcf3b080f9 transit: don't complain about the relay connection failing or being dropped 2015-03-12 18:38:42 -07:00
Brian Warner
fcd2678dfd transit: provide encrypted record-pipe, use it for file-xfer 2015-03-12 18:14:42 -07:00
Brian Warner
8b3e5836ee relay: log total bytes sent in each direction 2015-03-12 16:25:34 -07:00
Brian Warner
8dfe4e7b8d TRANSIT_RELAY: update to new hint format 2015-03-12 16:03:14 -07:00
Brian Warner
cedd04a2fb transit.py: add debug prints, disabled 2015-03-12 16:03:00 -07:00
Brian Warner
35630661a5 increase establish_connection() timeout to let relay work
If all the direct hints resulted in timeouts (e.g. they were to bad IP
addresses where connections just hang), the relay connection would fail.
The establish_connection() function had the same TIMEOUT as the
direct-hint connector, so it would give up just before the relay
connection was initiated.
2015-03-12 15:52:11 -07:00
Brian Warner
b5ff8a5d4a format inbound-hint better 2015-03-12 15:24:34 -07:00
Brian Warner
b27cbd19b6 change hint format to "tcp:HOST:PORT" 2015-03-12 15:20:06 -07:00
Brian Warner
d71c8492c1 transit: describe the connection 2015-03-12 14:50:40 -07:00
Brian Warner
c9e0246266 relay: reset channel-id to 1 when all channels are idle 2015-03-02 22:04:58 -08:00
Brian Warner
9a11f355ea relay: expire any rendezvous channel after one hour 2015-03-02 21:22:56 -08:00
Brian Warner
20fd7c40ae add progress updates to send/receive file 2015-03-02 12:45:55 -08:00
Brian Warner
7a99c04d64 add "wormhole" entrypoint script. requires twisted.
I'm using Twisted for the subcommand argument parsing. It might be nice
to use something smaller.
2015-03-02 00:32:21 -08:00
Brian Warner
5682ddff8e fix transit relay
stop using web setup for now
2015-03-02 00:09:17 -08:00
Brian Warner
dc8d6e979f more transit-relay work 2015-03-01 11:33:16 -08:00
Brian Warner
cd54eff994 start on transit relay client 2015-02-20 01:40:09 -08:00
Brian Warner
3cc4461049 reduce transit timeout to 15s 2015-02-20 01:39:31 -08:00
Brian Warner
f5741f9a52 offer a wrong-password error message 2015-02-20 00:32:48 -08:00
Brian Warner
3171a4bb56 transit: don't use hard-coded listening ports 2015-02-20 00:00:27 -08:00
Brian Warner
e4390859d1 transit: switch to proper handshakes, with keyid 2015-02-19 23:56:56 -08:00
Brian Warner
6f64b6d326 transit: finish refactoring, combine mostly into a single class 2015-02-19 23:55:05 -08:00
Brian Warner
af5f2053b8 transit: start to factor into common superclass 2015-02-19 19:16:51 -08:00
Brian Warner
99e08c2e37 transit: use bidirectional connections 2015-02-19 19:09:08 -08:00
Brian Warner
01dbec820b transit: set key on both ends, instead of generate+send 2015-02-19 18:24:10 -08:00
Brian Warner
66ad6fb272 rearrange transit.py in preparation for refactoring 2015-02-19 18:19:17 -08:00
Brian Warner
12845f191b add derive_key(), use it for file-xfer bulk-encryption key 2015-02-19 17:16:43 -08:00
Brian Warner
50e466b581 don't complain about unconnectable sockets, improve error messages 2015-02-19 16:51:59 -08:00
Brian Warner
3ccd7bd61e file-xfer: add ack, print encouraging messages, remove noise 2015-02-19 16:30:24 -08:00
Brian Warner
0ba01b2ce7 hush exception noise 2015-02-19 15:55:59 -08:00
Brian Warner
9f998221da transit: fix race, file-xfer basically works, but noisy
The failed connections are throwing exceptions that should be caught and
ignored.
2015-02-19 15:30:16 -08:00
Brian Warner
ae68dad441 make transit mostly work, but the race condition kills it 2015-02-18 17:23:09 -08:00
Brian Warner
f459d59b48 transit: fix handshake
Also make all threads daemonic, so they won't keep the process alive.
Also crank up the timeouts for manual testing.
2015-02-18 16:20:35 -08:00
Brian Warner
18ff9f9fd6 transit: plausibly correct 2015-02-18 13:02:17 -08:00
Brian Warner
71e3e73c99 stumbling towards transit implementation 2015-02-17 13:59:08 -08:00
Brian Warner
9dd4c6039f better sketch of transit-client API 2015-02-15 14:42:59 -08:00
Brian Warner
38b9c07566 sketch out transit-client API 2015-02-15 09:53:59 -08:00
Brian Warner
d6ef752152 update code to match rearranged source tree 2015-02-15 09:32:19 -08:00
Brian Warner
e3964cd797 rearrange source tree 2015-02-15 09:29:28 -08:00
Brian Warner
f82730bfab add function to find local IP addresses
This is a stripped-down copy of the synchronous/blocking portion of
Tahoe-LAFS's src/allmydata/utils/iputil.py .
2015-02-15 09:26:59 -08:00
Brian Warner
db724a7b91 simplify ask-user-for-code (with completion) API 2015-02-15 09:16:17 -08:00
Brian Warner
bc1b367f06 deallocate channel even if key-exchange fails (wrong password) 2015-02-14 18:50:31 -08:00
Brian Warner
0474cc18d5 add list-channels API to relay, use it in receiver 2015-02-14 18:45:29 -08:00
Brian Warner
e2e2206159 use completing-input for wormhole code read, not sys.argv 2015-02-14 17:48:38 -08:00
Brian Warner
e10cd515fe import the PGP wordlist (2*256), use 16-bit codes 2015-02-13 23:37:05 -08:00
Brian Warner
d5d4a3f97a start on transit service 2015-02-11 18:13:54 -08:00
Brian Warner
ab8d9f7678 default to a relay hosted on my own domain, for now 2015-02-11 16:48:53 -08:00
Brian Warner
a67d6365f8 transcribe.py: properly encrypt the transferred data 2015-02-11 02:09:08 -08:00
Brian Warner
04ef43f872 transcribe: more refactoring, speed polling to 2Hz 2015-02-11 01:46:33 -08:00
Brian Warner
48476f0840 transcribe.py: factor out common polling code 2015-02-11 01:35:11 -08:00
Brian Warner
6f055c84b9 fix relay URLs 2015-02-11 01:18:18 -08:00
Brian Warner
13a02df636 implement relay, fix transcribe.py to use it properly 2015-02-11 01:05:11 -08:00
Brian Warner
8e522d5387 move scripts to bin/ 2015-02-11 01:04:37 -08:00
Brian Warner
c690e8101c transcribe.Initiator: mostly complete 2015-02-10 21:08:26 -08:00
Brian Warner
3ddfac3eeb copy eventual.py/observer.py from Foolscap 2015-02-10 18:34:34 -08:00
Brian Warner
f5a0b3e5c6 fill in initiator flow, define relay API 2015-02-10 18:34:13 -08:00
Brian Warner
246e080c7c sample clients: fill in more details 2015-02-10 17:04:28 -08:00
Brian Warner
84852f26f5 start on sample clients 2015-02-10 16:50:32 -08:00
Brian Warner
c14749fae0 add first unit test, 'setup.py test' support 2015-02-10 01:05:15 -08:00
Brian Warner
d782a8b63b initial setup.py, versioneer-ification 2015-02-10 00:48:19 -08:00