-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCargo.toml
More file actions
190 lines (163 loc) · 5.89 KB
/
Copy pathCargo.toml
File metadata and controls
190 lines (163 loc) · 5.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
[package]
name = "shortlinker"
version = "0.5.2"
description = "A minimalist URL shortener service supporting HTTP 307 redirection, built with Rust. Easy to deploy and lightning fast."
authors = ["AptS-1547 <apts-1547@esaps.net>"]
repository = "https://github.com/AptS-1547/shortlinker"
edition = "2024"
rust-version = "1.88"
[features]
default = ["server", "cli"] # 默认启用服务器和CLI功能
server = [] # 服务器功能(核心)
cli = ["server"] # CLI功能(依赖服务器)
tui = ["server", "dep:color-eyre", "dep:crossterm", "dep:ratatui", "dep:arboard", "dep:nucleo-matcher"] # TUI功能(依赖服务器)
metrics = ["server", "dep:prometheus", "dep:sysinfo"] # Prometheus 指标导出
full = ["server", "cli", "tui", "metrics"] # 全功能版本
# 优化配置
[profile.dev]
opt-level = 1
lto = false
codegen-units = 16
panic = "unwind"
strip = false
incremental = true
[profile.release]
opt-level = "s"
lto = true
codegen-units = 1
panic = "abort"
strip = true
[profile.release-debug]
inherits = "release"
codegen-units = 1
debug = true
strip = false
lto = false
# 添加库配置
[lib]
name = "shortlinker"
path = "src/lib.rs"
# 二进制配置
[[bin]]
name = "shortlinker"
path = "src/main.rs"
[workspace]
members = [".", "migration"]
[dependencies]
clap = { version = "4", features = ["derive"] }
migration = { path = "migration" }
actix-web = { version = "4.13", features = ["compress-brotli", "compress-gzip"] }
config = "0.15"
dotenvy = "0.15"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_repr = "0.1"
rand = { version = "0.10.1", default-features = false, features = ["std", "std_rng", "thread_rng"] }
chrono = { version = "0.4.44", default-features = false, features = ["clock", "serde"] }
async-trait = "0.1.89"
tokio = { version = "1.50.0", default-features = false, features = ["rt-multi-thread", "macros", "net", "io-util", "time"] }
bytes = "1.11"
tracing = { version = "0.1.44", default-features = false }
dashmap = "6.1.0"
crossbeam-channel = "0.5"
tracing-subscriber = { version = "0.3.23", default-features = false, features = ["env-filter", "fmt", "ansi", "json"] }
tracing-appender = "0.2.4"
moka = { version = "0.12.15", default-features = false, features = ["future", "sync"] }
colored = "3.1.1"
num_cpus = { version = "1.17.0", default-features = false }
bloomfilter = "3.0.1"
actix-service = "2.0.3"
futures-util = "0.3.32"
once_cell = "1.21.4"
ctor = "0.6"
anyhow = { version = "1.0.102", features = ["backtrace"] }
rust-embed = "8.11.0"
uuid = { version = "1.22", features = ["v4"] }
redis = { version = "1.1.0", features = ["tokio-comp", "tokio-rustls-comp", "connection-manager"] }
rustls = "0.23.37"
toml = "1.0"
color-eyre = { version = "0.6.5", optional = true }
crossterm = { version = "0.29.0", optional = true }
ratatui = { version = "0.30.0", optional = true }
arboard = { version = "3.6", optional = true }
nucleo-matcher = { version = "0.3", optional = true }
prometheus = { version = "0.14", optional = true, default-features = false }
sysinfo = { version = "0.38", optional = true, default-features = false, features = ["system"] }
sea-orm = { version = "2.0.0-rc.37", default-features = false, features = ["sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", "macros", "runtime-tokio-rustls", "chrono"] }
jsonwebtoken = { version = "10", features = ["rust_crypto"] }
arc-swap = "1"
parking_lot = "0.12"
argon2 = "0.5"
url = "2"
actix-cors = "0.7"
ts-rs = { version = "12.0", features = ["chrono-impl"] }
csv = "1.4"
actix-multipart = "0.7"
strum = { version = "0.28", features = ["derive"] }
governor = "0.10.4"
actix-governor = "0.10.0"
rpassword = "7"
subtle = "2"
base64 = "0.22"
maxminddb = "0.27"
ureq = { version = "3.3.0", features = ["json"] }
xxhash-rust = { version = "0.8", features = ["xxh64"] }
woothee = "0.13"
urlencoding = "2.1.3"
[target.'cfg(unix)'.dependencies]
nix = { version = "0.31", default-features = false, features = ["signal", "process"] }
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.61", features = [
"Win32_Foundation",
"Win32_Security",
"Win32_Security_Authorization",
"Win32_System_Console",
] }
[dev-dependencies]
actix-rt = "2.11"
tempfile = "3.27"
tokio = { version = "1.50.0", features = ["full"] }
criterion = { version = "0.8", features = ["async_tokio"] }
[[bench]]
name = "click_manager"
harness = false
[[bench]]
name = "cache_layer"
harness = false
[[bench]]
name = "object_cache"
harness = false
[[bench]]
name = "password"
harness = false
[[bench]]
name = "utils"
harness = false
[[bench]]
name = "converters"
harness = false
[[bench]]
name = "ipc_protocol"
harness = false
[[bench]]
name = "import_conflict"
harness = false
# cargo-binstall 配置
[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/{ version }/shortlinker_{ version }_{ target }{ binary-ext }"
bin-dir = "shortlinker_{ version }_{ target }{ binary-ext }"
pkg-fmt = "bin"
[package.metadata.binstall.overrides.x86_64-apple-darwin]
pkg-url = "{ repo }/releases/download/{ version }/shortlinker_{ version }_macos_x86_64"
[package.metadata.binstall.overrides.aarch64-apple-darwin]
pkg-url = "{ repo }/releases/download/{ version }/shortlinker_{ version }_macos_aarch64"
[package.metadata.binstall.overrides.x86_64-unknown-linux-gnu]
pkg-url = "{ repo }/releases/download/{ version }/shortlinker_{ version }_linux_x86_64"
[package.metadata.binstall.overrides.x86_64-unknown-linux-musl]
pkg-url = "{ repo }/releases/download/{ version }/shortlinker_{ version }_linux_x86_64"
[package.metadata.binstall.overrides.aarch64-unknown-linux-gnu]
pkg-url = "{ repo }/releases/download/{ version }/shortlinker_{ version }_linux_aarch64"
[package.metadata.binstall.overrides.x86_64-pc-windows-gnu]
pkg-url = "{ repo }/releases/download/{ version }/shortlinker_{ version }_windows_x86_64.exe"
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-url = "{ repo }/releases/download/{ version }/shortlinker_{ version }_windows_x86_64.exe"