diff --git a/CHANGELOG.md b/CHANGELOG.md index dfd85b9..116a22e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.0 + +- Added support for atomicals URN resolution. + ## 0.1.7 - Added support for real-time caching. diff --git a/Cargo.lock b/Cargo.lock index 0f65f25..fefb6fe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -142,9 +142,9 @@ checksum = "98f7eed2b2781a6f0b5c903471d48e15f56fb4e1165df8a9a2337fd1a59d45ea" [[package]] name = "bitcoin" -version = "0.31.1" +version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd00f3c09b5f21fb357abe32d29946eb8bb7a0862bae62c0b5e4a692acbbe73c" +checksum = "6c85783c2fe40083ea54a33aa2f0ba58831d90fcd190f5bdc47e74e84d2a96ae" dependencies = [ "bech32", "bitcoin-internals", @@ -275,6 +275,33 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "ciborium" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" + +[[package]] +name = "ciborium-ll" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -327,6 +354,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-common" version = "0.1.6" @@ -449,18 +482,20 @@ checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" [[package]] name = "elex-proxy" -version = "0.1.7" +version = "0.2.0" dependencies = [ "anyhow", "axum", "bitcoin", "bytes", + "ciborium", "dotenv", "forwarded-header-value", "futures", "headers", "hex", "http-body-util", + "mime_guess", "moka", "once_cell", "openssl", @@ -736,6 +771,16 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e" +dependencies = [ + "cfg-if", + "crunchy", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -999,6 +1044,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -1823,9 +1878,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" dependencies = [ "backtrace", "bytes", diff --git a/Cargo.toml b/Cargo.toml index 438cc68..31f1d41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "elex-proxy" -version = "0.1.7" +version = "0.2.0" edition = "2021" build = "build.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -10,7 +10,7 @@ axum = { version = "^0.7.5", features = ["http2"] } futures = "^0" serde = { version = "^1.0.197", features = ["derive"] } serde_json = "^1.0.115" -tokio = { version = "^1.36.0", features = ["full"] } +tokio = { version = "^1.37.0", features = ["full"] } tokio-stream = "^0.1.15" tungstenite = "^0" tokio-tungstenite = { version = "^0", features = ["native-tls"] } @@ -31,9 +31,11 @@ regex = "^1.10.4" headers = "0.4.0" forwarded-header-value = "0.1.1" rand = "0.8.5" -bitcoin = "0.31.1" +bitcoin = "0.31.2" hex = "0.4.3" moka = { version = "0.12.5", features = ["future"] } +ciborium = "0.2.2" +mime_guess = "2.0.4" [build-dependencies] vergen = { version = "9.0.0-beta.2", features = ["build", "cargo", "rustc"] } diff --git a/README-ZH.md b/README-ZH.md index 108cb1e..cf16f4a 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -35,10 +35,10 @@ RESPONSE_TIMEOUT=10 # 默认 10000, 最大的缓存数量 MAX_CACHE_ENTRIES=10000 -# 默认 480s, 缓存最大存活时间 -CACHE_TIME_TO_LIVE=480 -# 默认 90s, 缓存空闲时间,如果没有访问,缓存将被移除 -CACHE_TIME_TO_IDLE=90 +# 默认 600s, 缓存最大存活时间 +CACHE_TIME_TO_LIVE=600 +# 默认 180s, 缓存空闲时间,如果没有访问,缓存将被移除 +CACHE_TIME_TO_IDLE=180 # 不启用缓存的方法, 用逗号区分多个方法,默认值 "blockchain.atomicals.get_global,blockchain.estimatefee,blockchain.scripthash.subscribe,blockchain.transaction.broadcast,server.peers.subscribe,server.ping,mempool.get_fee_histogram,blockchain.atomicals.dump,blockchain.scripthash.unsubscribe,blockchain.relayfee" NO_CACHE_METHODS=blockchain.atomicals.get_global,blockchain.estimatefee,blockchain.scripthash.subscribe,blockchain.transaction.broadcast,server.peers.subscribe,server.ping,mempool.get_fee_histogram,blockchain.atomicals.dump,blockchain.scripthash.unsubscribe,blockchain.relayfee diff --git a/README.md b/README.md index f4b5c27..678bc75 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,10 @@ RESPONSE_TIMEOUT=10 # Default 10000, max cache entry MAX_CACHE_ENTRIES=10000 -# Default 480s, cache max live time -CACHE_TIME_TO_LIVE=480 -# Default 60s, cache idle time, if no access, cache will be removed -CACHE_TIME_TO_IDLE=90 +# Default 600s, cache max live time +CACHE_TIME_TO_LIVE=600 +# Default 180s, cache idle time, if no access, cache will be removed +CACHE_TIME_TO_IDLE=180 # no cache methods, use comma to separate multiple methods, default "blockchain.atomicals.get_global,blockchain.estimatefee,blockchain.scripthash.subscribe,blockchain.transaction.broadcast,server.peers.subscribe,server.ping,mempool.get_fee_histogram,blockchain.atomicals.dump,blockchain.scripthash.unsubscribe,blockchain.relayfee" NO_CACHE_METHODS=blockchain.atomicals.get_global,blockchain.estimatefee,blockchain.scripthash.subscribe,blockchain.transaction.broadcast,server.peers.subscribe,server.ping,mempool.get_fee_histogram,blockchain.atomicals.dump,blockchain.scripthash.unsubscribe,blockchain.relayfee