diff --git a/build.rs b/build.rs index 6e52ea4..9d44387 100644 --- a/build.rs +++ b/build.rs @@ -15,9 +15,9 @@ fn main() { println!("cargo:rerun-if-changed=libCwtch.h"); let lib_cwtch_path = Path::new(&out_dir).join("libCwtch.so"); - // https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases v1.7.0 + // https://git.openprivacy.ca/cwtch.im/libcwtch-go/releases v1.7.1 Command::new("wget") - .arg("https://git.openprivacy.ca/attachments/390d383b-ab02-489b-b5c9-e62267d8b3fd") + .arg("https://git.openprivacy.ca/attachments/98184e9c-1dc7-431a-9601-91a9e763e8fc") .arg("-O") .arg(lib_cwtch_path) .output() @@ -29,5 +29,5 @@ fn main() { io::copy(&mut file, &mut hasher).expect("failed to copy file into hasher"); let hash_bytes = hasher.finalize(); - assert_eq!(hash_bytes[..], hex!("271c281bad59696fc4ea5e559b5d3fe5c1949384c26dd891dde91b0af0a012e30bdbc3b16781ec5de795d2945e2f42415a8985451b49394b3c85c412ab4769d3")[..]); + assert_eq!(hash_bytes[..], hex!("cb4368d72a46f8046261c50e6e9ecf170d8e606871d5de2c1e9e34303533c344f92f5d946d7e12614581dfa3ae8e638512af7f4623ed91b1ceb1570de14bf192")[..]); } diff --git a/libCwtch.h b/libCwtch.h index 0730fb6..f30c8cf 100644 --- a/libCwtch.h +++ b/libCwtch.h @@ -122,6 +122,7 @@ extern void c_StopServer(char* onionPtr, int onionLen); extern void c_StopServers(); extern void c_DestroyServers(); extern void c_SetServerAttribute(char* onionPtr, int onionLen, char* keyPtr, int keyLen, char* valPtr, int valLen); +extern char* c_GetDebugInfo(); #ifdef __cplusplus } diff --git a/src/bindings_go.rs b/src/bindings_go.rs index 2a36a1d..f3ad8f7 100644 --- a/src/bindings_go.rs +++ b/src/bindings_go.rs @@ -163,4 +163,5 @@ impl CwtchLib for CwtchLibGo { c_bind!(stop_servers(;;) c_StopServers); c_bind!(destroy_servers(;;) c_DestroyServers); c_bind!(set_server_attribute(onion: &str, key: &str, val: &str;;) c_SetServerAttribute); + c_bind!(get_debug_info(;;) c_GetDebugInfo -> String); } diff --git a/src/cwtchlib_go/bindings.rs b/src/cwtchlib_go/bindings.rs index 64d0189..29d11ac 100644 --- a/src/cwtchlib_go/bindings.rs +++ b/src/cwtchlib_go/bindings.rs @@ -529,3 +529,6 @@ extern "C" { valLen: ::std::os::raw::c_int, ); } +extern "C" { + pub fn c_GetDebugInfo() -> *mut ::std::os::raw::c_char; +} diff --git a/src/lib.rs b/src/lib.rs index 5f11af9..b84271e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -167,6 +167,9 @@ pub trait CwtchLib { /// Set the specified server's attribute of key to val fn set_server_attribute(&self, onion: &str, key: &str, val: &str); + + /// Get debug info (mem, goroutine stats) from lcg in json + fn get_debug_info(&self) -> String; } /// Create a new CwtchLib that is backed by bindings to libcwtch-go