Commit Graph

914 Commits

Author SHA1 Message Date
Brian Warner
db968900d9 test_server: improve coverage 2016-12-23 22:22:39 -05:00
Brian Warner
b8313b4595 dedup relays, include our own relay when connecting
* Previously, we only connected to the relay supplied by our partner, which
  meant that if our relay differed from theirs, we'd never connect
* But we must de-duplicate the relays because when our relay *is* the same as
  theirs, we'd have two copies, which means two connections. Now that we
  deliver sided handshakes, we can tolerate that (previously, our two
  connections would be matched with each other), but it's still wasteful.

This also fixes our handling of relay hints to accept multiple specific
endpoints in each RelayHint. The idea here is that we might know multiple
addresses for a single relay (maybe one IPv4, one IPv6, a Tor .onion, and an
I2P address). Any one connection is good enough, and the connections we can
try depend upon what local interfaces we discover. So a clever implementation
could refrain from making some of those connections when it knows the sibling
hints are just as good. However we might still have multiple relays entirely,
for which it is *not* sufficient to connect to just one.

The change is to create and process RelayV1Hint objects properly, and to set
the connection loop to try every endpoint inside each RelayV1Hint. This is
not "clever" (we could nominally make fewer connection attempts), but it's
plenty good for now.

refs #115

fix relay hints
2016-12-23 22:22:39 -05:00
Brian Warner
80ae9236df make RelayV1Hint objects hashable/comparable 2016-12-23 22:22:39 -05:00
Brian Warner
e1546bf03f Transit: send new (sided) handshakes 2016-12-23 22:22:39 -05:00
Brian Warner
b64f27fdad Merge: enhance transit server
This adds a new kind of handshake message, which lets the Transit Relay
server tell when two connections (for the same channel) are really from the
same client, and therefore should not be connected to each other. The 0.8.2
client speaks the old handshake, but a future client will speak the new
handshake.

refs #115
2016-12-23 22:19:13 -05:00
Brian Warner
5fcea701bb transit server: accept both new (sided) and old (unsided) handshakes 2016-12-22 23:54:36 -05:00
Brian Warner
c7e4d57405 improve relay test 2016-12-22 23:53:29 -05:00
Brian Warner
f2e011bc9c Add --appid to override the APPID, for subprocess-based wrappers.
Tools which use `wormhole send` under the hood should use a distinct
--appid= (setting the same URL-shaped value on both sides, starting with a
domain name related to the tool and/or its author), so wormhole codes used by
those tools won't compete for short channelids with other tools, or the
default text/file/directory-sending tool.

Closes #113
2016-12-22 15:44:13 -05:00
Brian Warner
d81f2dae95 Merge PR109: flush stdout after displaying code
Closes #108
2016-12-17 17:34:02 -08:00
Brian Warner
57c0894774 cmd_send: flush args.stdout, in case it's different 2016-12-17 17:32:12 -08:00
Joey Hess
8bec79289a send: flush stdout after displaying code
Fixes https://github.com/warner/magic-wormhole/issues/108

Apparently python defaults to buffering stdout when not outputting to
the terminal. It would be better IMHO if every line of stdout were
autoflushed, but based on
http://stackoverflow.com/questions/107705/disable-output-buffering
there's not a really good way to accomplish that in python.
2016-12-17 17:20:45 -04:00
Brian Warner
ec3599ff09 Merge PR49: emit pacifier message when key-verification is slow
Closes #29
Closes #49
2016-12-16 01:47:56 -08:00
Brian Warner
30af04d245 test_scripts: rename mode to be "slow-text" 2016-12-16 01:33:45 -08:00
Brian Warner
face9423dd internals: ensure _API_establish_key is not called twice 2016-12-16 01:33:17 -08:00
laharah
2d1f474c60 rebased and fixed merge error 2016-12-16 01:06:21 -08:00
laharah
6bdaaf368c Moved slow connection notification to stderr
added test for slow connection notifications
2016-12-16 01:06:21 -08:00
laharah
01318d1130 added notification to cmd_receive plus reactor cleanup
Added a try finally block around verify to ensure notification
deferreds are being cleaned out of the reactor
2016-12-16 01:03:01 -08:00
laharah
a2ab1863cf added the new key waiter to be cleaned up on error in wormhole
Also, set new print statment to print to args.stdout
2016-12-16 01:03:01 -08:00
laharah
f786031f40 basic key established hook added to CLI send 2016-12-16 01:03:01 -08:00
laharah
680b01b3fc added api hooks to get notification about key excange
added more coverage to establish key API hook
2016-12-16 01:03:01 -08:00
laharah
33fa6f6ede tests for new establish_key wormhole hook
defered should behave similarly to the `verify` hook
2016-12-16 01:03:01 -08:00
Brian Warner
cd40fc7a03 Merge PR91: reject transfers upon insufficient space 2016-12-15 20:15:34 -08:00
Brian Warner
5c751eb3ed fix tests on windows 2016-12-15 19:52:26 -08:00
Brian Warner
f3e1aab3a1 reject transfers when there isn't enough disk space available
closes #91

