Commit Graph

827 Commits

Author SHA1 Message Date
Brian Warner
7ddf0d3c2d server: forbid reclaiming previously-closed nameplates
at least by the same side. This forces the contour of claims (by any given
side) to be strictly unclaimed -> claimed -> released. The "claim"
action (unclaimed -> claimed) is idempotent and can be repeated arbitrarily,
as long as they happen on separate websocket connections. Likewise for the
"release" action (unclaimed -> released). But once a side releases a
nameplate, it should never roll so far back that it tries to claim it again,
especially because the first claim causes a mailbox to be allocated, and if
we manage to allocate two different mailboxes for a single nameplate, then
we've thrown idempotency out the window.
2016-12-25 20:09:55 -05:00
Brian Warner
3a4a3f544f server: make close() idempotent
refs #118
2016-12-25 20:09:52 -05:00
Brian Warner
2c8d00e436 rendezvous_websocket.py: make release() idempotent
and make it possible to call release() even though you haven't called claim()
on that particular socket (releasing a claim that was made on some previous
websocket).

This should enable reconnecting clients, as well as intermittently-connected
"offline" clients.

refs #118
2016-12-25 20:09:48 -05:00
Brian Warner
b44fcf77da test_server: improve debug message 2016-12-25 20:00:05 -05:00
Brian Warner
a746ca726a test_server: factor out common utils 2016-12-25 19:13:00 -05:00
Brian Warner
3ad29379b5 server: fix comment 2016-12-25 14:36:50 -05:00
Brian Warner
9f72b72b76 split Transit out of test_server.py 2016-12-24 17:44:40 -05:00
Brian Warner
e8d3bc9d3a NEWS: update for 0.9.0 release 2016-12-24 14:06:02 -05:00
Brian Warner
9f208ddf20 MANIFEST.in: include new files 2016-12-24 14:06:01 -05:00
Brian Warner
72dfb6eb1c write progress/status messages to stderr, not stdout
This should leave stdout clean for use in `foo | wormhole send --text=-` and
`wormhole rx CODE >foo`, although the forms that want interactive code entry
probably won't work that way.

closes #99
2016-12-24 00:03:32 -05:00
Brian Warner
64cdd426c0 README: remove the py3-daemon-is-broken message
It seems to work now, with the current Twisted (at least 16.6.0, possibly
older ones too).

closes #67
2016-12-23 23:05:46 -05:00
Brian Warner
d0830e709f Merge branch '115-transit': fix transit-relay handling
* correctly handles two peers which offer different transit relays
* handles two transit relays that actually point to the same server

closes #115
2016-12-23 22:32:17 -05:00
Brian Warner
fde98b7c7e more coverage 2016-12-23 22:22:39 -05:00
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