Commit Graph

14 Commits (68df16126443485965787235aea81e9f6ad52cc1)

Author SHA1 Message Date
Eva Pace de7ec99ad9
Optimize /etc/hosts writes (#259)
* hostsfile: change internal map from hash to btree

This change makes the innernet section of /etc/hosts always ordered and
deterministic. We can take advantage of that to avoid writes, that will
be done in another commit.

* hostsfile: reduce number of writes if content hasn't changed

* hostsfile: return bool to inform if file has been written

This commit also makes the logs print accordingly to the new behavior.

* hostsfile: remove has_content_changed in favor of comparing old and new sections

* hostsfile: print the correct hosts path in log message

* hostsfile: remove unnecessary intermediate variable
2023-06-02 08:42:54 +02:00
Matěj Laitl 0dc92de722 Auto-apply clippy lint fixes from Rust 1.67 2023-02-05 03:13:54 +09:00
Matěj Laitl 2859684864 cargo clippy --fix --all-targets (clippy 1.66)
This is exclusively (if I look correctly) redundant referencing.
2023-01-03 22:42:50 +01:00
Jake McGinty b39b77aa5a meta: appease clippy 2022-09-23 23:43:33 -04:00
Jake McGinty 050ce1362a meta: fix new cargo clippy warnings 2022-02-01 04:20:21 +09:00
Jake McGinty d796cb54bf
hostsfile: safely overwrite hosts file instead of clobbering (#186)
fixes #183
2022-01-22 16:24:44 +09:00
Jake McGinty 5c72592069 meta: rust edition 2018 -> 2021 2022-01-11 01:54:43 -06:00
Jake McGinty 72ef070ef3 shared(prompts): fail on no TTY if interactivity was needed
Fixes #98
2021-06-14 15:52:15 +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
Johann150 7d3529f600
hostsfile: support Windows (#79)
Windows has some peculiarities for example it only allows one hostname per line
and the file's location depends on an environment variable. Although in most
cases just using C:\Windows\ for %WinDir% would probably work.

Note that editing the hosts file on Windows will require running with elevated
privileges ("Run as Administrator") and in some cases also antivirus may block
access to the file.
2021-05-20 00:23:56 +09:00
Jake McGinty f27a2426c8 client: make clippy happy 2021-05-06 12:40:00 +09:00
Jake McGinty 4ec2f4099b hostsfile: v1.0.1 2021-04-08 10:46:49 +09:00
Jake McGinty 296cd7b496
client: changeable hosts file settings
Introduces `--hosts-path [PATH]` and `--no-write-hosts` options in `innernet`.

This could be further improved to have a persistent setting in a config file i.e. /etc/innernet.conf (which doesn't currently exist).

Fixes #6
2021-04-07 17:00:52 +09:00
Jake McGinty c49f061bb7 kabloomers. public release v1.0.0 2021-03-30 02:47:34 +09:00