diff --git a/pkg/crate/libzt/src/lib.rs b/pkg/crate/libzt/src/lib.rs index e03683a..47d57bd 100644 --- a/pkg/crate/libzt/src/lib.rs +++ b/pkg/crate/libzt/src/lib.rs @@ -15,8 +15,7 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -include!(concat!("./libzt.rs")); - +pub mod libzt; pub mod node; pub mod socket; pub mod tcp; diff --git a/pkg/crate/libzt/src/node.rs b/pkg/crate/libzt/src/node.rs index 0523108..4729e41 100644 --- a/pkg/crate/libzt/src/node.rs +++ b/pkg/crate/libzt/src/node.rs @@ -15,12 +15,11 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -include!(concat!("./libzt.rs")); - +use crate::libzt::*; use std::ffi::{c_void, CStr, CString}; -use std::str::FromStr; -use std::net::{IpAddr,AddrParseError}; use std::io; +use std::net::{AddrParseError, IpAddr}; +use std::str::FromStr; extern "C" fn native_event_handler(msg: *mut c_void) { let event: &mut zts_event_msg_t = unsafe { &mut *(msg as *mut zts_event_msg_t) }; @@ -106,13 +105,13 @@ impl ZeroTierNode { unsafe { zts_util_delay(interval_ms) } } - pub fn addr_get(&self, net_id: u64) -> Result { + pub fn addr_get(&self, net_id: u64) -> Result { unsafe { let mut v = vec![0; (ZTS_INET6_ADDRSTRLEN as usize) + 1]; let ptr = v.as_mut_ptr() as *mut i8; zts_addr_get_str(net_id, ZTS_AF_INET, ptr, ZTS_INET6_ADDRSTRLEN); let c_str = CStr::from_ptr(ptr); - return IpAddr::from_str(&c_str.to_string_lossy().into_owned()) + return IpAddr::from_str(&c_str.to_string_lossy().into_owned()); } } } diff --git a/pkg/crate/libzt/src/socket.rs b/pkg/crate/libzt/src/socket.rs index c0c3225..8a38f6f 100644 --- a/pkg/crate/libzt/src/socket.rs +++ b/pkg/crate/libzt/src/socket.rs @@ -21,6 +21,7 @@ use std::{io, mem}; type time_t = i64; +use crate::libzt::*; use crate::utils::*; // Note: FileDesc and c_int in libc are private so we can't use that. Use i32 instead diff --git a/pkg/crate/libzt/src/tcp.rs b/pkg/crate/libzt/src/tcp.rs index 804fc58..a2fd4aa 100644 --- a/pkg/crate/libzt/src/tcp.rs +++ b/pkg/crate/libzt/src/tcp.rs @@ -19,6 +19,7 @@ use std::os::raw::c_int; use std::time::Duration; use std::{cmp, mem}; +use crate::libzt::*; use crate::socket::Socket; use crate::utils::*; diff --git a/pkg/crate/libzt/src/udp.rs b/pkg/crate/libzt/src/udp.rs index cf6ca5c..1d36a54 100644 --- a/pkg/crate/libzt/src/udp.rs +++ b/pkg/crate/libzt/src/udp.rs @@ -19,6 +19,7 @@ use std::os::raw::c_int; use std::time::Duration; //use std::cmp; +use crate::libzt::*; use crate::socket::Socket; use crate::utils::*; diff --git a/pkg/crate/libzt/src/utils.rs b/pkg/crate/libzt/src/utils.rs index 8ad3acd..643f916 100644 --- a/pkg/crate/libzt/src/utils.rs +++ b/pkg/crate/libzt/src/utils.rs @@ -15,8 +15,7 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] -include!(concat!("./libzt.rs")); - +use crate::libzt::*; use std::ffi::c_void; use std::io::{Error, ErrorKind}; use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs};