...
This commit is contained in:
		
							
								
								
									
										125
									
								
								acldb/Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										125
									
								
								acldb/Cargo.lock
									
									
									
										generated
									
									
									
								
							@@ -22,7 +22,8 @@ dependencies = [
 | 
			
		||||
 "thiserror",
 | 
			
		||||
 "tokio",
 | 
			
		||||
 "tst",
 | 
			
		||||
 "utoipa",
 | 
			
		||||
 "utoipa 3.5.0",
 | 
			
		||||
 "utoipa-redoc",
 | 
			
		||||
 "utoipa-swagger-ui",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@@ -264,6 +265,15 @@ dependencies = [
 | 
			
		||||
 "alloc-no-stdlib",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "arbitrary"
 | 
			
		||||
version = "1.4.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "derive_arbitrary",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "async-trait"
 | 
			
		||||
version = "0.1.88"
 | 
			
		||||
@@ -345,10 +355,10 @@ dependencies = [
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "byteorder"
 | 
			
		||||
version = "1.5.0"
 | 
			
		||||
name = "bumpalo"
 | 
			
		||||
version = "3.17.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
 | 
			
		||||
checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "bytes"
 | 
			
		||||
@@ -442,6 +452,17 @@ dependencies = [
 | 
			
		||||
 "powerfmt",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "derive_arbitrary"
 | 
			
		||||
version = "1.4.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2",
 | 
			
		||||
 "quote",
 | 
			
		||||
 "syn 2.0.100",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "derive_more"
 | 
			
		||||
version = "0.99.19"
 | 
			
		||||
@@ -1256,9 +1277,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "rust-embed"
 | 
			
		||||
version = "6.8.1"
 | 
			
		||||
version = "8.7.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "a36224c3276f8c4ebc8c20f158eca7ca4359c8db89991c4925132aaaf6702661"
 | 
			
		||||
checksum = "e5fbc0ee50fcb99af7cebb442e5df7b5b45e9460ffa3f8f549cd26b862bec49d"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "rust-embed-impl",
 | 
			
		||||
 "rust-embed-utils",
 | 
			
		||||
@@ -1267,23 +1288,22 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "rust-embed-impl"
 | 
			
		||||
version = "6.8.1"
 | 
			
		||||
version = "8.7.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "49b94b81e5b2c284684141a2fb9e2a31be90638caf040bf9afbc5a0416afe1ac"
 | 
			
		||||
checksum = "6bf418c9a2e3f6663ca38b8a7134cc2c2167c9d69688860e8961e3faa731702e"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2",
 | 
			
		||||
 "quote",
 | 
			
		||||
 "rust-embed-utils",
 | 
			
		||||
 "shellexpand",
 | 
			
		||||
 "syn 2.0.100",
 | 
			
		||||
 "walkdir",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "rust-embed-utils"
 | 
			
		||||
version = "7.8.1"
 | 
			
		||||
version = "8.7.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "9d38ff6bf570dc3bb7100fce9f7b60c33fa71d80e88da3f2580df4ff2bdded74"
 | 
			
		||||
checksum = "08d55b95147fe01265d06b3955db798bdaed52e60e2211c41137701b3aba8e21"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "sha2",
 | 
			
		||||
 "walkdir",
 | 
			
		||||
@@ -1397,15 +1417,6 @@ dependencies = [
 | 
			
		||||
 "digest",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "shellexpand"
 | 
			
		||||
version = "2.1.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "7ccc8076840c4da029af4f87e4e8daeb0fca6b87bbb02e10cb60b791450e11e4"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "dirs",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "shlex"
 | 
			
		||||
version = "1.3.0"
 | 
			
		||||
@@ -1421,6 +1432,12 @@ dependencies = [
 | 
			
		||||
 "libc",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "simd-adler32"
 | 
			
		||||
version = "0.3.7"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "slab"
 | 
			
		||||
version = "0.4.9"
 | 
			
		||||
@@ -1692,7 +1709,19 @@ dependencies = [
 | 
			
		||||
 "indexmap",
 | 
			
		||||
 "serde",
 | 
			
		||||
 "serde_json",
 | 
			
		||||
 "utoipa-gen",
 | 
			
		||||
 "utoipa-gen 3.5.0",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "utoipa"
 | 
			
		||||
version = "5.3.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "435c6f69ef38c9017b4b4eea965dfb91e71e53d869e896db40d1cf2441dd75c0"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "indexmap",
 | 
			
		||||
 "serde",
 | 
			
		||||
 "serde_json",
 | 
			
		||||
 "utoipa-gen 5.3.1",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
@@ -1709,18 +1738,43 @@ dependencies = [
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "utoipa-swagger-ui"
 | 
			
		||||
version = "3.1.5"
 | 
			
		||||
name = "utoipa-gen"
 | 
			
		||||
version = "5.3.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "84614caa239fb25b2bb373a52859ffd94605ceb256eeb1d63436325cf81e3653"
 | 
			
		||||
checksum = "a77d306bc75294fd52f3e99b13ece67c02c1a2789190a6f31d32f736624326f7"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "proc-macro2",
 | 
			
		||||
 "quote",
 | 
			
		||||
 "syn 2.0.100",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "utoipa-redoc"
 | 
			
		||||
version = "6.0.0"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "6427547f6db7ec006cbbef95f7565952a16f362e298b416d2d497d9706fef72d"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "actix-web",
 | 
			
		||||
 "serde",
 | 
			
		||||
 "serde_json",
 | 
			
		||||
 "utoipa 5.3.1",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "utoipa-swagger-ui"
 | 
			
		||||
version = "9.0.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "d29519b3c485df6b13f4478ac909a491387e9ef70204487c3b64b53749aec0be"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "actix-web",
 | 
			
		||||
 "base64 0.22.1",
 | 
			
		||||
 "mime_guess",
 | 
			
		||||
 "regex",
 | 
			
		||||
 "rust-embed",
 | 
			
		||||
 "serde",
 | 
			
		||||
 "serde_json",
 | 
			
		||||
 "utoipa",
 | 
			
		||||
 "url",
 | 
			
		||||
 "utoipa 5.3.1",
 | 
			
		||||
 "zip",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
@@ -1978,14 +2032,29 @@ dependencies = [
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "zip"
 | 
			
		||||
version = "0.6.6"
 | 
			
		||||
version = "2.6.1"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
 | 
			
		||||
checksum = "1dcb24d0152526ae49b9b96c1dcf71850ca1e0b882e4e28ed898a93c41334744"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "byteorder",
 | 
			
		||||
 "arbitrary",
 | 
			
		||||
 "crc32fast",
 | 
			
		||||
 "crossbeam-utils",
 | 
			
		||||
 "flate2",
 | 
			
		||||
 "indexmap",
 | 
			
		||||
 "memchr",
 | 
			
		||||
 "zopfli",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "zopfli"
 | 
			
		||||
version = "0.8.2"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "edfc5ee405f504cd4984ecc6f14d02d55cfda60fa4b689434ef4102aae150cd7"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "bumpalo",
 | 
			
		||||
 "crc32fast",
 | 
			
		||||
 "log",
 | 
			
		||||
 "simd-adler32",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,8 @@ actix-web = "4"
 | 
			
		||||
actix-rt = "2"
 | 
			
		||||
actix-cors = "0.6"
 | 
			
		||||
utoipa = { version = "3.3", features = ["actix_extras"] }
 | 
			
		||||
utoipa-swagger-ui = { version = "3.1", features = ["actix-web"] }
 | 
			
		||||
utoipa-swagger-ui = { version = "9.0.1", features = ["actix-web"] }
 | 
			
		||||
utoipa-redoc = { version = "6.0", features = ["actix-web"] }
 | 
			
		||||
tokio = { version = "1", features = ["full"] }
 | 
			
		||||
log = "0.4"
 | 
			
		||||
env_logger = "0.10"
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ use tokio::sync::RwLock;
 | 
			
		||||
use serde_json::json;
 | 
			
		||||
use log::{error, info};
 | 
			
		||||
use utoipa::OpenApi;
 | 
			
		||||
use utoipa_swagger_ui::SwaggerUi;
 | 
			
		||||
use utoipa_redoc::{Redoc, Servable};
 | 
			
		||||
 | 
			
		||||
use crate::ACLDB;
 | 
			
		||||
use crate::rpc::{RpcInterface, RpcRequest, RpcResponse, AclUpdateParams, AclRemoveParams, AclDelParams, SetParams, DelParams, GetParams, PrefixParams};
 | 
			
		||||
@@ -164,7 +164,7 @@ impl Server {
 | 
			
		||||
        self.register_handlers();
 | 
			
		||||
        
 | 
			
		||||
        info!("Starting ACLDB server on {}:{}", self.config.host, self.config.port);
 | 
			
		||||
        info!("Swagger UI available at: http://{}:{}/swagger-ui/", self.config.host, self.config.port);
 | 
			
		||||
        info!("API documentation available at: http://{}:{}/redoc", self.config.host, self.config.port);
 | 
			
		||||
        
 | 
			
		||||
        // Start the HTTP server
 | 
			
		||||
        HttpServer::new(move || {
 | 
			
		||||
@@ -180,8 +180,7 @@ impl Server {
 | 
			
		||||
                .route("/rpc", web::post().to(handle_rpc))
 | 
			
		||||
                .route("/health", web::get().to(health_check))
 | 
			
		||||
                .service(
 | 
			
		||||
                    SwaggerUi::new("/swagger-ui/{_:.*}")
 | 
			
		||||
                        .url("/api-docs/openapi.json", ApiDoc::openapi())
 | 
			
		||||
                    Redoc::with_url("/redoc", serde_json::to_value(ApiDoc::openapi()).unwrap())
 | 
			
		||||
                )
 | 
			
		||||
        })
 | 
			
		||||
        .bind(format!("{0}:{1}", self.config.host, self.config.port))?
 | 
			
		||||
@@ -311,7 +310,7 @@ async fn handle_rpc(
 | 
			
		||||
/// Process an RPC request
 | 
			
		||||
async fn process_request(
 | 
			
		||||
    request: &RpcRequest,
 | 
			
		||||
    rpc_interface: &Arc<RpcInterface>,
 | 
			
		||||
    _rpc_interface: &Arc<RpcInterface>,
 | 
			
		||||
    acldb_factory: &Arc<ACLDBFactory>
 | 
			
		||||
) -> RpcResponse {
 | 
			
		||||
    match request.method.as_str() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user