Commit Graph

1012 Commits

Author SHA1 Message Date
Brian Warner
d727531e6d send: use normpath() on argument to remove trailing slashes
This ought to help with #251, where bash-on-windows makes it easy to add a
forward-slash, and os.path.normpath() knows how to remove them, but os.sep is
a backslash.
2017-11-01 17:46:09 -07:00
Jaye Doepke
b362adf7ca Relay and transit url conf from env vars
Added the click option to look for relay and transit urls in environment
variables. If you're running your own relay/transit servers (such as
inside a corporate firewall), this will make client's lives easier.
2017-10-04 14:38:00 -05:00
Brian Warner
0aeae9ce10 tor_manager: expose errors when --tor-control-port= is provided
If you pass --tor-control-port= and we can't use it, throw an error that will
kill the whole process, instead of falling back to the default SOCKS port.

If you omit --tor-control-port=, then if all default control port connections
fail, we'll fall back to the default SOCKS port.

Also, test each combination separately, and improve the status messages.
2017-09-14 16:46:26 -07:00
Brian Warner
ed420e0001 tor_manager: pass endpoints to txtorcon.connect(), not descriptors
This was breaking any uses of --tor-control-port=: the client would always
fall back to using the default SOCKS port.
2017-09-14 15:48:35 -07:00
Brian Warner
25afce41fb _rlcompleter: re-raise exception with plain 'raise', not 'raise e' 2017-09-12 16:39:05 -07:00
Brian Warner
b9d1d11b03 server.py: windows doesn't even have the 'resource' module
I thought it might exist, but be empty. But it doesn't even exist on windows,
so we must guard against an ImportError.
2017-07-31 15:56:55 -07:00
Brian Warner
d44c7d2c1a server: increase RLIMIT_NOFILE to let us use more sockets
Linux defaults to a soft limit of 1024, which limits us to 512 simultaneous
non-transit-using connections. The transit relay runs in the same process, so
long-running relayed transfers will compete for those sockets too.

This raises the soft limit to equal the hard limit (if possible), or as much
as we can manage, if the soft limit was less than 10k. If the
resource.setrlimit calls aren't available (e.g. windows), or some other error
happens, this will log a message and continue without changing the limits.

closes #238
2017-07-31 14:16:26 -07:00
Brian Warner
0c679e74ce server.py: move twisted.web.resource out of the way 2017-07-31 14:01:54 -07:00
Brian Warner
8b0a245e19 reject invalid codes with KeyFormatError
refs #212
2017-07-23 00:02:09 -05:00
Brian Warner
de0af837cc test_cli: fix unicode problems
should fix #223
2017-07-22 23:19:43 -05:00
Brian Warner
b3b6e1ba8a test_cli: one more test, with argument split off from the name
This is probably an easier way to pass in JSON with embedded spaces:

 wormhole-server start --websocket-protocol-option 'x=["foo": "bar"]'
2017-07-15 17:39:02 -07:00
Jean-Paul Calderone
ba0e8997c5 accept protocol options and set them on the ws factory 2017-07-15 17:30:59 -07:00
Jean-Paul Calderone
aa7013e6f5 Factor duplicate RelayServer construction out 2017-07-15 17:30:59 -07:00
Jean-Paul Calderone
55b4b333dc accept some options on the cli 2017-07-15 17:30:59 -07:00
Brian Warner
fb03620fe9 test_cli: hush Click unicode_literals warnings 2017-07-15 17:27:11 -07:00
Brian Warner
1ca51168c5 add test for 'wormhole help' 2017-07-15 17:27:11 -07:00
Brian Warner
b34165d4fb 'wormhole help' should print the same thing as 'wormhole --help'
refs #61
2017-07-15 17:27:06 -07:00
Jean-Paul Calderone
efb77443bf Avoid corrupting state if creating a new db fails 2017-07-15 17:05:35 -07:00
Brian Warner
13b4a1793f server: OPEN/CLOSE on crowded mailbox should provoke "crowded" error
The Mailbox object throws CrowdedError, but WebSocketRendezvous wasn't
handling it specifically. The server responded by dropping the connection and
logging an "Unhandled Error", so the client would reconnect and then get the
same error again and again.

