Browse Source

lcg 1.7.1

pull/12/head
Dan Ballard 2 months ago
parent
commit
d00f8bbee4
  1. 6
      build.rs
  2. 1
      libCwtch.h
  3. 1
      src/bindings_go.rs
  4. 3
      src/cwtchlib_go/bindings.rs
  5. 3
      src/lib.rs

6
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")[..]);
}

1
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
}

1
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);
}

3
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;
}

3
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

Loading…
Cancel
Save