Commit Graph

1510 Commits

Author SHA1 Message Date
Brian Warner
16b6245f44 test describe_inbound, format IPv6 better 2019-08-11 14:10:29 -07:00
Brian Warner
d0c27552cf tox.ini: remove py3.4 from envlist
We removed py3.4 support back in July, but I forgot to remote it from the tox
config too.
2019-08-09 10:41:31 -07:00
Brian Warner
c068bfdfdd transit key is derived from the wrong APPID, bummer
When I made it possible to override APPID with a CLI argument (issue #113), I
forgot to also change this w.derive_key() (issue #339). We don't really need
to include APPID in that purpose string at all (the ideal code would be just
`w.derive_key("transit-key", length)`), but we're stuck with it now. Both
sides must use the same derivation process, and it would be pretty
expensive/complicated to negotiate the process ahead of time (and this code
is scheduled to be obsoleted by Dilation anyways).

I added a note to the two sites that use it, and put a local copy of the
APPID there. We should treat that copy as an arbitrary magic string that must
be included for compatibility with existing deployments (potential
file-transfer peers), which is coincidentally similar to the default `APPID`.

closes #339
2019-07-24 11:11:48 -07:00
Brian Warner
20496e3976 Merge branch '335-buffer-1'
closes #335
2019-07-13 19:48:58 -07:00
Brian Warner
b633602a02 update test_manager to match 2019-07-13 19:25:50 -07:00
Brian Warner
85cb003498 WIP: rewrite w.dilate API to return endpoints synchronously
test_manager still needs rewriting
2019-07-12 00:01:55 -07:00
Brian Warner
75fad02a28 subchannel: queue pending opens with a deque(), not a list
slightly cleaner
2019-07-08 01:15:13 -07:00
Brian Warner
443d248972 manager: call inbound.set_listener_endpoint() before start()
This should fix the immediate issue of the remote side opening a
subchannel (and sending data on it) before the local side even sees the
Endpoints, so before it can register a listening factory to receive the OPEN.

We were already buffering early OPENs in the SubchannelListenerEndpoint, but
this makes sure that endpoint is available (for the manager's Inbound half to
deliver) them as soon as the dilation connection is established.

The downside to buffering OPENs (and all data written to inbound subchannels)
is that the application has no way to reject or pause them, until it
registers the listening factory. If the application never calls
`listen_ep.listen()`, we'll buffer this data forever (or until the wormhole
is closed). The upside is that we don't lose a roundtrip waiting for an ack
on the OPEN. See ticket #335 for more details.

refs #335
2019-07-08 01:12:39 -07:00
Brian Warner
575cf5d789 subchannel: check MAX_FRAME_LENGTH, 2**32 minus headers
Anyone sending 4GB in a single `transport.write()` is in for a surprise, but
at least we'll surprise them with an assertion *before* spending the time and
memory encrypting that monster.
2019-07-07 23:59:54 -07:00
Brian Warner
d1aefa815d fix subchannel open/close, add test
I think I just managed to forget that inbound_close requires we respond with
a close ourselves. Also outbound open means we must add the subchannel to the
inbound table, so we can receive any data on it at all.
2019-07-06 01:50:29 -07:00
Brian Warner
8043e508fa make SubChannel IDs integers, not 4-bytes
I'm sure I had a good reason for avoiding integers, but it makes logging and
testing more difficult, and both sides are using integers to generate them
anyways (so one side can pick the odd ones, and the other can pick the even
ones).
2019-07-06 01:10:34 -07:00
Brian Warner
a74cc99e6a dilate: test sending data while the connection is offline 2019-07-05 23:16:25 -07:00
Brian Warner
3a4b9a3b67 Merge branch 'dilation-testing' 2019-07-05 16:02:53 -07:00
Brian Warner
c9d36888bb docs: add dilation state machines diagram 2019-07-05 15:56:13 -07:00
Brian Warner
ee8c1acffa dilate/test_full: test reconnection 2019-07-05 15:54:19 -07:00
Brian Warner
98cce7fab7 connector: tidy Factory reprs 2019-07-05 15:54:19 -07:00
Brian Warner
8cfdc4c9bc README: drop python3.4 support
Python3.4 is no longer maintained (PEP 429 says March 2019 was the EOL date),
and the current version of pip (19.1) is the last to support it, so it's time
to let go.

* remove py34 from .travis.yml so PRs don't fail spuriously (there's some
  problem with txtorcon and twisted that only happens on py3.4)
2019-07-05 15:50:00 -07:00
Miro Hrončok
f2d5084761
Fedora has magic-wormhole in all versions 2019-06-04 20:57:01 +02:00
Brian Warner
ab00f8e876 Merge branch 'pr331'
closes #330
2019-05-29 23:33:55 -07:00
Brian Warner
58cf584fb0 cmd_receive: treat 'quit' or other non- yes/no answers as "no"
So "yes" or "Yes" or "y" or "Y" or anything else that starts with y/Y means
yes, and a bare newline means yes, but anything else means no.
2019-05-29 23:32:02 -07:00
morrieinmaas
e2c678930c Closes #330 Changed default choice from No to Yes for wormhole receive 2019-05-18 15:57:03 -04:00
Brian Warner
293893ec01 Merge branch 'dilation-fixes' 2019-05-07 11:45:49 -07:00
Brian Warner
38f512e4cc open sc0 early, since messages can arrive attached to the KCM
Without this, the Follower would see data for subchannel 0 before it had a
chance to create the SubChannel object that could accept it. We already have
a mechanism for inbound data to be queued inside the SubChannel until the
endpoint has had a chance to create the Protocol object: we rely on that
mechanism here. We just need to create the SubChannel before telling the
Manager to start, even though we don't reveal the SubChannel to the
caller (via the control endpoint) until the connection is known to succeed.