This changes WebSocketRendezvous to handle CrowdedError by sending a
"crowded" error response. The client should react to this by giving up on the
connection entirely, and not reconnecting.
2017-07-01 01:17:48 -07:00
Brian Warner
af4df47fe7 rendezvous: fix misleading log message
We only log the internal (sqlite) ID of the nameplate, not the actual
small-integer name. While investigating misbehavior due to overload, I was
confused into thinking that users were getting nameplates in the 15000+
range, when in fact those were merely the internal database row ids.
2017-06-30 12:46:02 -07:00
Johan Lindskogen
97b601276f Make default option of prompt uppercase
Makes it clear what happens when user just presses `Enter`

See: https://stackoverflow.com/questions/7803728/standard-format-for-yes-no-questions-in-the-terminal
2017-06-28 21:36:45 +02:00
Brian Warner
38097847c4 server: manage common args in the same way as client-side CLI
This now shares the _compose() decorator with wormhole.cli.cli, and removes
the arguments_to_config() function in favor of just copying all kwargs into
the Config object.
2017-06-26 23:05:16 +01:00
Jean-Paul Calderone
ec2e305b84 define start-like options just once 2017-06-26 21:38:18 +01:00
Brian Warner
44a44738ec take new args for 'restart' too, fixes test failure 2017-06-26 21:26:32 +01:00
Jean-Paul Calderone
6b20cb760a Take cli args for db and stats paths 2017-06-26 21:26:32 +01:00
Jean-Paul Calderone
777d722b0d Let me use FakeConfig in another test method 2017-06-26 21:26:32 +01:00
Brian Warner
5b3e816620 tests: cover enough of RendezvousConnector to exercise that last fix 2017-06-26 18:55:31 +01:00
Brian Warner
fa9382c716 handle WebSocket protocol errors correctly
The previous behavior was to throw an Automat exception, when a state machine
was given a LOST event from the initial non-connected state, and it didn't
have a handler for it. This version throws ServerConnectionError instead.

Still needs a test

refs #180
2017-06-26 18:55:31 +01:00
Brian Warner
900c3f8c29 server: make 'restart' accept --disallow-list too
I should really move all the start/restart common arguments into a separate
place, to make it easier to avoid this problem in the future.
2017-06-26 17:49:37 +01:00
Brian Warner
4169545c28 server-restart: add failing test
"wormhole-server restart" was broken by the addition of --disallow-list,
because the Click parser wasn't update to include the argument. This test
should exercise that a basic no-argv invocation of both "start" and "restart"
can at least build the Service object successfully.

refs #151
2017-06-26 17:49:34 +01:00
Brian Warner
f282649f81 tests/ServerBase: control advertise_version=
we'll disable this for most tests, but a few want to see it in the welcome
message
2017-06-26 15:20:36 +01:00
Brian Warner
bf96bab976 define IInputHelper 2017-06-26 13:52:23 +01:00
Brian Warner
57352431ab define IDeferredWormhole, add methods to (internal) IWormhole
refs #153
2017-06-26 13:51:58 +01:00
Brian Warner
2f4232a0e7 server: only advertise the CLI version if requested
with --advertise-version=

refs #179
2017-06-26 13:49:24 +01:00
Brian Warner
758dd5b9de use click.Path to make args.what unicode
refs #157 (unicode paths cause 'wormhole send' to crash), might fix it
2017-06-24 15:07:43 +01:00
Brian Warner
8f97e4e7e2 if the first connection fails, abandon the wormhole
This provides a clear error in case the user doesn't have an internet
connection at all, or something is so broken with their DNS or routing that
they can't reach the server. I think this is better than waiting and
retrying (silently) forever.

If the first connection succeeds, but is then lost, subsequent retries occur
without fanfare.

closes #68
2017-06-14 10:40:46 +01:00
Brian Warner
6b4ed71c8a skip non-public IP addresses
the old TorManager would return None for these, but txtorcon's new API throws
ValueError, which we must catch and skip
2017-05-24 16:49:06 -07:00
Brian Warner
269faf190a fall backs to SOCKS if we can't reach control port 2017-05-24 16:49:06 -07:00
Brian Warner
46a9c9eeb9 rewrite tor support
This shifts most reponsibility to the new txtorcon "Controller" object, where
it belongs. We no longer need a list of likely control-port locations, nor do
we need to keep track of the SOCKS port ourselves.

