mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2025-11-16 17:51:23 +10:00
@ -10,6 +10,8 @@ use std::os::fd::{AsRawFd, RawFd};
|
||||
use std::os::windows::io::{AsRawHandle, RawHandle};
|
||||
use std::os::raw::{c_char, c_int};
|
||||
mod bindings;
|
||||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
type GoInt = i64;
|
||||
|
||||
|
||||
30
src-tauri/tailscale/src/test.rs
Normal file
30
src-tauri/tailscale/src/test.rs
Normal file
@ -0,0 +1,30 @@
|
||||
use std::error::Error;
|
||||
|
||||
use crate::{Tailscale, TailscaleError};
|
||||
|
||||
#[test]
|
||||
fn start_listener() -> Result<(), TailscaleError> {
|
||||
println!("Creating server");
|
||||
// Create a new server
|
||||
let ts = Tailscale::new();
|
||||
|
||||
// Configure it
|
||||
println!("Configuring directory");
|
||||
ts.set_dir("/tmp/tailscale-rust-test")?;
|
||||
println!("Configuring hostname");
|
||||
ts.set_hostname("my-rust-node")?;
|
||||
println!("Setting ephemeral");
|
||||
//ts.set_authkey("tskey-...")?; // Set authkey if needed for auto-registration
|
||||
ts.set_ephemeral(true)?;
|
||||
|
||||
// Bring the server up
|
||||
println!("Starting Tailscale...");
|
||||
ts.up()?;
|
||||
println!("Tailscale started!");
|
||||
|
||||
// Get IPs
|
||||
let mut ip_buf = [0u8; 256];
|
||||
let ips = ts.get_ips(&mut ip_buf)?;
|
||||
println!("Tailscale IPs: {}", ips);
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user