diff --git a/Cargo.toml b/Cargo.toml index 97a5f2b..008d1f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,40 +25,67 @@ categories = ["config", "asynchronous", "development-tools"] [workspace.dependencies] base64 = "0.21" bytes = "1" -bcrypt = "0.14" +bcrypt = "0.15.0" encoding_rs = "0.8" form_urlencoded = "1" headers = "0.3" http = "0.2" -hyper = "0.14" +hyper = "1.0.1" hyper-timeout = "0.4" hmac = "0.12" hex = "0.4" log = "0.4" +openssl = "0.10" +opentelemetry-http = { version = "0.10", default-features = false } +opentelemetry-semantic-conventions = { version = "0.13", default-features = false } +opentelemetry-prometheus = { version = "0.14", default-features = false } +opentelemetry = { version = "0.21", default-features = false } + +polaris-circuitbreak = { path = "./crates/circuitbreak", version = "0.1.3" } polaris-config = { path = "./crates/config", version = "0.1.3" } polaris-core = { path = "./crates/core", version = "0.1.3" } +polaris-discovery = { path = "./crates/discovery", version = "0.1.3" } +polaris-loadbalance = { path = "./crates/loadbalance", version = "0.1.3" } +polaris-middleware = { path = "./crates/middleware", version = "0.1.3" } +polaris-observability = { path = "./crates/observability", version = "0.1.3" } polaris-ratelimit = { path = "./crates/ratelimit", version = "0.1.3" } polaris-registry = { path = "./crates/registry", version = "0.1.3" } polaris-router = { path = "./crates/router", version = "0.1.3" } -polaris-specification = "0.1.1" +polaris-specification = "1.4.1" +quinn = { version = "0.10", default-features = false } +quote = "1" rand = "0.8" -rcgen = "0.10" +rcgen = "0.11" regex = "1" -rustls = "0.20" +reqwest = { version = "0.11", default-features = false } +ring = "0.17" +rust_decimal = "1" +rustls = "0.21" +rustls-pemfile = "1" + serde = "1" serde_json = "1" +serde-xml-rs = "0.6" +serde_urlencoded = "0.7" +serde_yaml = "0.9" +sha2 = "0.10" tokio = "1" tokio-native-tls = "0.3" -tokio-rustls = "0.23" +tokio-rustls = "0.24.0" tokio-openssl = "0.6" tokio-stream = { version = "0.1", default-features = false } tokio-util = "0.7" -tokio-tungstenite = { version = "0.18", default-features = false } +tokio-tungstenite = { version = "0.20.1", default-features = false } tracing = "0.1" tracing-subscriber = "0.3" tracing-test = "0.2.1" url = "2" -x509-parser = "0.15.0" \ No newline at end of file +x509-parser = "0.15.0" + +# Compress +brotli = { version = "3.3", default-features = false } +flate2 = { version = "1.0", default-features = false } +zstd = { version = "0.13", default-features = false } \ No newline at end of file diff --git a/LICENSE-MIT b/LICENSE-MIT index 344f98d..95b9ee9 100644 --- a/LICENSE-MIT +++ b/LICENSE-MIT @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022 houseme +Copyright (c) 2022 Polaris Mesh Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/crates/circuitbreak/Cargo.toml b/crates/circuitbreak/Cargo.toml new file mode 100644 index 0000000..664d81d --- /dev/null +++ b/crates/circuitbreak/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "polaris-circuitbreak" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true +documentation.workspace = true +readme.workspace = true +keywords.workspace = true +categories.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/circuitbreak/src/lib.rs b/crates/circuitbreak/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/crates/circuitbreak/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/crates/discovery/Cargo.toml b/crates/discovery/Cargo.toml new file mode 100644 index 0000000..00868cc --- /dev/null +++ b/crates/discovery/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "polaris-discovery" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true +documentation.workspace = true +readme.workspace = true +keywords.workspace = true +categories.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/discovery/src/lib.rs b/crates/discovery/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/crates/discovery/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/crates/loadbalance/Cargo.toml b/crates/loadbalance/Cargo.toml new file mode 100644 index 0000000..3803bcd --- /dev/null +++ b/crates/loadbalance/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "polaris-loadbalance" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true +documentation.workspace = true +readme.workspace = true +keywords.workspace = true +categories.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/loadbalance/src/lib.rs b/crates/loadbalance/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/crates/loadbalance/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/crates/middleware/Cargo.toml b/crates/middleware/Cargo.toml new file mode 100644 index 0000000..8586cc6 --- /dev/null +++ b/crates/middleware/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "polaris-middleware" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true +documentation.workspace = true +readme.workspace = true +keywords.workspace = true +categories.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/middleware/src/lib.rs b/crates/middleware/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/crates/middleware/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/crates/observability/Cargo.toml b/crates/observability/Cargo.toml new file mode 100644 index 0000000..6f44962 --- /dev/null +++ b/crates/observability/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "polaris-observability" +version.workspace = true +authors.workspace = true +edition.workspace = true +rust-version.workspace = true +license.workspace = true +description.workspace = true +homepage.workspace = true +repository.workspace = true +documentation.workspace = true +readme.workspace = true +keywords.workspace = true +categories.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/crates/observability/src/lib.rs b/crates/observability/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/crates/observability/src/lib.rs @@ -0,0 +1,14 @@ +pub fn add(left: usize, right: usize) -> usize { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} diff --git a/docs/Introduction.md b/docs/Introduction.md new file mode 100644 index 0000000..74bd85d --- /dev/null +++ b/docs/Introduction.md @@ -0,0 +1,72 @@ + +# Introduction + +## 目录结构: +```html +polaris-rust +├── core +├── discovery +├── loadbalance +├── circuitbreak +├── ratelimit +├── config +├── observability +├── middleware +├── polaris +│ └── src +├── examples +├── benches +├── scripts +├── Cargo.toml +└── README.md +``` +```html +core: 公共依赖、抽象和工具 +discovery: 服务发现和注册相关 +circuitbreak: 熔断功能 +ratelimit: 限流功能 +config: 配置管理 +observability: metrics 和 tracing +middleware: 各种中间件 +examples: 示例程序 +benches: 基准测试 +scripts: 构建、发布等脚本 +``` + +```html +core +// 公共依赖、抽象和工具 + +discovery +// 服务发现和注册 + +loadbalance +// 负载均衡 + +circuitbreak +// 熔断 + +ratelimit +// 限流 + +config +// 配置管理 + +observability +// 指标上报和追踪 + +middleware +// 中间件,如日志、监控等 + +polaris +// SDK 统一出口 + +examples +// 示例程序 + +benches +// 基准测试 + +scripts +// 构建和发布脚本 +``` \ No newline at end of file