The one downside is that if a control-port is not reachable, then this does
not fall back to using a plain SOCKS port (usually tcp:localhost:9050).
txtorcon no longer uses txsocksx, so it no longer advertises a simple way to
use Tor without the control port. This shouldn't affect users who run the
TorBrowserBundle, or who are running a tor daemon which they can control
directly, but it may break for users who want to use a pre-existing tor
daemon that they don't have permissions to speak control-port to.
2017-05-24 16:49:06 -07:00
Atul Varma
8c2e739dcd Make test_broken_symlink_raises_err resilient across OS's/locales. 2017-05-24 12:10:22 -07:00
Atul Varma
ecfd46d16d Add test_broken_symlink_is_ignored. 2017-05-24 12:10:22 -07:00
Atul Varma
067b47fceb Add test_broken_symlink. 2017-05-24 12:10:22 -07:00
Atul Varma
0737a24712 Add --ignore-unsendable-files flag. 2017-05-24 12:10:22 -07:00
Kurt Rose
5cf9fe9f3e added two __main__.py for cli and server 2017-05-23 21:01:21 -07:00
meejah
6b31517b67 Add an allow_list option to control nameplate-listings 2017-05-16 17:17:11 -06:00
Brian Warner
95651f24f9 improve test coverage on get_welcome() API 2017-05-15 16:10:22 -07:00
Brian Warner
7955a36bfd switch to new API
This renames all the existing API methods, to use a consistent
"d=get_XYZ()" (for Deferred mode) or "dg.wormhole_got_XYZ()" (for Delegated
mode). It updates cmd_send/cmd_receive/cmd_ssh to use the new API.

