Commit Graph

100 Commits

Author SHA1 Message Date
Brian Warner
840dfa603b w.dilate(): accept transit_relay_location=, pass through to manager 2019-08-11 22:20:49 -07:00
Brian Warner
55056bd324 make no_listen= an argument to w.dilate() rather than create()
It wasn't exposed in create(), and I need it for more tests. This might not
be the best approach, I'll have to play with it a bit to tell.
2019-05-07 11:41:30 -07:00
Brian Warner
be2dc01a94 wormhole.py: add debug switch to enable dilation (for tests) 2019-02-10 11:47:28 -08:00
Brian Warner
4083beeb6c wormhole.py: disable dilate() API until ready
more importantly, turn off the "we can do Dilation" advertisement for now,
since we really can't
2018-12-24 14:34:02 -05:00
Brian Warner
7e168b819e manager: clean up versions, merge state machines 2018-12-23 15:23:27 -05:00
Brian Warner
5f61531445 more flake8 fixes, in wormhole.py and _interfaces.py 2018-12-23 15:22:57 -05:00
Brian Warner
34686a346a add dilation code
(this compresses several months of false starts and rearchitecting)
2018-12-23 15:21:08 -05:00
Brian Warner
6cfabba31a add reactor/cooperator to Wormhole and Boss calls 2018-12-23 15:20:25 -05:00
Vasudev Kamath
12dcd6a184 Make code pep-8 compliant 2018-04-21 13:00:08 +05:30
Brian Warner
5c84f6a373 wormhole: slightly different way to unicode-encode the version
(this is somewhat more in line with how this distinction is made elsewhere in
the code)
2018-04-03 17:10:46 -07:00
Brian Warner
0dd3a12546 cosmetic changes, remove debug print 2018-04-03 17:05:33 -07:00
Baime
1197e5fb6d fix py 3.x versioneer issue 2018-03-23 18:19:31 +01:00
Baime
e77a2d605b bind passes tuple, fixed implementation issues 2018-03-23 17:33:48 +01:00
Baeumla
82dc4a4e2e py 2.7 3.x fix 2018-03-09 10:20:03 +01:00
Baeumla
0322d341e8 py 2.7 fix 2018-03-09 09:31:59 +01:00
Baeumla
4f8aa5a69e report clinet version on bind 2018-03-08 11:54:27 +01:00
Brian Warner
be47f53e7c wormhole: switch to observers for all APIs
Tests can pass an EventualQueue into wormhole.create(), to override the
default. This lets the tests flush the queue without using a haphazard
real-time delay.

closes #23

(in fact, we added multiple-Deferreds-per-API a while ago, but this does it
in a much cleaner fashion, and with the safety of an eventual-send)
2018-02-26 17:50:40 -08:00
Brian Warner
dce01174eb improve debug_set_trace: add Allocate and Input events
Also log events at the beginning and end of Input.choose_nameplate and
Input.choose_words, since those are the two big locally-driven (UI) triggers
that cause multiple messages to be fired and lots of work to happen.
2018-02-14 00:56:14 -08:00
Brian Warner
57352431ab define IDeferredWormhole, add methods to (internal) IWormhole
refs #153
2017-06-26 13:51:58 +01: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
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
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
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
992db1846c minor TODO comments 2017-04-06 19:44:27 -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
9717b67d1b comment out serialize() for now
until it's implemented fully
2017-04-06 12:27:06 -07:00
Brian Warner
7c6332b770 wormhole: comments 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
76f5960517 rewrite welcome handler 2017-04-06 12:22:45 -07:00
Brian Warner
53a911cc80 finish Boss tests 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
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
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
9ca657a7c6 reenable TorManager 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
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
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
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
4793208d4e rewrite debug tracing, add to all machines 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
ef1904bc52 get null test working (open and immediate close) 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
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