Commit Graph

84 Commits (6d26385ba3f42445306a1af26cd68b8cfa99f5bf)

Author SHA1 Message Date
Jake McGinty 6d26385ba3
client: re-attempt NAT traversal on all unconnected peers (#195)
fixes #173
2022-02-03 01:49:51 +09:00
Jake McGinty 110bace5c7
client: enable IPv6 NAT candidate reporting (#192) 2022-02-01 12:21:31 +09:00
Jake McGinty ddac328ae5 client: make more commands automation-friendly
Fixes #190
2022-01-31 06:10:45 +00:00
Jake McGinty e11b73972c client: stop uninstall from prompting if network doesn't exist 2022-01-24 01:46:37 +00:00
Jake McGinty 0423e78683 server: cargo fmt 2022-01-11 01:54:59 -06:00
Jake McGinty 8dd11977af meta: structopt 0.3 -> clap 3 2022-01-11 01:51:32 -06:00
Jake McGinty 09e68c2c01
(linux) wireguard-control: migrate from `wireguard-control-sys` to `netlink` crates (#177)
also introduces a new `netlink-request` crate to help modularize the netlink code. this currently depends on a fork of the `netlink` project, but we should be able to use the official version soon.
2022-01-07 18:35:21 +09:00
Jake McGinty d2a2e881e5 add warning when binary is called with 'inn' shortcut 2021-11-30 04:16:44 +09:00
Jake McGinty 2c31a4b6ec client: run 'up' on all interfaces when none is specified 2021-11-23 23:07:57 -07:00
Jake McGinty ec754e60c4 client: non-interactive `set-listen-port` and `override-endpoint`
closes #158
2021-11-16 18:46:45 +09:00
Jake McGinty ae2c554b23
{client, server}: make config/data directories configurable (#172)
* client: allow config/data dirs to be changed

* server: allow config/data dirs to be changed

* meta: cargo clippy & cargo fmt

* shared: use const for Duration instead of lazy_static
2021-11-15 18:11:13 +09:00
Jake McGinty e6f25ca1d7 docker-tests: add simultaneous peer invitation test 2021-11-12 17:53:37 +09:00
Jake McGinty d7c491c8f3 client: granular control over NAT traversal
added to `innernet {up,fetch,install}`:

  --no-nat-traversal: Doesn't attempt NAT traversal
    (prevents long time delays in execution of command)

  --exclude-nat-candidates: Exclude a list of CIDRs from being
    considered candidates

  --no-nat-candidates: Don't report NAT candidates.
    (shorthand for '--exclude-nat-candidates 0.0.0.0/0')

Closes #160
2021-11-12 14:42:10 +09:00
Jake McGinty 991c6435c1 client: wait after updating interface before attempting NAT traversal
otherwise, the server-reported IP itself won't have time to check
if a handshake succeeds or not.
2021-11-11 18:34:31 +09:00
Jake McGinty bfa5d5ee5d client: change rustdoc double-quotes to single for zsh completions.
clap (used by StructOpt) doesn't escape double-quotes inside the
rustdocs that is uses to generate completion helptext. Rather than wait
on them, it's simpler to just avoid double-quotes for now at least.

Closes #156
2021-09-21 12:46:56 +09:00
Tianon Gravi 072ac4bf96
client: fix minor typo ("exhuasted") (#155) 2021-09-18 13:16:27 +09:00
Jake McGinty ae89e06655 meta: make clippy happy 2021-09-15 21:18:04 +09:00
Jake McGinty cacd80b283 server: prompt for listen port before endpoint
also fix a logic bug if user cancels port selection in client
when trying to override endpoint.

fixes #148
2021-09-15 20:43:40 +09:00
Jake McGinty 4fa689d400 meta: rename wgctrl to wireguard-control
in preparation for publishing on crates.io
2021-09-15 12:43:20 +09:00
Jake McGinty f774a5f97c client: print endpoint reported by wireguard, not server
thanks again @strohel :)
2021-09-14 23:12:12 +09:00
Jake McGinty b179a62a22 client: always show yourself as 'conneted' to avoid confusion 2021-09-14 22:49:08 +09:00
Jake McGinty 7ceebccbfa client: fix logical inverse in is_recently_connected indicator
thanks @strohel!!
2021-09-14 22:33:49 +09:00
Jake McGinty 62821d5bdf client: update hosts even when you're the only peer on the network
Fixes #144
2021-09-14 17:57:07 +09:00
Jake McGinty cf3510918a
server: report local candidates for peers to connect (#151)
Before, only clients would report local addresses for NAT traversal. Servers should too! This will be helpful in common situations when the server is run inside the same LAN as other peers, and there's no NAT hairpinning enabled (or possible) on the router.

closes #146
2021-09-14 15:48:27 +09:00
Jake McGinty c618d7949b meta: cargo update && cargo fmt 2021-09-13 00:48:49 +09:00
Jake McGinty 42eb0a7589 client: wait for newline for uninstall
fixes #145
2021-09-13 00:46:06 +09:00
Jake McGinty 2a5a820bc2 client: create new data stores with 600 permissions
fixes #147
2021-09-13 00:43:53 +09:00
Jake McGinty f715689540 shared(wg): remove leftover debug println on macOS
Closes #143
2021-09-12 20:34:02 +09:00
Jake McGinty 20a07cf8fd client: don't show Linux instructions outside of linux
fixes #128
2021-09-05 16:37:58 +09:00
Jake McGinty b7de9cdc47
fix SQLite bug when migrating database from 1 to 2 (#136) 2021-09-02 02:25:34 +09:00
Jake McGinty 8903604caa
NAT traversal: ICE-esque candidate selection (#134)
This change adds the ability for peers to report additional candidate endpoints for other peers to attempt connections with outside of the endpoint reported by the coordinating server.

While not a complete solution to the full spectrum of NAT traversal issues (TURN-esque proxying is still notably missing), it allows peers within the same NAT to connect to each other via their LAN addresses, which is a win nonetheless. In the future, more advanced candidate discovery could be used to punch through additional types of NAT cone types as well.

Co-authored-by: Matěj Laitl <matej@laitl.cz>
2021-09-01 18:58:46 +09:00
Matěj Laitl eb90cc53a5
Fix clippy warnings, add clippy to CI (#127)
* Tidy code a bit thanks to clippy

Clippy 1.54 newly detects some redundant constructs, that's nice.

sort_unstable() should yield exact same results as sort() for `Vec<&str>`
and could be faster, clippy says.

* Add clippy to CI
2021-08-09 20:35:42 +09:00
Jake McGinty e97eb737a4
shared(PeerDiff): refactor struct and update peer endpoints only when handshake failed
The past behavior of clients was to, on every fetch from the server, update each of its peer's endpoints with the one reported from the server. While this wasn't a problem on certain types of NATs to help with holepunching, in some situations it caused previously working connections to no longer work (when one peer had a port-restricted or symmetric cone type NAT).
2021-08-05 09:38:14 +09:00
Jake McGinty 89f2e813cf client(install): fix install check failure when /var/run/wireguard doesn't exist 2021-08-03 00:44:06 +09:00
Jake McGinty 82325509db meta: cargo clippy & fmt 2021-08-02 23:10:20 +09:00
Jake McGinty 61b055c44b client(install): bail if WireGuard interface with same name exists
Closes #113
2021-08-02 23:07:45 +09:00
Jake McGinty bbfb11e175 meta: cargo update & clippy fixes 2021-07-27 14:14:50 +09:00
Jake McGinty 26b962bea0 client: add debug info for peer endpoint changes on update 2021-07-15 15:54:31 +09:00
Jake McGinty 0c8a2ee991 meta: cargo clippy 2021-06-22 11:27:29 +09:00
Jake McGinty 7bc1033b58 meta: cargo clippy 2021-06-16 20:34:53 +09:00
Jake McGinty 1aed782683 client: tighten some error types and apply helptext to io::Error 2021-06-16 20:26:01 +09:00
Jake McGinty 2fa7524def client: add list-cidrs function
Closes #99
2021-06-14 18:50:21 +09:00
Jake McGinty 647ec7ca3e shared: proactively create invite file to ensure we have permission
This won't clean up an empty file if a later step fails, but this
is still better than the previous solution.

Closes #91
2021-06-14 18:15:31 +09:00
Jake McGinty 449b4b8278
client: support running as non-root (#94)
shared(wg): use netlink instead of execve calls to "ip"
hostsfile: write to hostsfile in-place
2021-06-10 22:57:47 +09:00
Jake McGinty b7f299c147 meta: cargo update & clippy 2021-06-01 00:22:48 +09:00
Jake McGinty 042881cc7d client, server: don't require root for completions command 2021-06-01 00:18:56 +09:00
Jake McGinty 9524019c55 client, server: make clap's helptext a bit friendlier 2021-05-26 14:23:02 +09:00
Kevin K ec210f9468
client, server: adds ability to rename peers (#92)
This commit adds a subcommand to both the client and server to allow
changing the name of a peer. The peer retains all the same attributes as
before (public keys, IPs, admin/disabled status, etc.).

Closes #87
2021-05-25 19:58:00 +09:00
Kevin K 4226278e5a
client, server: add shell completions (#84)
This subcommand takes a shell as an argument and generates shell
completions for that shell to stdout.

example:

```
$ innernet completions bash
  OR
$ innernet-server completions bash
```
2021-05-25 16:10:16 +09:00
Jake McGinty fed0c859c8 meta: cargo update & fmt 2021-05-21 13:35:52 +09:00