Since we now have get_welcome(), apps handle the Welcome message with a
Deferred callback instead of registering a "welcome handler". This lets us
make sure we've finished printing any server message-of-the-day or "you
should update your client" message to stdout before using stdio to ask for
the wormhole code. (Previously, the code-input prompt was overwritten by the
server message, and it was ugly). refs #145. This approach adds an extra
roundtrip to the receiver, but we can fix that (see #145 for details).

Because of that change, the server-is-being-slow message is printed at a
slightly different time, so those tests needed some extra work to exercise it
properly.
2017-05-15 02:13:24 -07:00
Brian Warner
f762e1592f cmd_receive.py: expose wormhole object to tests 2017-05-14 18:45:18 -07:00
Brian Warner
c9eb281a8a fix tracing bug that always showed machine as "T"
False binding to a mutable loop variable. I keep making this same mistake.
2017-05-14 18:43:44 -07:00
Brian Warner
23c16717aa test_util: tolerate os.statvfs missing on windows
The code in util.py can tolerate a missing os.statvfs, but the code which
tests that code's ability to tolerate a missing os.statvfs was itself unable
to tolerate a missing os.statvfs. Sigh.
2017-05-09 21:35:12 -07:00
Brian Warner
c84939744f oops, fix it properly 2017-04-23 16:33:42 -04:00
Brian Warner
876dea8297 transit: ignore new data in "hung up" state
Apparently there's an intermittent condition in tests that follows this path.
We used to ignore unrecognized states, but to improve test coverage I added a
clause to catch them, and now that clause is happening where I didn't expect
it.
2017-04-23 16:31:26 -04:00
Brian Warner
ebe9df312e signal errors to w.when_code() waiters too
This fixes the case where "wormhole send" would wait forever (upon network
error) instead of terminating with a useful error message.

Testing this will have to wait until we land the branch that abandons the
wormhole if the first connection fails, since that's the easiest way to
provoke a network error before when_code() has fired.
2017-04-23 16:07:07 -04:00
Brian Warner
d6d6669b23 cli._dispatch_command: improve test coverage 2017-04-23 16:01:05 -04:00
Brian Warner
77bb7f5be7 test_wormhole: improve tests of derive_key() 2017-04-19 10:50:52 -04:00
Brian Warner
654bba4d3e test_wormhole: use assertRaises as context manager 2017-04-19 10:50:46 -04:00
Brian Warner
d0fb7a834d tests: exercise DelegatedWormhole 2017-04-19 10:50:31 -04:00
Brian Warner
ef56336eab fix DelegatedWormhole 2017-04-19 10:50:24 -04:00
Brian Warner
323d5a896f debug_set_trace: include _SortedKey 2017-04-19 10:50:18 -04:00
Brian Warner
f541930110 tests: exercise set_trace 2017-04-19 10:49:12 -04:00
Brian Warner
5a3f389bd3 improve debug timeline data and visualization 2017-04-18 14:05:46 -04:00
Brian Warner
0774ac8c36 test_wormhole: more coverage 2017-04-18 14:05:46 -04:00
Brian Warner
16c47de61b test_util.py: fully cover util.py 2017-04-18 14:05:46 -04:00
Brian Warner
556ae663cb test_transit: fully cover transit.py 2017-04-18 14:05:46 -04:00
Brian Warner
afe9f7152d test_transit: improve coverage
and fix py2/py3-isms in ipaddr tests
2017-04-18 14:05:39 -04:00
Brian Warner
478405cb6a test_cli: exercise -0 mode 2017-04-18 13:43:07 -04:00
Brian Warner
1bb4e9278a CLI: remove log.err(), remove flushLoggedErrors from tests
I think we're better off without this: the CLI commands propagate the Failure
up to their callers (rather than eating it silently), the callers are using
task.react (which reacts to Failures by exiting with rc!=0), so nothing
should get lost. And doing an extra log.err() just creates more cleanup work
for test cases to flush, and makes the CLI commands double-print the any
errors (maybe task.react also points logging at stderr?).
2017-04-16 16:45:09 -04:00
Brian Warner
b4e39edb3f cmd_receive: rename TwistedReceiver to just Receiver 2017-04-16 16:28:46 -04:00
Brian Warner
9dde091f2b test_wormhole.py: remove dead code 2017-04-16 10:56:17 -04:00
Brian Warner
e6b9cf18be update to match new (private) Automat tracing API 2017-04-13 16:51:04 -04:00
Brian Warner
c2a71e7240 delete leftover/unused/unimportable codes.py
refs #146
2017-04-10 11:33:46 -07:00
Brian Warner
469c94dc4e test_cli: on win32, force en_US.UTF-8 rather than running locale -e 2017-04-07 11:18:32 -07:00
Brian Warner
781d791e03 test server-reconnection: it worked already
Cool, it actually worked without changes. Closes #42
2017-04-07 09:48:48 -07:00
Brian Warner
992db1846c minor TODO comments 2017-04-06 19:44:27 -07:00
Brian Warner
6aa7fe7c82 Welcome: handle local dev versions (with +, not -) correctly
The Welcome class prints a message if the server recommends a CLI version
that's newer than what the client is currently using, but only if the client
is running a "release" version, not a "local" development one. "local"
versions have a "+" in them (at least when Versioneer creates it), but
Welcome was looking for "-" as an indicator. So it was printing the warning
when it shouldn't be.
2017-04-06 19:32:05 -07:00
Brian Warner
1a7b3baaf2 rewrite waiting-for-sender pacifier messages
re-enable the test, and add an extra one

The comments in cmd_send/cmd_receive now enumerate the four cases where we
might notice that things are taking too long, the three cases where we say
something about it, and the two cases where it might be appropriate to give
up automatically (although we don't do that anywhere yet).
2017-04-06 19:17:11 -07:00
Brian Warner
83e55f1f3e add w.when_key(), fix w.when_verified() to fire later
Previously, w.when_verified() was documented to fire only after a valid
encrypted message was received, but in fact it fired as soon as the shared
key was derived (before any encrypted messages are seen, so no actual
"verification" could occur yet).

This fixes that, and also adds a new w.when_key() API call which fires at the
earlier point. Having something which fires early is useful for the CLI
commands that want to print a pacifier message when the peer is responding
slowly. In particular it helps detect the case where 'wormhole send' has quit
early (after depositing the PAKE message on the server, but before the
receiver has started). In this case, the receiver will compute the shared
key, but then wait forever hoping for a VERSION that will never come. By
starting a timer when w.when_key() fires, and cancelling it when
w.when_verified() fires, we have a good place to tell the user that something
is taking longer than it should have.

This shifts responsibility for notifying Boss.got_verifier, out of Key and
into Receive, since Receive is what notices the first valid encrypted
message. It also shifts the Boss's ordering expectations: it now receives
B.happy() before B.got_verifier(), and consequently got_verifier ought to
arrive in the S2_happy state rather than S1_lonely.
2017-04-06 18:27:41 -07:00
Brian Warner
67d53f1388 wordlist: fix "1-word- TAB" case 2017-04-06 15:05:37 -07:00
Brian Warner
3f878fb981 rename test_scripts to test_cli 2017-04-06 12:30:56 -07:00
Brian Warner
e787d0ffc5 move Welcome into test_scripts, remove test_cli 2017-04-06 12:29:58 -07:00
Brian Warner
9717b67d1b comment out serialize() for now
until it's implemented fully
2017-04-06 12:27:06 -07:00
Brian Warner
f957e9b2fb test_wormhole: check when_verified() being called late 2017-04-06 12:26:52 -07:00
Brian Warner
a063ed2b3b remove unused wordlist.py (now lives in _wordlist.py) 2017-04-06 12:23:25 -07:00
Brian Warner
7c6332b770 wormhole: comments 2017-04-06 12:22:45 -07:00
Brian Warner
3cd4d31c0b journal: add test coverage 2017-04-06 12:22:45 -07:00
Brian Warner
df1b2338b1 tests: exercise Key receiving PAKE before set_code 2017-04-06 12:22:45 -07:00
Brian Warner
0da9cbdeeb remove unused code 2017-04-06 12:22:45 -07:00
Brian Warner
d331c51c03 change completion API
* InputHelper returns full words, not just suffixes. I liked the fact that
  suffixes made it impossible to violate the "all matches will start with
  your prefix" invariant, but in practice it was fiddly to work with.
* add ih.when_wordlist_is_available(), so the frontend can block (after
  claiming the nameplate) until it can return a complete wordlist to
  readline. This helps the user experience, because readline wasn't really
  built to work with completions that change over time
* make the Wordlist responsible for appending hyphens to all non-final word
  completions. InputHelper remains responsible for hyphens on nameplates.
  This makes the frontend simpler, but I may change it again in the future if
  it helps non-readline GUI frontends.
* CodeInputter: after claiming, wait for the wordlist rather than returning
  an empty list
* PGPWordList: change to match

This has the unfortunate side-effect that e.g. typing "3-yucatan-tu TAB"
shows you completions that include the entire phrase: "3-yucatan-tumor
3-yucatan-tunnel", rather than only mentioning the final word. I'd like to
fix this eventually.
2017-04-06 12:22:45 -07:00
Brian Warner
04926d0be8 minor test improvement 2017-04-06 12:22:45 -07:00
Brian Warner
4c7b908024 _rlcompleter: improve debug messages and comments 2017-04-06 12:22:45 -07:00
Brian Warner
7699ed2291 tell wordlist how many words to expect, add hyphens to matches
I'm still undecided about whether to add this to the mailbox
properties (revealing it to attackers) or continue to require non-default
wordcounts to be provided as a --code-length= argument to the receiver. So
for now the only place that says count=2 is in the default argument on
get_completions().
2017-04-06 12:22:45 -07:00
Brian Warner
a1f0d1bbf7 debug_set_trace(): cleanups, remove dead code 2017-04-06 12:22:45 -07:00
Brian Warner
bdef446ad4 get mostly-full coverage for rlcompleter, rename, export 2017-04-06 12:22:45 -07:00
Brian Warner
8882e6f64e merge test_wormhole_new into test_wormhole 2017-04-06 12:22:45 -07:00
Brian Warner
8d47194612 check when_version() can be called late as well as early 2017-04-06 12:22:45 -07:00
Brian Warner
580c5a4712 remove unused channel_monitor.py 2017-04-06 12:22:45 -07:00
Brian Warner
6eae5ecf64 better py2/py3 fix, use locale of C.UTF-8 or en_US.UTF-8
This updates the unit tests to checks the system (by running 'locale -a' just
like Click does) to use a UTF-8 -safe locale. It prefers C.UTF-8 if
available, then en_US.UTF-8, then will fall back to any UTF-8 it can find.

My macOS box has en_US.UTF-8 (but not C.UTF-8), and my linux box has
C.UTF-8 (but not en_US.UTF-8). This change doesn't help normal runtime, but
ought to allow the unit tests to run on either platform correctly.
2017-04-06 12:22:45 -07:00
Brian Warner
d0d2992d44 fix some py2-isms that broke py3
This also changes the can-I-run-wormhole check to use C.UTF-8 instead of
en_US.UTF-8, which seems necessary to hush Click on py3. See issue #127 for
more discusson.
2017-04-06 12:22:45 -07:00
Brian Warner
228e0ed671 set_trace: tolerate an Automat that lacks m.setTrace
wormhole.debug_set_trace() won't work until glyph/automat#56 lands, but this
should let travis do its job in the meantime.
2017-04-06 12:22:45 -07:00
Brian Warner
76f5960517 rewrite welcome handler 2017-04-06 12:22:45 -07:00
Brian Warner
152775c5c0 hush pyflakes 2017-04-06 12:22:45 -07:00
Brian Warner
bbef68c11e remove no-longer-relevant tests 2017-04-06 12:22:45 -07:00
Brian Warner
271efb6025 match new Automat tracing API (in glyph/automat#56 PR) 2017-04-06 12:22:45 -07:00
Brian Warner
d44a5335b4 _mailbox: new Automat forbids code in Input bodies 2017-04-06 12:22:45 -07:00
Brian Warner
3ca2720f11 Input: more debug text 2017-04-06 12:22:45 -07:00
Brian Warner
b38d4c94ca Code: deliver got_code to Boss before Key
So when Key sends got_key to Boss, Boss will be ready for it

test_machines: match new delivery order
2017-04-06 12:22:44 -07:00
Brian Warner
0ed363c894 Key: sort messages to ensure got_code lands before got_pake
Since input_code() sets the nameplate before setting the rest of the code,
and since the sender's PAKE will arrive as soon as the nameplate is set, we
could got_pake before got_code, and Key wasn't prepared to handle that.
2017-04-06 12:22:44 -07:00
Brian Warner
17b4ff9893 rework completion, vaguely works 2017-04-06 12:22:44 -07:00
Brian Warner
351a523d0b disable test_slow_text for now 2017-04-06 12:22:44 -07:00
Brian Warner
9267c204e9 test_wormhole_new: oops, forgot yield on assertFailure
This was breaking the last test that gets run (test_xfer_util) because of the
lingering failures.
2017-04-06 12:22:44 -07:00
Brian Warner
07a49bfaca make progress on rlcompleter, still broken 2017-04-06 12:22:44 -07:00
Brian Warner
1b5a0289a8 cmd_send: finally fix when_verified call 2017-04-06 12:22:44 -07:00
Brian Warner
a446d4333e start on new rlcompleter wrapper function 2017-04-06 12:22:44 -07:00
Brian Warner
f0cab020f4 hush some pyflakes 2017-04-06 12:22:44 -07:00
Brian Warner
e82d705764 unbreak other tests 2017-04-06 12:22:44 -07:00
Brian Warner
53a911cc80 finish Boss tests 2017-04-06 12:22:44 -07:00
Brian Warner
d8d305407b start on Boss tests 2017-04-06 12:22:44 -07:00
Brian Warner
bd974f3801 test Nameplate, Mailbox. refactor a little bit 2017-04-06 12:22:44 -07:00
Brian Warner
3a289f8912 add tests for Send and Terminator 2017-04-06 12:22:44 -07:00
Brian Warner
e66d2df9f1 test and fix wordlist methods 2017-04-06 12:22:44 -07:00
Brian Warner
3873f55d64 make Input tests pass, clarify error cases, cleanups 2017-04-06 12:22:44 -07:00
Brian Warner
175fef2ab4 clean up wordlist handling 2017-04-06 12:22:44 -07:00
Brian Warner
ae95948c17 more tweaks 2017-04-06 12:22:44 -07:00
Brian Warner
4f1b352b2a more work: allocator, input, shift responsibilities 2017-04-06 12:22:44 -07:00
Brian Warner
ae8652daf6 code: internal name changes 2017-04-06 12:22:44 -07:00
Brian Warner
0be5aba77d begin worm on new Code machine 2017-04-06 12:22:44 -07:00
Brian Warner
e2c0f08216 minor renames for code-input helper stuff 2017-04-06 12:22:44 -07:00
Brian Warner
4bd9d3579c go back to "input_code" instead of "type_code" 2017-04-06 12:22:44 -07:00
Brian Warner
276fdd3673 fix tests that exercise failure 2017-04-06 12:22:44 -07:00
Brian Warner
29f467e9d8 CLI: don't hide errors, fuss with verifier API 2017-04-06 12:22:44 -07:00
Brian Warner
921228a702 log errors better 2017-04-06 12:22:44 -07:00
Brian Warner
7c18fb81dd only allow code to be set once 2017-04-06 12:22:44 -07:00
Brian Warner
2054e4c76b test app versions 2017-04-06 12:22:44 -07:00
Brian Warner
5f9894ca63 API updates, make most tests pass, disable others
* finally wire up "application versions"
* remove when_verifier (which used to fire after key establishment, but
  before the VERSION message was received or verified)
* fire when_verified and when_version at the same time (after VERSION is
  verified), but with different args
2017-04-06 12:22:44 -07:00
Brian Warner
e518f2b799 throw KeyFormatError when given a code with spaces 2017-04-06 12:22:44 -07:00
Brian Warner
aebee61816 fix close behavior: Deferreds should errback once closed 2017-04-06 12:22:44 -07:00
Brian Warner
ddb83e9d59 wormhole: handle w.close() after error-induced closure 2017-04-06 12:21:00 -07:00
Brian Warner
2422ee0b88 disable NotWelcome test until signal_error is done 2017-04-06 12:21:00 -07:00
Brian Warner
9ca657a7c6 reenable TorManager 2017-04-06 12:21:00 -07:00
Brian Warner
4234e79161 test_wormhole: fix message-doubling test 2017-04-06 12:21:00 -07:00
Brian Warner
105d9cc59f work on WelcomeHandler, still incomplete 2017-04-06 12:21:00 -07:00
Brian Warner
4c6cb1dddc xfer_util: update to new API 2017-04-06 12:21:00 -07:00
Brian Warner
dfe9fd2395 RC: internal errors during ws_open should halt boss 2017-04-06 12:21:00 -07:00
Brian Warner
6ada8252b7 Code: handle being connected before being told what to do 2017-04-06 12:21:00 -07:00
Brian Warner
8ee342ad82 make cmd_send/cmd_receive basically work again 2017-04-06 12:21:00 -07:00
Brian Warner
e9f3107127 deliver app-versions up to Wormhole 2017-04-06 12:21:00 -07:00
Brian Warner
60a61c995b implement w.derive_key() 2017-04-06 12:21:00 -07:00
Brian Warner
0474c39bab tests: match API change 2017-04-06 12:21:00 -07:00
Brian Warner
c499fce9f5 change API (wormhole.create), start on serialization 2017-04-06 12:21:00 -07:00
Brian Warner
b7b8df17be rename NameplateLister to Lister (unique prefix L) 2017-04-06 12:21:00 -07:00
Brian Warner
9a2d992815 reminder how ConnectionService should fail if first attempt fails 2017-04-06 12:21:00 -07:00
Brian Warner
88cb42f95b test_machines: exercise state machines better 2017-04-06 12:21:00 -07:00
Brian Warner
2dcfb07ba1 Receive does not need access to Key 2017-04-06 12:21:00 -07:00
Brian Warner
db7b24086f set no-cover on all state-definition lines, and set_trace 2017-04-06 12:21:00 -07:00
Brian Warner
610db612ba improve error handling
errors raised while processing a received message will cause the Wormhole to
close-with-error, and any pending Deferreds will be errbacked
2017-04-06 12:21:00 -07:00
Brian Warner
fb92922918 terminator: renaming TODO note 2017-04-06 12:21:00 -07:00
Brian Warner
4222054903 nameplate: tolerate rx_claimed during shutdown 2017-04-06 12:21:00 -07:00
Brian Warner
4793208d4e rewrite debug tracing, add to all machines 2017-04-06 12:21:00 -07:00
Brian Warner
b0c9c9bb4c fix basic test 2017-04-06 12:21:00 -07:00
Brian Warner
1beae97ec4 fix things back to the previous point of not working 2017-04-06 12:21:00 -07:00
Brian Warner
26adaabe18 implement new split nameplate/mailbox/terminator
fails even worse than before, of course
2017-04-06 12:21:00 -07:00
Brian Warner
c8be988801 add some state-machine tracing
needs warner/automat/36-tracing branch
2017-04-06 12:21:00 -07:00
Brian Warner
97d1ff859b logic bug: M.S4B.close() must not re-send RELEASE 2017-04-06 12:21:00 -07:00
Brian Warner
41b7bcfed5 working on fixes 2017-04-06 12:21:00 -07:00
Brian Warner
b7df5e21eb more tests, still failing 2017-04-06 12:21:00 -07:00
Brian Warner
8a2810ba70 test basic code allocation 2017-04-06 12:21:00 -07:00
Brian Warner
ef1904bc52 get null test working (open and immediate close) 2017-04-06 12:21:00 -07:00
Brian Warner
c95b6d402c Code: don't sent tx_allocate until we're connected
So Code needs connected/lost from the RendezvousConnector
2017-04-06 12:21:00 -07:00
Brian Warner
5d6989614b work on top-level stuff 2017-04-06 12:21:00 -07:00
Brian Warner
7e7b43e910 start on top-level driver, wormhole.py 2017-04-06 12:21:00 -07:00
Brian Warner
88775d7f50 states.py: remove old file 2017-04-06 12:21:00 -07:00
Brian Warner
825370fdd2 cleanups, remove misc.py 2017-04-06 12:21:00 -07:00
Brian Warner
d4bedeafbf general fixes 2017-04-06 12:21:00 -07:00
Brian Warner
20814a65f4 rename Wormhole (machine) to Boss, leave room for higher-level thing 2017-04-06 12:21:00 -07:00
Brian Warner
92f2b89d3e journal: fix syntax 2017-04-06 12:21:00 -07:00
Brian Warner
a2ed35ceb8 remove old files, lots of type work 2017-04-06 12:21:00 -07:00
Brian Warner
3101ca51db name cleanup 2017-04-06 12:21:00 -07:00
Brian Warner
80661392b6 build out all state machines
still early: automat is happy (they're syntactically valid), but the Outputs
are not implemented, and there are plenty of type mismatches
2017-04-06 12:21:00 -07:00
Brian Warner
9ae8091ec3 delete old files 2017-04-06 12:21:00 -07:00
Brian Warner
21cb62a4cf move _c2.py out of the way, I might want it later 2017-04-06 12:21:00 -07:00
Brian Warner
b179e66d08 start on machine implementation: _key.py and _send.py 2017-04-06 12:21:00 -07:00
Brian Warner
40e0d6b663 more work, feels better now 2017-04-06 12:21:00 -07:00
Brian Warner
16c477424c more demo work 2017-04-06 12:21:00 -07:00
Brian Warner
693e215d8b sketching out a journal-based demo app 2017-04-06 12:21:00 -07:00
Brian Warner
20b80be342 remove stale machines 2017-04-06 12:21:00 -07:00
Brian Warner
3af375b173 finish Mailbox state machine, including close 2017-04-06 12:21:00 -07:00
Brian Warner
b934192f20 work on Mailbox machine 2017-04-06 12:21:00 -07:00
Brian Warner
11a80f0018 moving to separate machine class 2017-04-06 12:21:00 -07:00
Brian Warner
3bf762b4f7 try coding top-level WormholeMachine 2017-04-06 12:21:00 -07:00
Brian Warner
faab1e87d0 split _machine.py out 2017-04-06 12:21:00 -07:00
Brian Warner
17a90d87ac tweaks 2017-04-06 12:21:00 -07:00
Brian Warner
35324a7911 my StateMachine can now render .dot 2017-04-06 12:21:00 -07:00
Brian Warner
0fe6cfd994 tweaks 2017-04-06 12:21:00 -07:00
Brian Warner
0b05c9ca5a new experimental state-machine language
I think I want to express actions as transient states. _c2.py matches w4.dot
2017-04-06 12:21:00 -07:00
Brian Warner
057f616765 more experimentation 2017-04-06 12:21:00 -07:00
Brian Warner
18f7ab9308 more state-machine work 2017-04-06 12:21:00 -07:00
Brian Warner
63ae3c63fc notes 2017-04-06 12:21:00 -07:00
Brian Warner
9e5bf452e3 rename 2017-04-06 12:21:00 -07:00
Brian Warner
3c9c0e58ab move to _connection.py, add more state machines
Starting on defining manager state machines for nameplates, mailboxes, the
PAKE key-establishment process, and the bit that knows it can drop the
connection when both nameplates and mailboxes have been released.
2017-04-06 12:21:00 -07:00
Brian Warner
14c8e76364 onConnect, start manual tests, doesn't work yet 2017-04-06 12:21:00 -07:00