Change lox package to lox-library for consistency
This commit is contained in:
parent
221f490d26
commit
73c3ef8728
|
@ -849,7 +849,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de"
|
||||
|
||||
[[package]]
|
||||
name = "lox"
|
||||
name = "lox-distributor"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"chrono",
|
||||
"futures",
|
||||
"hex_fmt",
|
||||
"hyper",
|
||||
"julianday",
|
||||
"lox-library",
|
||||
"lox_utils",
|
||||
"rand 0.8.5",
|
||||
"rdsys_backend",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"time 0.3.21",
|
||||
"tokio",
|
||||
"zkp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lox-library"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"aes-gcm",
|
||||
|
@ -866,32 +888,11 @@ dependencies = [
|
|||
"sha2",
|
||||
"statistical",
|
||||
"subtle",
|
||||
"thiserror",
|
||||
"time 0.3.21",
|
||||
"zkp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lox-distributor"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"chrono",
|
||||
"futures",
|
||||
"hex_fmt",
|
||||
"hyper",
|
||||
"julianday",
|
||||
"lox",
|
||||
"lox_utils",
|
||||
"rand 0.8.5",
|
||||
"rdsys_backend",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"time 0.3.21",
|
||||
"tokio",
|
||||
"zkp",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lox-wasm"
|
||||
version = "0.1.0"
|
||||
|
@ -901,7 +902,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"julianday",
|
||||
"lazy_static",
|
||||
"lox",
|
||||
"lox-library",
|
||||
"lox_utils",
|
||||
"rand 0.7.3",
|
||||
"serde_json",
|
||||
|
@ -914,7 +915,7 @@ dependencies = [
|
|||
name = "lox_utils"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"lox",
|
||||
"lox-library",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
|
@ -1521,9 +1522,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.163"
|
||||
version = "1.0.164"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2"
|
||||
checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
@ -1539,9 +1540,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.163"
|
||||
version = "1.0.164"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e"
|
||||
checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
@ -24,7 +24,7 @@ serde_with = "3.0.0"
|
|||
serde_json = "1.0.87"
|
||||
zkp = "0.8.0"
|
||||
|
||||
lox = { path = "../lox-library", version = "0.1.0"}
|
||||
lox-library = { path = "../lox-library", version = "0.1.0"}
|
||||
lox_utils = { path = "../lox-utils", version = "0.1.0"}
|
||||
rdsys_backend = { path = "../rdsys-backend-api", version = "0.1.0"}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use hyper::{body::Bytes, header::HeaderValue, Body, Response};
|
||||
|
||||
use lox::{
|
||||
use lox_library::{
|
||||
bridge_table::{BridgeLine, ENC_BUCKET_BYTES, MAX_BRIDGES_PER_BUCKET},
|
||||
proto::{
|
||||
blockage_migration, check_blockage, issue_invite, level_up, migration, open_invite,
|
||||
|
@ -66,14 +66,14 @@ impl LoxServerContext {
|
|||
ba_obj.add_spare_bucket(bucket);
|
||||
}
|
||||
|
||||
pub fn replace_with_new(&self, bridgeline: BridgeLine) -> lox::ReplaceSuccess {
|
||||
pub fn replace_with_new(&self, bridgeline: BridgeLine) -> lox_library::ReplaceSuccess {
|
||||
let mut ba_obj = self.ba.lock().unwrap();
|
||||
let eb_obj = self.extra_bridges.lock().unwrap();
|
||||
let available_bridge = eb_obj.last();
|
||||
let result = ba_obj.bridge_replace(&bridgeline, available_bridge);
|
||||
// .last() doesn't actually remove the object so we still have to do that if the bridge was
|
||||
// replaced with an available bridge
|
||||
if result == lox::ReplaceSuccess::Replaced && eb_obj.len() > 0 {
|
||||
if result == lox_library::ReplaceSuccess::Replaced && eb_obj.len() > 0 {
|
||||
self.remove_single_bridge();
|
||||
}
|
||||
result
|
||||
|
|
|
@ -6,8 +6,8 @@ use hyper::{
|
|||
service::{make_service_fn, service_fn},
|
||||
Body, Request, Response, Server,
|
||||
};
|
||||
use lox::bridge_table::{BridgeLine, MAX_BRIDGES_PER_BUCKET};
|
||||
use lox::{BridgeAuth, BridgeDb};
|
||||
use lox_library::bridge_table::{BridgeLine, MAX_BRIDGES_PER_BUCKET};
|
||||
use lox_library::{BridgeAuth, BridgeDb};
|
||||
|
||||
use rdsys_backend::{proto::ResourceDiff, start_stream};
|
||||
use serde::Deserialize;
|
||||
|
@ -135,15 +135,15 @@ async fn context_manager(mut context_rx: mpsc::Receiver<Command>) {
|
|||
if context.unreplaced_bridges.lock().unwrap().len() > 0 {
|
||||
println!("BridgeLine to be replaced: {:?}", bridgeline);
|
||||
let res = context.replace_with_new(bridgeline);
|
||||
if res == lox::ReplaceSuccess::NotFound {
|
||||
if res == lox_library::ReplaceSuccess::NotFound {
|
||||
println!(
|
||||
"BridgeLine not found in bridge_table, already updated {:?}",
|
||||
bridgeline
|
||||
);
|
||||
} else if res == lox::ReplaceSuccess::Replaced {
|
||||
} else if res == lox_library::ReplaceSuccess::Replaced {
|
||||
println!("BridgeLine successfully replaced: {:?}", bridgeline);
|
||||
} else {
|
||||
assert!(res == lox::ReplaceSuccess::NotReplaced, "ReplaceSuccess incorrectly set somehow");
|
||||
assert!(res == lox_library::ReplaceSuccess::NotReplaced, "ReplaceSuccess incorrectly set somehow");
|
||||
// Add the bridge to the list of unreplaced bridges in the Lox context and try
|
||||
// again to replace at the next update (nothing changes in the Lox Authority)
|
||||
println!("'Gone' BridgeLine NOT replaced, saved for next update! : {:?}", bridgeline);
|
||||
|
@ -216,9 +216,9 @@ async fn context_manager(mut context_rx: mpsc::Receiver<Command>) {
|
|||
let bridgeline = parse_resource(resource);
|
||||
println!("BridgeLine to be replaced: {:?}", bridgeline);
|
||||
let res = context.replace_with_new(bridgeline);
|
||||
if res == lox::ReplaceSuccess::Replaced {
|
||||
if res == lox_library::ReplaceSuccess::Replaced {
|
||||
println!("BridgeLine successfully replaced: {:?}", bridgeline);
|
||||
} else if res == lox::ReplaceSuccess::NotReplaced {
|
||||
} else if res == lox_library::ReplaceSuccess::NotReplaced {
|
||||
// Add the bridge to the list of unreplaced bridges in the Lox context and try
|
||||
// again to replace at the next update (nothing changes in the Lox Authority)
|
||||
println!(
|
||||
|
|
|
@ -76,7 +76,7 @@ mod tests {
|
|||
|
||||
use chrono::{Duration, Utc};
|
||||
use julianday::JulianDay;
|
||||
use lox::{
|
||||
use lox_library::{
|
||||
bridge_table::{self, BridgeLine},
|
||||
cred::BucketReachability,
|
||||
proto, BridgeAuth, BridgeDb,
|
||||
|
@ -252,7 +252,7 @@ mod tests {
|
|||
self.context.advance_days_test(days)
|
||||
}
|
||||
|
||||
fn simulate_blocking(&mut self, cred: lox::cred::Lox) -> (lox::cred::Lox, u32, [u8; 16]) {
|
||||
fn simulate_blocking(&mut self, cred: lox_library::cred::Lox) -> (lox_library::cred::Lox, u32, [u8; 16]) {
|
||||
let (id, key) = bridge_table::from_scalar(cred.bucket).unwrap();
|
||||
let mut bdb = self.context.db.lock().unwrap();
|
||||
let mut lox_auth = self.context.ba.lock().unwrap();
|
||||
|
@ -398,7 +398,7 @@ mod tests {
|
|||
Ok(token) => token,
|
||||
Err(e) => panic!("Error: Invitation token error {:?}", e.to_string()),
|
||||
};
|
||||
let (request, state) = lox::proto::open_invite::request(&token);
|
||||
let (request, state) = lox_library::proto::open_invite::request(&token);
|
||||
let open_request = lc.openinvite(request);
|
||||
let open_response = handle(th.context.clone(), open_request).await.unwrap();
|
||||
assert_eq!(open_response.status(), StatusCode::OK);
|
||||
|
@ -412,7 +412,7 @@ mod tests {
|
|||
let pubkeys_obj: lox_utils::PubKeys = serde_json::from_str(&pubkeys).unwrap();
|
||||
|
||||
// Test Trust Promotion and get response
|
||||
let lox_cred = lox::proto::open_invite::handle_response(
|
||||
let lox_cred = lox_library::proto::open_invite::handle_response(
|
||||
state,
|
||||
open_response_obj,
|
||||
&pubkeys_obj.lox_pub,
|
||||
|
@ -446,7 +446,7 @@ mod tests {
|
|||
let trustpromo_response_obj = serde_json::from_str(&trustpromo_resp).unwrap();
|
||||
|
||||
// Test Trust Migration and get response
|
||||
let mig_cred = match lox::proto::trust_promotion::handle_response(
|
||||
let mig_cred = match lox_library::proto::trust_promotion::handle_response(
|
||||
trust_result.1,
|
||||
trustpromo_response_obj,
|
||||
) {
|
||||
|
@ -472,7 +472,7 @@ mod tests {
|
|||
let trustmig_response_obj = serde_json::from_str(&trustmig_resp).unwrap();
|
||||
|
||||
// Test Level up and get response
|
||||
let level_one_cred = match lox::proto::migration::handle_response(
|
||||
let level_one_cred = match lox_library::proto::migration::handle_response(
|
||||
migration_result.1,
|
||||
trustmig_response_obj,
|
||||
&pubkeys_obj.lox_pub,
|
||||
|
@ -503,7 +503,7 @@ mod tests {
|
|||
assert_eq!(level_up_response.status(), StatusCode::OK);
|
||||
let levelup_resp = body_to_string(level_up_response).await;
|
||||
let levelup_response_obj = serde_json::from_str(&levelup_resp).unwrap();
|
||||
let level_two_cred = match lox::proto::level_up::handle_response(
|
||||
let level_two_cred = match lox_library::proto::level_up::handle_response(
|
||||
level_up_result.1,
|
||||
levelup_response_obj,
|
||||
&pubkeys_obj.lox_pub,
|
||||
|
@ -541,7 +541,7 @@ mod tests {
|
|||
assert_eq!(issue_invite_response.status(), StatusCode::OK);
|
||||
let invite_resp = body_to_string(issue_invite_response).await;
|
||||
let invite_response_obj = serde_json::from_str(&invite_resp).unwrap();
|
||||
let issue_invite_cred = match lox::proto::issue_invite::handle_response(
|
||||
let issue_invite_cred = match lox_library::proto::issue_invite::handle_response(
|
||||
issue_invite_result.1,
|
||||
invite_response_obj,
|
||||
&pubkeys_obj.lox_pub,
|
||||
|
@ -604,7 +604,7 @@ mod tests {
|
|||
assert_eq!(level_three_response.status(), StatusCode::OK);
|
||||
let levelup_resp = body_to_string(level_three_response).await;
|
||||
let levelup_response_obj = serde_json::from_str(&levelup_resp).unwrap();
|
||||
let level_three_cred = match lox::proto::level_up::handle_response(
|
||||
let level_three_cred = match lox_library::proto::level_up::handle_response(
|
||||
level_three_request.1,
|
||||
levelup_response_obj,
|
||||
&pubkeys_obj.lox_pub,
|
||||
|
@ -632,7 +632,7 @@ mod tests {
|
|||
assert_eq!(migration_cred_response.status(), StatusCode::OK);
|
||||
let migration_resp = body_to_string(migration_cred_response).await;
|
||||
let migration_response_obj = serde_json::from_str(&migration_resp).unwrap();
|
||||
let mig_cred = match lox::proto::check_blockage::handle_response(
|
||||
let mig_cred = match lox_library::proto::check_blockage::handle_response(
|
||||
migration_cred_request.1,
|
||||
migration_response_obj,
|
||||
) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use lox::bridge_table::{BridgeLine, BRIDGE_BYTES};
|
||||
use lox_library::bridge_table::{BridgeLine, BRIDGE_BYTES};
|
||||
use rdsys_backend::proto::Resource;
|
||||
|
||||
pub fn parse_resource(resource: Resource) -> BridgeLine {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "lox"
|
||||
name = "lox-library"
|
||||
version = "0.1.0"
|
||||
authors = ["Ian Goldberg <iang@uwaterloo.ca>"]
|
||||
edition = "2018"
|
||||
|
@ -16,7 +16,7 @@ zkp = "0.8"
|
|||
bincode = "1"
|
||||
chrono = "0.4"
|
||||
rand = "0.7"
|
||||
serde = "1"
|
||||
serde = "1.0.164"
|
||||
serde_with = "3.0.0"
|
||||
sha2 = "0.9"
|
||||
statistical = "1.0.0"
|
||||
|
@ -26,6 +26,7 @@ aes-gcm = "0.8"
|
|||
base64 = "0.13"
|
||||
time = "0.3.21"
|
||||
subtle = "2.4"
|
||||
thiserror= "1.0.40"
|
||||
|
||||
[features]
|
||||
default = ["u64_backend"]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use lox::dup_filter;
|
||||
use lox::dup_filter::SeenType::{Fresh, Seen};
|
||||
use lox::BridgeDb;
|
||||
use lox_library::dup_filter;
|
||||
use lox_library::dup_filter::SeenType::{Fresh, Seen};
|
||||
use lox_library::BridgeDb;
|
||||
|
||||
use curve25519_dalek::scalar::Scalar;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ categories = ["rust-patterns"]
|
|||
repository = "https://gitlab.torproject.org/tpo/anti-censorship/lox.git/"
|
||||
|
||||
[dependencies]
|
||||
lox = {path = "../lox-library", version = "0.1.0"}
|
||||
lox-library = {path = "../lox-library", version = "0.1.0"}
|
||||
serde = "1"
|
||||
serde_json = "1.0.96"
|
||||
serde_with = "3.0.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use lox::bridge_table::{from_scalar, BridgeLine, BridgeTable, ENC_BUCKET_BYTES};
|
||||
use lox::cred::{BucketReachability, Invitation, Lox};
|
||||
use lox::proto;
|
||||
use lox::{IssuerPubKey, OPENINV_LENGTH};
|
||||
use lox_library::bridge_table::{from_scalar, BridgeLine, BridgeTable, ENC_BUCKET_BYTES};
|
||||
use lox_library::cred::{BucketReachability, Invitation, Lox};
|
||||
use lox_library::proto;
|
||||
use lox_library::{IssuerPubKey, OPENINV_LENGTH};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::serde_as;
|
||||
use std::array::TryFromSliceError;
|
||||
|
|
|
@ -12,7 +12,7 @@ crate-type = ["cdylib"]
|
|||
[dependencies]
|
||||
julianday = "1.2.0"
|
||||
lazy_static = "1.4.0"
|
||||
lox = { path = "../lox-library", version = "0.1.0" }
|
||||
lox-library = { path = "../lox-library", version = "0.1.0" }
|
||||
lox_utils = { path = "../lox-utils", version = "0.1.0" }
|
||||
wasm-bindgen = "0.2"
|
||||
time = "0.3.21"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use chrono::{Duration, Utc};
|
||||
use julianday::JulianDay;
|
||||
use lox::cred::{Invitation, Lox, Migration};
|
||||
use lox::proto::{
|
||||
use lox_library::cred::{Invitation, Lox, Migration};
|
||||
use lox_library::proto::{
|
||||
blockage_migration, check_blockage, issue_invite, level_up, migration, open_invite,
|
||||
redeem_invite, trust_promotion,
|
||||
};
|
||||
use lox::scalar_u32;
|
||||
use lox_library::scalar_u32;
|
||||
use std::panic;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
|
|
Loading…
Reference in New Issue