Also tweaks an error message: don't say "refusing to clobber pre-existing
file FOO" when we don't check that it's actually a file. Just say "..
pre-existing 'FOO'".
2016-12-15 19:52:26 -08:00
Brian Warner
b57928431a add utility to estimate free disk space 2016-12-15 19:52:26 -08:00
Brian Warner
da53c78d56 Merge PR102: add man pages
Closes #69
2016-12-15 19:50:10 -08:00
Antoine Beaupré
d7441cfe8a remove out of date version numbers 2016-12-15 10:36:32 -05:00
Antoine Beaupré
7bade97bc2 add cross-refs and authors 2016-12-15 10:36:16 -05:00
Antoine Beaupré
cdc25e533a move wormhole-server to section 8
this is where admin commands and daemons belong, according to intro(8)
2016-12-15 10:35:49 -05:00
Antoine Beaupré
cc890aa6fa import manpages from Debian project 2016-12-15 10:25:28 -05:00
Brian Warner
123073a519 tox coverage: always build .xml after the run
I almost always want this, and I keep forgetting to run 'coverage xml'
myself.
2016-12-10 15:29:10 -08:00
Brian Warner
2596c58e4a ipaddrs: import function from latest Tahoe
I'm hoping this will help with Cygwin (#13), by removing/bypassing the
assert(os.path.isabs) check.
2016-12-10 13:06:27 -08:00
Brian Warner
58f20d79a7 update to versioneer-0.17
This should fix the pyflakes error when running tox on an unpacked sdist.
2016-12-10 10:36:59 -08:00
Brian Warner
f0bfcd7ca4 fix some py2/py3-isms picked up by mypy
These happened to work, but it's probably best to get the types right.
2016-12-08 23:47:53 -08:00
Brian Warner
fa9285910d NEWS: mention twisted[tls] too 2016-12-08 22:26:03 -08:00
Brian Warner
917703cc41 NEWS: update for 0.8.2 release 2016-12-08 17:44:40 -08:00
Brian Warner
582cebfb5f rx: don't reveal file-already-exists, just reject transfer
closes #74
2016-12-08 16:59:54 -08:00
Brian Warner
ab972785aa CLI: don't emit traceback for TransferErrors
But do print the message contained therein

refs #74
2016-12-08 16:59:52 -08:00
Brian Warner
58c7639635 CLI: exit with rc=1 upon errors 2016-12-08 16:59:02 -08:00
Brian Warner
64307d3531 setup.py: require twisted[tls] to hush service-identity warning
Thanks to @grempe for the catch. Closes #89.
2016-12-07 22:13:40 -08:00
Brian Warner
4a679daa2b munin/wormhole_errors: fix mailboxes_scary
I had it in the list of configured metrics, but forgot to actually emit the
value.
2016-12-02 14:53:05 -08:00
Brian Warner
6b0ebef559 Merge PR92: use 'humanize' to abbreviate filesizes 2016-11-17 14:34:29 -08:00
Antoine Beaupré
e9cd5b5d60 fix capitalization output to match humanize 2016-11-17 11:36:00 -05:00
Antoine Beaupré
342bebbd0e use humanize library instead of custom implementation 2016-11-11 22:01:21 -05:00
Brian Warner
0ff14bf4d0 README: mention python-pip
Thanks to @grempe for the catch. Refs #89.
2016-11-11 17:06:13 -08:00
Antoine Beaupré
047af4b27d use human-readable sizes more broadly
there was a function to "abbreviate" sizes, but it was somewhat
unclear and incomplete. reuse the sizeof_fmt_* set of functions from
the borg backup project (MIT licensed) to implement a more complete
and flexible display that will scale up to the Yottabyte and
beyond. it also supports non-IEC units (like "kibibyte", AKA 1024
bytes) if you fancy that stuff.

this is a workaround for #91: it allows users to better see the size
of the file that will be transfered.

*some* places are still kept in bytes, most notably when receive fails
to receive all bytes ("got %d bytes, wanted %d") because we may want
more clarity there.

text transfers also use the "bytes" suffix (instead of "B") because it
will commonly not reach beyond the KiB range.

note that the test suite only covers decimal (non-IEC) prefix, but it
is assumed to be sufficient to be considered correct.
2016-11-09 15:14:01 -05:00
Brian Warner
007d76c145 appveyor: install tox from pypi, not git
The windows-specific bugfix we needed is now in the current Tox release,
so we no longer need pre-release code. Anyways the upstream git repo
moved (from bitbucket to github), so the install-from-bitbucket was
failing.
2016-10-28 18:33:59 -07:00
Ofekmeister
a3fc7b9402 update link to PyCon video
confirmation of re-upload
https://www.youtube.com/watch?v=dgnikoiau68&lc=z13czfvrwuepzr0jl04cezmyiznzgtohi0g.1466623963397520
2016-10-23 14:48:27 -04:00
Brian Warner
0004315431 transit: tolerate non-ascii bad handshake
I think somebody was port-scanning the server (or pointed some
non-wormhole client at it), and caused some exceptions in the logs.
These are still bad handshakes, but should be logged normally instead of
throwing exceptions.
2016-08-22 23:13:04 -07:00
Brian Warner
f246fdfa7d Merge branch 'pr78'
Closes #78
2016-08-15 17:40:09 -07:00