mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-08-29 04:32:06 -04:00
chore(tailscale): Add test
Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
parent
1457a76e88
commit
f5205fb54e
2 changed files with 32 additions and 0 deletions
|
|
@ -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
desktop/src-tauri/tailscale/src/test.rs
Normal file
30
desktop/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(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue