From 02edb2cbc1ef48ebb173b28b8a2b8348be5ebaab Mon Sep 17 00:00:00 2001 From: DecDuck Date: Wed, 14 May 2025 10:01:26 +1000 Subject: [PATCH] chore: libtailscale rust build --- .gitmodules | 3 + src-tauri/Cargo.lock | 80 ++++++++ src-tauri/Cargo.toml | 1 + src-tauri/src/lib.rs | 1 - src-tauri/tailscale/.gitignore | 7 + src-tauri/tailscale/Cargo.lock | 293 +++++++++++++++++++++++++++ src-tauri/tailscale/Cargo.toml | 10 + src-tauri/tailscale/build.rs | 36 ++++ src-tauri/tailscale/libtailscale | 1 + src-tauri/tailscale/src/bindings.rs | 301 ++++++++++++++++++++++++++++ src-tauri/tailscale/src/lib.rs | 5 + 11 files changed, 737 insertions(+), 1 deletion(-) create mode 100644 src-tauri/tailscale/.gitignore create mode 100644 src-tauri/tailscale/Cargo.lock create mode 100644 src-tauri/tailscale/Cargo.toml create mode 100644 src-tauri/tailscale/build.rs create mode 160000 src-tauri/tailscale/libtailscale create mode 100644 src-tauri/tailscale/src/bindings.rs create mode 100644 src-tauri/tailscale/src/lib.rs diff --git a/.gitmodules b/.gitmodules index 5b83040..8468694 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "drop-base"] path = drop-base url = https://github.com/drop-oss/drop-base +[submodule "src-tauri/tailscale/libtailscale"] + path = src-tauri/tailscale/libtailscale + url = https://github.com/tailscale/libtailscale.git diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index fc7f37e..19bab31 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2,6 +2,12 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "abs-file-macro" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3909701959b9fcb4d065c3cf3044fe77f6b07a85d748be4630f5214e8d7acc1" + [[package]] name = "addr2line" version = "0.24.2" @@ -458,6 +464,26 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.71.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.91", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -750,6 +776,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + [[package]] name = "cfb" version = "0.7.3" @@ -798,6 +833,17 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading 0.8.6", +] + [[package]] name = "cocoa" version = "0.26.0" @@ -1339,6 +1385,7 @@ dependencies = [ "serde_with", "shared_child", "slice-deque", + "tailscale", "tauri", "tauri-build", "tauri-plugin-autostart", @@ -2645,6 +2692,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.8" @@ -4000,6 +4056,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "prettyplease" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +dependencies = [ + "proc-macro2", + "syn 2.0.91", +] + [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -4505,6 +4571,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + [[package]] name = "rustc_version" version = "0.4.1" @@ -5309,6 +5381,14 @@ dependencies = [ "version-compare", ] +[[package]] +name = "tailscale" +version = "0.1.0" +dependencies = [ + "abs-file-macro", + "bindgen", +] + [[package]] name = "tao" version = "0.30.8" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index a3dcf35..bc1b8f0 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -60,6 +60,7 @@ droplet-rs = "0.7.3" gethostname = "1.0.1" native_db = "0.8.1" native_model = "0.6.1" +tailscale = { path = "./tailscale" } [dependencies.dynfmt] version = "0.1.5" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index ae693e4..d399a35 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -288,7 +288,6 @@ pub fn run() { debug!("initialized drop client"); app.manage(Mutex::new(state)); - #[cfg(any(target_os = "linux", all(debug_assertions, windows)))] { use tauri_plugin_deep_link::DeepLinkExt; app.deep_link().register_all()?; diff --git a/src-tauri/tailscale/.gitignore b/src-tauri/tailscale/.gitignore new file mode 100644 index 0000000..b21bd68 --- /dev/null +++ b/src-tauri/tailscale/.gitignore @@ -0,0 +1,7 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ + +# Generated by Tauri +# will have schema files for capabilities auto-completion +/gen/schemas diff --git a/src-tauri/tailscale/Cargo.lock b/src-tauri/tailscale/Cargo.lock new file mode 100644 index 0000000..ae7b7f6 --- /dev/null +++ b/src-tauri/tailscale/Cargo.lock @@ -0,0 +1,293 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "abs-file-macro" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3909701959b9fcb4d065c3cf3044fe77f6b07a85d748be4630f5214e8d7acc1" + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "bindgen" +version = "0.71.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn", +] + +[[package]] +name = "bitflags" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "libc" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "libloading" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a793df0d7afeac54f95b471d3af7f0d4fb975699f972341a4b76988d49cdf0c" +dependencies = [ + "cfg-if", + "windows-targets", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "prettyplease" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "664ec5419c51e34154eec046ebcba56312d5a2fc3b09a06da188e1ad21afadf6" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "syn" +version = "2.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tailscale" +version = "0.1.0" +dependencies = [ + "abs-file-macro", + "bindgen", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "windows-targets" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" diff --git a/src-tauri/tailscale/Cargo.toml b/src-tauri/tailscale/Cargo.toml new file mode 100644 index 0000000..3b42cd0 --- /dev/null +++ b/src-tauri/tailscale/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "tailscale" +version = "0.1.0" +edition = "2024" + +[dependencies] + +[build-dependencies] +bindgen = "*" +abs-file-macro = "0.1.2" diff --git a/src-tauri/tailscale/build.rs b/src-tauri/tailscale/build.rs new file mode 100644 index 0000000..2ac1c0c --- /dev/null +++ b/src-tauri/tailscale/build.rs @@ -0,0 +1,36 @@ +extern crate bindgen; + +use abs_file_macro::abs_file; +use std::path::PathBuf; +use std::process::Command; + +fn main() { + let build_folder = PathBuf::from(abs_file!()); + let build_folder = build_folder.parent().unwrap(); + + let in_path = build_folder.join("libtailscale"); + let out_path = build_folder.join("src/"); + + let mut make_cmd = Command::new("make"); + make_cmd.arg("c-archive"); + make_cmd.current_dir(in_path.clone()); + + make_cmd.status().expect("Make build failed"); + + let bindings = bindgen::Builder::default() + .header(in_path.join("libtailscale.h").to_str().unwrap()) + .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())) + .generate() + .expect("Unable to generate bindings"); + + bindings + .write_to_file(out_path.join("bindings.rs")) + .expect("Couldn't write bindings!"); + + println!("cargo:rerun-if-changed=libtailscale/tailscale.go"); + println!( + "cargo:rustc-link-search=native={}", + in_path.to_str().unwrap() + ); + println!("cargo:rustc-link-lib=static={}", "tailscale"); +} diff --git a/src-tauri/tailscale/libtailscale b/src-tauri/tailscale/libtailscale new file mode 160000 index 0000000..78294ac --- /dev/null +++ b/src-tauri/tailscale/libtailscale @@ -0,0 +1 @@ +Subproject commit 78294ac1d6d9644e051905673561a906bb9f138d diff --git a/src-tauri/tailscale/src/bindings.rs b/src-tauri/tailscale/src/bindings.rs new file mode 100644 index 0000000..8091375 --- /dev/null +++ b/src-tauri/tailscale/src/bindings.rs @@ -0,0 +1,301 @@ +/* automatically generated by rust-bindgen 0.71.1 */ + +#[derive(PartialEq, Copy, Clone, Hash, Debug, Default)] +#[repr(C)] +pub struct __BindgenComplex { + pub re: T, + pub im: T, +} +pub const __has_safe_buffers: u32 = 1; +pub const __DARWIN_ONLY_64_BIT_INO_T: u32 = 1; +pub const __DARWIN_ONLY_UNIX_CONFORMANCE: u32 = 1; +pub const __DARWIN_ONLY_VERS_1050: u32 = 1; +pub const __DARWIN_UNIX03: u32 = 1; +pub const __DARWIN_64_BIT_INO_T: u32 = 1; +pub const __DARWIN_VERS_1050: u32 = 1; +pub const __DARWIN_NON_CANCELABLE: u32 = 0; +pub const __DARWIN_SUF_EXTSN: &[u8; 14] = b"$DARWIN_EXTSN\0"; +pub const __DARWIN_C_ANSI: u32 = 4096; +pub const __DARWIN_C_FULL: u32 = 900000; +pub const __DARWIN_C_LEVEL: u32 = 900000; +pub const __STDC_WANT_LIB_EXT1__: u32 = 1; +pub const __DARWIN_NO_LONG_LONG: u32 = 0; +pub const _DARWIN_FEATURE_64_BIT_INODE: u32 = 1; +pub const _DARWIN_FEATURE_ONLY_64_BIT_INODE: u32 = 1; +pub const _DARWIN_FEATURE_ONLY_VERS_1050: u32 = 1; +pub const _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE: u32 = 1; +pub const _DARWIN_FEATURE_UNIX_CONFORMANCE: u32 = 3; +pub const __has_ptrcheck: u32 = 0; +pub const __has_bounds_safety_attributes: u32 = 0; +pub const EPERM: u32 = 1; +pub const ENOENT: u32 = 2; +pub const ESRCH: u32 = 3; +pub const EINTR: u32 = 4; +pub const EIO: u32 = 5; +pub const ENXIO: u32 = 6; +pub const E2BIG: u32 = 7; +pub const ENOEXEC: u32 = 8; +pub const EBADF: u32 = 9; +pub const ECHILD: u32 = 10; +pub const EDEADLK: u32 = 11; +pub const ENOMEM: u32 = 12; +pub const EACCES: u32 = 13; +pub const EFAULT: u32 = 14; +pub const ENOTBLK: u32 = 15; +pub const EBUSY: u32 = 16; +pub const EEXIST: u32 = 17; +pub const EXDEV: u32 = 18; +pub const ENODEV: u32 = 19; +pub const ENOTDIR: u32 = 20; +pub const EISDIR: u32 = 21; +pub const EINVAL: u32 = 22; +pub const ENFILE: u32 = 23; +pub const EMFILE: u32 = 24; +pub const ENOTTY: u32 = 25; +pub const ETXTBSY: u32 = 26; +pub const EFBIG: u32 = 27; +pub const ENOSPC: u32 = 28; +pub const ESPIPE: u32 = 29; +pub const EROFS: u32 = 30; +pub const EMLINK: u32 = 31; +pub const EPIPE: u32 = 32; +pub const EDOM: u32 = 33; +pub const ERANGE: u32 = 34; +pub const EAGAIN: u32 = 35; +pub const EWOULDBLOCK: u32 = 35; +pub const EINPROGRESS: u32 = 36; +pub const EALREADY: u32 = 37; +pub const ENOTSOCK: u32 = 38; +pub const EDESTADDRREQ: u32 = 39; +pub const EMSGSIZE: u32 = 40; +pub const EPROTOTYPE: u32 = 41; +pub const ENOPROTOOPT: u32 = 42; +pub const EPROTONOSUPPORT: u32 = 43; +pub const ESOCKTNOSUPPORT: u32 = 44; +pub const ENOTSUP: u32 = 45; +pub const EPFNOSUPPORT: u32 = 46; +pub const EAFNOSUPPORT: u32 = 47; +pub const EADDRINUSE: u32 = 48; +pub const EADDRNOTAVAIL: u32 = 49; +pub const ENETDOWN: u32 = 50; +pub const ENETUNREACH: u32 = 51; +pub const ENETRESET: u32 = 52; +pub const ECONNABORTED: u32 = 53; +pub const ECONNRESET: u32 = 54; +pub const ENOBUFS: u32 = 55; +pub const EISCONN: u32 = 56; +pub const ENOTCONN: u32 = 57; +pub const ESHUTDOWN: u32 = 58; +pub const ETOOMANYREFS: u32 = 59; +pub const ETIMEDOUT: u32 = 60; +pub const ECONNREFUSED: u32 = 61; +pub const ELOOP: u32 = 62; +pub const ENAMETOOLONG: u32 = 63; +pub const EHOSTDOWN: u32 = 64; +pub const EHOSTUNREACH: u32 = 65; +pub const ENOTEMPTY: u32 = 66; +pub const EPROCLIM: u32 = 67; +pub const EUSERS: u32 = 68; +pub const EDQUOT: u32 = 69; +pub const ESTALE: u32 = 70; +pub const EREMOTE: u32 = 71; +pub const EBADRPC: u32 = 72; +pub const ERPCMISMATCH: u32 = 73; +pub const EPROGUNAVAIL: u32 = 74; +pub const EPROGMISMATCH: u32 = 75; +pub const EPROCUNAVAIL: u32 = 76; +pub const ENOLCK: u32 = 77; +pub const ENOSYS: u32 = 78; +pub const EFTYPE: u32 = 79; +pub const EAUTH: u32 = 80; +pub const ENEEDAUTH: u32 = 81; +pub const EPWROFF: u32 = 82; +pub const EDEVERR: u32 = 83; +pub const EOVERFLOW: u32 = 84; +pub const EBADEXEC: u32 = 85; +pub const EBADARCH: u32 = 86; +pub const ESHLIBVERS: u32 = 87; +pub const EBADMACHO: u32 = 88; +pub const ECANCELED: u32 = 89; +pub const EIDRM: u32 = 90; +pub const ENOMSG: u32 = 91; +pub const EILSEQ: u32 = 92; +pub const ENOATTR: u32 = 93; +pub const EBADMSG: u32 = 94; +pub const EMULTIHOP: u32 = 95; +pub const ENODATA: u32 = 96; +pub const ENOLINK: u32 = 97; +pub const ENOSR: u32 = 98; +pub const ENOSTR: u32 = 99; +pub const EPROTO: u32 = 100; +pub const ETIME: u32 = 101; +pub const EOPNOTSUPP: u32 = 102; +pub const ENOPOLICY: u32 = 103; +pub const ENOTRECOVERABLE: u32 = 104; +pub const EOWNERDEAD: u32 = 105; +pub const EQFULL: u32 = 106; +pub const ELAST: u32 = 106; +pub type wchar_t = ::std::os::raw::c_int; +pub type max_align_t = f64; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct _GoString_ { + pub p: *const ::std::os::raw::c_char, + pub n: isize, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of _GoString_"][::std::mem::size_of::<_GoString_>() - 16usize]; + ["Alignment of _GoString_"][::std::mem::align_of::<_GoString_>() - 8usize]; + ["Offset of field: _GoString_::p"][::std::mem::offset_of!(_GoString_, p) - 0usize]; + ["Offset of field: _GoString_::n"][::std::mem::offset_of!(_GoString_, n) - 8usize]; +}; +pub type errno_t = ::std::os::raw::c_int; +unsafe extern "C" { + pub fn __error() -> *mut ::std::os::raw::c_int; +} +pub type GoInt8 = ::std::os::raw::c_schar; +pub type GoUint8 = ::std::os::raw::c_uchar; +pub type GoInt16 = ::std::os::raw::c_short; +pub type GoUint16 = ::std::os::raw::c_ushort; +pub type GoInt32 = ::std::os::raw::c_int; +pub type GoUint32 = ::std::os::raw::c_uint; +pub type GoInt64 = ::std::os::raw::c_longlong; +pub type GoUint64 = ::std::os::raw::c_ulonglong; +pub type GoInt = GoInt64; +pub type GoUint = GoUint64; +pub type GoUintptr = usize; +pub type GoFloat32 = f32; +pub type GoFloat64 = f64; +pub type GoComplex64 = __BindgenComplex; +pub type GoComplex128 = __BindgenComplex; +pub type _check_for_64_bit_pointer_matching_GoInt = [::std::os::raw::c_char; 1usize]; +pub type GoString = _GoString_; +pub type GoMap = *mut ::std::os::raw::c_void; +pub type GoChan = *mut ::std::os::raw::c_void; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct GoInterface { + pub t: *mut ::std::os::raw::c_void, + pub v: *mut ::std::os::raw::c_void, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of GoInterface"][::std::mem::size_of::() - 16usize]; + ["Alignment of GoInterface"][::std::mem::align_of::() - 8usize]; + ["Offset of field: GoInterface::t"][::std::mem::offset_of!(GoInterface, t) - 0usize]; + ["Offset of field: GoInterface::v"][::std::mem::offset_of!(GoInterface, v) - 8usize]; +}; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct GoSlice { + pub data: *mut ::std::os::raw::c_void, + pub len: GoInt, + pub cap: GoInt, +} +#[allow(clippy::unnecessary_operation, clippy::identity_op)] +const _: () = { + ["Size of GoSlice"][::std::mem::size_of::() - 24usize]; + ["Alignment of GoSlice"][::std::mem::align_of::() - 8usize]; + ["Offset of field: GoSlice::data"][::std::mem::offset_of!(GoSlice, data) - 0usize]; + ["Offset of field: GoSlice::len"][::std::mem::offset_of!(GoSlice, len) - 8usize]; + ["Offset of field: GoSlice::cap"][::std::mem::offset_of!(GoSlice, cap) - 16usize]; +}; +unsafe extern "C" { + pub fn TsnetNewServer() -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetStart(sd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetUp(sd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetClose(sd: ::std::os::raw::c_int) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetGetIps( + sd: ::std::os::raw::c_int, + buf: *mut ::std::os::raw::c_char, + buflen: usize, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetErrmsg( + sd: ::std::os::raw::c_int, + buf: *mut ::std::os::raw::c_char, + buflen: usize, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetListen( + sd: ::std::os::raw::c_int, + network: *mut ::std::os::raw::c_char, + addr: *mut ::std::os::raw::c_char, + listenerOut: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetGetRemoteAddr( + listener: ::std::os::raw::c_int, + conn: ::std::os::raw::c_int, + buf: *mut ::std::os::raw::c_char, + buflen: usize, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetDial( + sd: ::std::os::raw::c_int, + network: *mut ::std::os::raw::c_char, + addr: *mut ::std::os::raw::c_char, + connOut: *mut ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetSetDir( + sd: ::std::os::raw::c_int, + str_: *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetSetHostname( + sd: ::std::os::raw::c_int, + str_: *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetSetAuthKey( + sd: ::std::os::raw::c_int, + str_: *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetSetControlURL( + sd: ::std::os::raw::c_int, + str_: *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetSetEphemeral(sd: ::std::os::raw::c_int, e: GoInt) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetSetLogFD( + sd: ::std::os::raw::c_int, + fd: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetLoopback( + sd: ::std::os::raw::c_int, + addrOut: *mut ::std::os::raw::c_char, + addrLen: usize, + proxyOut: *mut ::std::os::raw::c_char, + localOut: *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn TsnetEnableFunnelToLocalhostPlaintextHttp1( + sd: ::std::os::raw::c_int, + localhostPort: ::std::os::raw::c_int, + ) -> ::std::os::raw::c_int; +} diff --git a/src-tauri/tailscale/src/lib.rs b/src-tauri/tailscale/src/lib.rs new file mode 100644 index 0000000..4540762 --- /dev/null +++ b/src-tauri/tailscale/src/lib.rs @@ -0,0 +1,5 @@ +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +pub mod bindings;