This helps a manual test get data from one side to the other without throwing
exceptions.
2019-05-07 11:41:30 -07:00
Brian Warner
d612b58dd8 connection: tolerate merged KCM and first record
When the follower's connection is accepted, they'll observe a single
dataReceived chunk containing both the leader's KCM and the leader's first
actual data record. The state machine considers the KCM for an eventual-turn
before selecting the connection, so the data record will arrive while the
connection isn't quite ready for it (if consider() were immediate, this
wouldn't be a problem, but Automat doesn't deal with reentrant calls very
well). So we queue any records that arrive before we're selected.
2019-05-07 11:41:30 -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
7eb1201379 connection: improve comments about protocol flow 2019-05-07 11:41:30 -07:00
Brian Warner
c933c5cc06 dilation-protocol.md: clarify a few things 2019-05-07 11:41:30 -07:00
Brian Warner
d9284cd4cb hints: avoid DNS lookups for all-numeric ipv4/ipv6 hints
This improves offline behavior for some tests, if we get spurious DNS lookup
errors.
2019-05-07 11:41:29 -07:00
Brian Warner
50c766f811 Merge branch 'fix-appveyor' 2019-05-06 01:29:12 -04:00
Brian Warner
34a190a6da dilate/connector: trap the right errors
If we had multiple potential connections, the act of cancelling the losing
ones was putting an error into log.err(), which flunked the tests. This
happened to appear on windows because the appveyor environment has different
interfaces than travis hosts.
2019-05-06 01:18:59 -04:00
Brian Warner
2d079e12e6 appveyor: set TOXENV separately for each python version
Builds are failing on appveyor because it's trying to install `noiseprotocol`
all the time, when it's only installable under py3.

Thanks to @julian and julian/jsonschema 's .appveyor for the hints.
2019-05-05 19:22:06 -04:00
Brian Warner
9e4e0850f1 Merge branch '321-docs-py3'
closes #321
2019-05-05 18:15:24 -04:00
Brian Warner
2f8873f50a docs/conf.py: add py2/py3-tolerance 2019-05-05 18:05:56 -04:00
Brian Warner
49ab25ff34 add 'tox -e docs', travis job to exercise it 2019-05-05 18:02:00 -04:00
Brian Warner
cedf549ccd docs/Makefile: add the missing newline 2019-05-05 17:42:57 -04:00
Brian Warner
995d3f546a Merge branch 'pr323' 2019-03-09 16:10:03 -08:00
Евгений Протозанов
9464fa91fc Added support for sending block devices 2019-02-22 14:15:58 +04:00
Brian Warner
a5e011f786 Merge branch 'dilate-xfer'
Add an integration test which exercises a full w.dilate connection and the
control endpoint.

Still untested:

* reconnecting after the initial TCP connection is lost
* resending data that wasn't acked before the connection was lost
* (re)sending data that was submitted while no connection was available
* the connect- and listen- endpoints
2019-02-10 18:07:03 -08:00
Brian Warner
bc863de634 dilate/test_full: enable, it works now 2019-02-10 18:02:29 -08:00
Brian Warner
c27680b910 terminator: shut down Dilator after everything else stops
This makes w.stop() the right way to shut everything down including any
Dilator connections (in-progress, active, or in-shutdown).
2019-02-10 18:01:14 -08:00
Brian Warner
7f90999775 test_full: finish test, although it still fails 2019-02-10 16:59:07 -08:00
Brian Warner
53ad951c11 DilatedConnectionProtocol/Role: prettier repr 2019-02-10 16:57:16 -08:00
Brian Warner
ebc63e52e0 add description to inbound connections 2019-02-10 16:52:17 -08:00
Brian Warner
74c416517f scids are four-byte strings, not integers
be consistent about it
2019-02-10 16:23:20 -08:00
Brian Warner
2ec7b8e662 update_ack_watermark takes seqnum, not record 2019-02-10 16:22:30 -08:00
Brian Warner
bf25dc68cf connector: use disconnect(), not loseConnection() 2019-02-10 15:57:55 -08:00
Brian Warner
0c9d2c927a fix hashability of dilation objects 2019-02-10 15:57:39 -08:00
Brian Warner
e4264971d7 add dilate/test_full, still failing 2019-02-10 11:51:54 -08:00
Brian Warner
a2a149946b test_connect: skip integration test when Noise is unavailable 2019-02-10 11:51:54 -08:00
Brian Warner
7f03adda3a dilate.test_connect: basic integration test
This mocks out the mailbox connection, and makes sure that endpoints are
constructed.
2019-02-10 11:51:54 -08:00