Compare commits

...

10 Commits
v0.1.6 ... main

Author SHA1 Message Date
_ 2cc1ed4a92 ⬆️ use directories v5.0.0 instead of vendoring it 2023-03-31 05:45:40 +00:00
Reactor Scram bd73d832fa
Update rust.yml
Finally read the part that says "this is deprecated use the thing GitHub has built in"

frik
2021-12-16 16:14:07 -06:00
Reactor Scram fd43fbbb1e
Update rust.yml 2021-12-16 16:12:46 -06:00
Reactor Scram 97d7d000dc
Update rust.yml
oof
2021-12-16 16:11:11 -06:00
Reactor Scram bda991bc67
Update rust.yml
you are getting to watch a perma-noob learn about CI in real time, this is special
2021-12-16 15:56:34 -06:00
Reactor Scram ed816a0d6f
Update rust.yml 2021-12-16 15:50:45 -06:00
_ b05a87cc9c use `config_local_dir` 2021-12-16 21:47:12 +00:00
_ 354a74aeaa vendor my fork of `directories`.
I'll swap back to the crates.io version if `config_local_dir` is merged
upstream, or if it times out I'll fork it.
2021-12-16 21:46:25 +00:00
_ d9fd0fd29d 🚧 wip: working on avalanche idea to make MACs easier for humans to read 2021-12-16 20:51:44 +00:00
_ f121e3fd55 📝 add idea 2021-12-13 00:25:15 +00:00
9 changed files with 150 additions and 16 deletions

View File

@ -15,7 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Build
run: cargo build --verbose
- name: Run tests

0
.gitmodules vendored Normal file
View File

107
Cargo.lock generated
View File

@ -4,9 +4,9 @@ version = 3
[[package]]
name = "autocfg"
version = "1.0.1"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
@ -34,22 +34,22 @@ checksum = "06821ea598337a8412cf47c5b71c3bc694a7f0aed188ac28b836fab164a2c202"
[[package]]
name = "directories"
version = "4.0.1"
version = "5.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210"
checksum = "74be3be809c18e089de43bdc504652bb2bc473fca8756131f8689db8cf079ba9"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.3.6"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03d86534ed367a67548dc68113a0f5db55432fdfbb6e6f9d77704397d95d5780"
checksum = "04414300db88f70d74c5ff54e50f9e1d1737d9a5b90f53fcf2e95ca2a9ab554b"
dependencies = [
"libc",
"redox_users",
"winapi",
"windows-sys",
]
[[package]]
@ -65,9 +65,9 @@ dependencies = [
[[package]]
name = "libc"
version = "0.2.109"
version = "0.2.135"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f98a04dce437184842841303488f70d0188c5f51437d2a834dc097eafa909a01"
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
[[package]]
name = "log"
@ -85,6 +85,7 @@ dependencies = [
"configparser",
"directories",
"mac_address",
"nix 0.25.0",
"rand",
"thiserror",
"tokio",
@ -96,7 +97,7 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89544d9544366f6cda81244514a80809b137b5a179947b73bfa9f2797480de69"
dependencies = [
"nix",
"nix 0.22.2",
"winapi",
]
@ -144,6 +145,20 @@ dependencies = [
"memoffset",
]
[[package]]
name = "nix"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e322c04a9e3440c327fca7b6c8a63e6890a32fa2ad689db972425f07e0d22abb"
dependencies = [
"autocfg",
"bitflags",
"cfg-if",
"libc",
"memoffset",
"pin-utils",
]
[[package]]
name = "ntapi"
version = "0.3.6"
@ -159,6 +174,12 @@ version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
[[package]]
name = "pin-utils"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "ppv-lite86"
version = "0.2.15"
@ -319,3 +340,69 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
[[package]]
name = "windows_i686_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
[[package]]
name = "windows_i686_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"

View File

@ -13,8 +13,9 @@ version = "0.1.6"
[dependencies]
configparser = "3.0.0"
directories = "4.0.1"
directories = "5.0.0"
mac_address = "1.1.2"
nix = "0.25.0"
rand = "0.8.4"
thiserror = "1.0.30"
tokio = { version = "1.14.0", features = ["fs", "net", "rt", "time"] }

View File

@ -1,5 +1,6 @@
Cool ideas that can be done but probably won't be.
- Arbitrary TCP forwarding of (stdin? stdout? TCP?)
- Advertise TCP services in server response
- Arbitrary TCP forwarding of (stdin? stdout? TCP?) with interface cutover
- Netcat replacement "Just send a file" _including filename_
- Public-key crypto for trusting peers on first use (Hard cause it requires mutable disk state)

40
src/avalanche.rs Normal file
View File

@ -0,0 +1,40 @@
type Mac = [u8; 6];
pub fn debug () {
for input in [
[0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0],
[1, 0, 0, 0, 0, 1],
] {
assert_eq! (unmix (mix (input)), input);
}
println! ("Passed");
}
// NOT intended for any cryptography or security. This is TRIVIALLY reversible.
// It's just to make it easier for humans to tell apart MACs where only a couple
// numbers differ.
fn mix (i: Mac) -> Mac {
[
i [0] ^ i [5],
i [1] ^ i [4],
i [2] ^ i [3],
i [3],
i [4],
i [5],
]
}
fn unmix (i: Mac) -> Mac {
[
i [0] ^ i [5],
i [1] ^ i [4],
i [2] ^ i [3],
i [3],
i [4],
i [5],
]
}

View File

@ -165,7 +165,7 @@ fn load_config_file () -> ConfigFile {
if let Some (proj_dirs) = find_project_dirs () {
let mut ini = Ini::new_cs ();
let path = proj_dirs.config_dir ().join ("client.ini");
let path = proj_dirs.config_local_dir ().join ("client.ini");
if ini.load (&path).is_ok () {
let map_ref = ini.get_map_ref ();
if let Some (x) = map_ref.get ("nicknames") {

View File

@ -1,6 +1,7 @@
use prelude::*;
pub mod app_common;
mod avalanche;
mod client;
mod ip;
pub mod message;
@ -31,6 +32,7 @@ async fn async_main () -> Result <(), AppError> {
Some ("--version") => println! ("lookaround v{}", LOOKAROUND_VERSION),
Some ("client") => client::client (args).await?,
Some ("config") => config (),
Some ("debug-avalanche") => avalanche::debug (),
Some ("find-nick") => client::find_nick (args).await?,
Some ("my-ips") => my_ips ()?,
Some ("server") => server::server (args).await?,
@ -42,7 +44,7 @@ async fn async_main () -> Result <(), AppError> {
fn config () {
if let Some (proj_dirs) = ProjectDirs::from ("", "ReactorScram", "LookAround") {
println! ("Using config dir {:?}", proj_dirs.config_dir ());
println! ("Using config dir {:?}", proj_dirs.config_local_dir ());
}
else {
println! ("Can't detect config dir.");

View File

@ -41,7 +41,7 @@ fn configure <I: Iterator <Item=String>> (mut args: I) -> Result <Params, AppErr
if let Some (proj_dirs) = find_project_dirs () {
let mut ini = Ini::new_cs ();
let path = proj_dirs.config_dir ().join ("server.ini");
let path = proj_dirs.config_local_dir ().join ("server.ini");
if ini.load (&path).is_ok () {
if let Some (x) = ini.get ("server", "nickname") {
nickname = x;