Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbfd74661e |
Generated
+27
-708
@@ -2,385 +2,27 @@
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "adler"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"is_terminal_polyfill",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391"
|
||||
dependencies = [
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "block-buffer"
|
||||
version = "0.10.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
||||
|
||||
[[package]]
|
||||
name = "cpufeatures"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
|
||||
dependencies = [
|
||||
"generic-array",
|
||||
"typenum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "data-encoding"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
|
||||
dependencies = [
|
||||
"block-buffer",
|
||||
"crypto-common",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_filter"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea"
|
||||
dependencies = [
|
||||
"log",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"env_filter",
|
||||
"humantime",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fnv"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"
|
||||
|
||||
[[package]]
|
||||
name = "futures-macro"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-sink"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.30"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-macro",
|
||||
"futures-sink",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "generic-array"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
|
||||
dependencies = [
|
||||
"typenum",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.29.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"fnv",
|
||||
"itoa",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "is_terminal_polyfill"
|
||||
version = "1.70.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800"
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "1.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.155"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "noteguard"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"futures-util",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tokio",
|
||||
"tokio-tungstenite",
|
||||
"toml",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.16.0"
|
||||
name = "once_cell"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.36.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
@@ -388,18 +30,6 @@ version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "ppv-lite86"
|
||||
version = "0.2.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.86"
|
||||
@@ -418,71 +48,6 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.24"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.18"
|
||||
@@ -520,36 +85,6 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sha1"
|
||||
version = "0.10.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cpufeatures",
|
||||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.69"
|
||||
@@ -561,66 +96,6 @@ dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio"
|
||||
version = "1.38.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes",
|
||||
"libc",
|
||||
"mio",
|
||||
"num_cpus",
|
||||
"pin-project-lite",
|
||||
"socket2",
|
||||
"tokio-macros",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-macros"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tokio-tungstenite"
|
||||
version = "0.23.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"log",
|
||||
"tokio",
|
||||
"tungstenite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.11"
|
||||
@@ -631,194 +106,38 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tungstenite"
|
||||
version = "0.23.0"
|
||||
name = "tracing"
|
||||
version = "0.1.40"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8"
|
||||
checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"bytes",
|
||||
"data-encoding",
|
||||
"http",
|
||||
"httparse",
|
||||
"log",
|
||||
"rand",
|
||||
"sha1",
|
||||
"thiserror",
|
||||
"utf-8",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typenum"
|
||||
version = "1.17.0"
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
|
||||
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-core"
|
||||
version = "0.1.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
|
||||
[[package]]
|
||||
name = "utf-8"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.52.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
||||
dependencies = [
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.5",
|
||||
"windows_aarch64_msvc 0.48.5",
|
||||
"windows_i686_gnu 0.48.5",
|
||||
"windows_i686_msvc 0.48.5",
|
||||
"windows_x86_64_gnu 0.48.5",
|
||||
"windows_x86_64_gnullvm 0.48.5",
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.52.6",
|
||||
"windows_aarch64_msvc 0.52.6",
|
||||
"windows_i686_gnu 0.52.6",
|
||||
"windows_i686_gnullvm",
|
||||
"windows_i686_msvc 0.52.6",
|
||||
"windows_x86_64_gnu 0.52.6",
|
||||
"windows_x86_64_gnullvm 0.52.6",
|
||||
"windows_x86_64_msvc 0.52.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.52.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||
|
||||
+3
-9
@@ -3,17 +3,11 @@ name = "noteguard"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
forwarder = ["tokio-tungstenite", "tokio", "futures-util"]
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
toml = "0.5"
|
||||
tracing = "0.1.40"
|
||||
|
||||
|
||||
|
||||
# forwarder deps
|
||||
tokio-tungstenite = { version = "0.23.1", optional = true }
|
||||
tokio = { version = "1.38.0", features = ["macros", "time", "sync", "rt-multi-thread"], optional = true }
|
||||
futures-util = { version = "0.3.30", optional = true }
|
||||
log = "0.4.22"
|
||||
env_logger = "0.11.3"
|
||||
|
||||
@@ -14,66 +14,14 @@ You can add any new filter you want by implementing the `NoteFilter` trait and r
|
||||
The `pipeline` config specifies the order in which filters are run. When the first `reject` or `shadowReject` action is hit, then the pipeline stops and returns the rejection error.
|
||||
|
||||
```toml
|
||||
pipeline = ["protected_events", "kinds", "whitelist", "ratelimit", "forwarder"]
|
||||
|
||||
pipeline = ["ratelimit"]
|
||||
|
||||
[filters.ratelimit]
|
||||
posts_per_minute = 8
|
||||
notes_per_minute = 8
|
||||
whitelist = ["127.0.0.1"]
|
||||
|
||||
[filters.whitelist]
|
||||
pubkeys = ["16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93"]
|
||||
ips = ["127.0.0.1"]
|
||||
|
||||
[filters.kinds]
|
||||
kinds = [30065, 1064]
|
||||
|
||||
[filters.kinds.messages]
|
||||
30065 = "blocked: files on nostr is dumb"
|
||||
1064 = "blocked: files on nostr is dumb"
|
||||
|
||||
[filters.protected_events]
|
||||
|
||||
[filters.forwarder]
|
||||
relay = "ws://localhost:8080"
|
||||
queue_size = 2000
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
You can install noteguard by copying the binary to the strfry directory.
|
||||
|
||||
Static musl builds are convenient ways to package noteguard for deployment. It enables you to copy the binary directly to your server, ensure that you are using the correct architecture that your server is running.
|
||||
|
||||
You most likely want `x86_64-unknown-linux-musl` or `aarch64-unknown-linux-musl`. Install this target with rustup, build noteguard, and copy the binary to the server:
|
||||
|
||||
```sh
|
||||
$ rustup target add x86_64-unknown-linux-musl
|
||||
$ cargo build --target x86_64-unknown-linux-musl --release
|
||||
$ scp ./target/x86_64-unknown-linux-musl/release/noteguard server:strfry
|
||||
$ scp noteguard.toml server:strfry
|
||||
```
|
||||
|
||||
Test that the binary executes by running it on the server:
|
||||
|
||||
```sh
|
||||
$ cd strfry
|
||||
$ <<<'{}' ./noteguard
|
||||
Failed to parse input: missing field `type` at line 1 column 2
|
||||
```
|
||||
|
||||
Configure `noteguard.toml` with your preferred filters.
|
||||
|
||||
Now you can then setup your `strfry.conf` to use the noteguard by adding it as a writePolicy plugin:
|
||||
|
||||
```
|
||||
writePolicy {
|
||||
# If non-empty, path to an executable script that implements the writePolicy plugin logic
|
||||
plugin = "./noteguard"
|
||||
}
|
||||
```
|
||||
|
||||
And you're done! Enjoy.
|
||||
|
||||
## Filters
|
||||
|
||||
You can use any of the builtin filters, or create your own!
|
||||
@@ -82,86 +30,22 @@ This is the initial release, and only includes one filter so far:
|
||||
|
||||
### Ratelimit
|
||||
|
||||
* name: `ratelimit`
|
||||
|
||||
The ratelimit filter limits the rate at which notes are written to the relay per-ip.
|
||||
|
||||
Settings:
|
||||
|
||||
- `notes_per_minute`: the number of notes per minute which are allowed to be written per ip.
|
||||
|
||||
- `whitelist` *optional*: a list of IP4 or IP6 addresses that are allowed to bypass the ratelimit.
|
||||
|
||||
### Whitelist
|
||||
|
||||
* name: `whitelist`
|
||||
|
||||
The whitelist filter only allows notes to pass if it matches a particular pubkey or source ip:
|
||||
|
||||
- `pubkeys` *optional*: a list of hex public keys to let through
|
||||
|
||||
- `ips` *optional*: a list of ip addresses to let through
|
||||
|
||||
Either criteria can match
|
||||
|
||||
### Kinds
|
||||
|
||||
* name: `kinds`
|
||||
|
||||
A filter that blacklists certain kinds
|
||||
|
||||
- `kinds`: a list of kind integers to block
|
||||
|
||||
- `kinds.messages` *optional*: a map of kinds to message to deliver when the kind is blocked
|
||||
|
||||
Example:
|
||||
|
||||
```toml
|
||||
[filters.kinds]
|
||||
kinds = [30065, 1064]
|
||||
|
||||
[filters.kinds.messages]
|
||||
30065 = "blocked: files on nostr is dumb"
|
||||
1064 = "blocked: files on nostr is dumb"
|
||||
```
|
||||
|
||||
### Protected Events
|
||||
|
||||
See [nip70]
|
||||
|
||||
* name: `protected_events`
|
||||
|
||||
There are no config options, but an empty config entry is still needed:
|
||||
|
||||
`[filters.protected_events]`
|
||||
|
||||
### Forwarder
|
||||
|
||||
* name: `forwarder`
|
||||
|
||||
You need to compile with the `forwarder` feature to enable this filter:
|
||||
|
||||
```sh
|
||||
$ cargo build --features forwarder --release
|
||||
```
|
||||
|
||||
The forwarder filter allows you to forward notes to another relay. Notes will
|
||||
be queued if the connection goes down (up to the `queue_size` buffer limit)
|
||||
|
||||
- `relay` - the relay to forward notes to, eg: `ws://localhost:8080`
|
||||
|
||||
- `queue_size` *optional* - size of the note queue, this is used to buffer notes if the connection goes down. Default is 1000.
|
||||
|
||||
- `whitelist`: a list of IP4 or IP6 addresses that are allowed to bypass the ratelimit.
|
||||
|
||||
## Testing
|
||||
|
||||
You can test your filters like so:
|
||||
|
||||
```sh
|
||||
$ cargo build
|
||||
$ <test/inputs ./target/debug/noteguard
|
||||
$ ./test/delay | ./target/debug/noteguard
|
||||
$ cargo build --release
|
||||
$ ./target/release/noteguard
|
||||
$ <test/test-inputs ./target/release/noteguard
|
||||
```
|
||||
|
||||
[strfry]: https://github.com/hoytech/strfry
|
||||
[nip70]: https://github.com/nostr-protocol/nips/blob/protected-events-tag/70.md
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
pipeline = ["ratelimit", "forwarder"]
|
||||
|
||||
[filters.forwarder]
|
||||
relay = "ws://127.0.0.1:8080"
|
||||
|
||||
[filters.ratelimit]
|
||||
posts_per_minute = 3
|
||||
+3
-21
@@ -1,24 +1,6 @@
|
||||
|
||||
pipeline = ["protected_events", "kinds", "content", "whitelist", "ratelimit"]
|
||||
pipeline = ["ratelimit"]
|
||||
|
||||
[filters.ratelimit]
|
||||
posts_per_minute = 8
|
||||
whitelist = ["127.0.0.1"]
|
||||
|
||||
[filters.content]
|
||||
filters = ["https://cdn.nostr.build/i/some-spammy-or-abusive-image-image.png"]
|
||||
|
||||
[filters.whitelist]
|
||||
pubkeys = ["16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93"]
|
||||
ips = ["127.0.0.1"]
|
||||
|
||||
[filters.kinds]
|
||||
kinds = [30065, 1064, 34550, 4550]
|
||||
|
||||
[filters.kinds.messages]
|
||||
30065 = "blocked: files on nostr is dumb"
|
||||
1064 = "blocked: files on nostr is dumb"
|
||||
34550 = "blocked: please use a dedicated relay for moderated communities"
|
||||
4550 = "blocked: please use a dedicated relay for moderated communities"
|
||||
|
||||
[filters.protected_events]
|
||||
posts_per_minute = 10
|
||||
whitelist = ["127.0.0.10"]
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
use crate::{Action, InputMessage, NoteFilter, OutputMessage};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
pub struct Content {
|
||||
filters: Vec<String>,
|
||||
}
|
||||
|
||||
impl NoteFilter for Content {
|
||||
fn filter_note(&mut self, msg: &InputMessage) -> OutputMessage {
|
||||
for filter in &self.filters {
|
||||
if msg.event.content.contains(filter) {
|
||||
return OutputMessage::new(msg.event.id.clone(), Action::ShadowReject, None);
|
||||
}
|
||||
}
|
||||
|
||||
OutputMessage::new(msg.event.id.clone(), Action::Accept, None)
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"content"
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
use serde::Deserialize;
|
||||
use crate::{Note, Action, NoteFilter, InputMessage, OutputMessage};
|
||||
use futures_util::{SinkExt, StreamExt};
|
||||
use tokio::sync::mpsc::{self, Sender, Receiver};
|
||||
use tokio_tungstenite::connect_async;
|
||||
use tokio_tungstenite::tungstenite::Message;
|
||||
use tokio_tungstenite::WebSocketStream;
|
||||
use tokio::time::{sleep, timeout, Duration};
|
||||
use serde_json::json;
|
||||
use log::{error, info, debug};
|
||||
|
||||
#[derive(Default, Deserialize)]
|
||||
pub struct Forwarder {
|
||||
relay: String,
|
||||
|
||||
/// the size of our bounded queue
|
||||
queue_size: Option<u32>,
|
||||
|
||||
/// The channel used for communicating with the forwarder thread
|
||||
#[serde(skip)]
|
||||
channel: Option<Sender<Note>>,
|
||||
}
|
||||
|
||||
async fn client_reconnect(relay: &str) -> WebSocketStream<tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream>> {
|
||||
loop {
|
||||
match connect_async(relay).await {
|
||||
Err(e) => {
|
||||
error!("failed to connect to relay {}: {}", relay, e);
|
||||
sleep(Duration::from_secs(5)).await;
|
||||
continue;
|
||||
}
|
||||
Ok((ws, _)) => {
|
||||
info!("connected to relay: {}", relay);
|
||||
return ws;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn forwarder_task(relay: String, mut rx: Receiver<Note>) {
|
||||
let stream = client_reconnect(&relay).await;
|
||||
let (mut writer, mut reader) = stream.split();
|
||||
|
||||
loop {
|
||||
tokio::select! {
|
||||
result = timeout(Duration::from_secs(10), rx.recv()) => {
|
||||
match result {
|
||||
Ok(Some(note)) => {
|
||||
if let Err(e) = writer.send(Message::Text(serde_json::to_string(&json!(["EVENT", note])).unwrap())).await {
|
||||
error!("got error: '{}', reconnecting...", e);
|
||||
let (w, r) = client_reconnect(&relay).await.split();
|
||||
writer = w;
|
||||
reader = r;
|
||||
}
|
||||
},
|
||||
Ok(None) => {
|
||||
// Channel has been closed, exit the loop
|
||||
error!("channel closed, stopping forwarder_task");
|
||||
break;
|
||||
}
|
||||
Err(_) => {
|
||||
// Timeout occurred, send a ping
|
||||
// try reading for pongs, etc
|
||||
let _r = reader.next();
|
||||
debug!("timeout reading note queue, sending ping");
|
||||
|
||||
if let Err(e) = writer.send(Message::Ping(vec![])).await {
|
||||
error!("error during ping ({}), reconnecting...", e);
|
||||
let (w, r) = client_reconnect(&relay).await.split();
|
||||
writer = w;
|
||||
reader = r;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl NoteFilter for Forwarder {
|
||||
fn name(&self) -> &'static str {
|
||||
"forwarder"
|
||||
}
|
||||
|
||||
fn filter_note(&mut self, input: &InputMessage) -> OutputMessage {
|
||||
if self.channel.is_none() {
|
||||
let (tx, rx) = mpsc::channel(self.queue_size.unwrap_or(1000) as usize);
|
||||
let relay = self.relay.clone();
|
||||
|
||||
tokio::task::spawn(async move {
|
||||
forwarder_task(relay, rx).await;
|
||||
});
|
||||
|
||||
self.channel = Some(tx);
|
||||
}
|
||||
|
||||
// Add code to process input and send through channel
|
||||
if let Some(ref channel) = self.channel {
|
||||
if let Err(e) = channel.try_send(input.event.clone()) {
|
||||
eprintln!("could not forward note: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Create and return an appropriate OutputMessage
|
||||
OutputMessage::new(input.event.id.clone(), Action::Accept, None)
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
use crate::{Action, InputMessage, NoteFilter, OutputMessage};
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
pub struct Kinds {
|
||||
kinds: Vec<i64>,
|
||||
messages: Option<HashMap<String, String>>,
|
||||
}
|
||||
|
||||
impl NoteFilter for Kinds {
|
||||
fn filter_note(&mut self, input: &InputMessage) -> OutputMessage {
|
||||
let kind = input.event.kind;
|
||||
if self.kinds.contains(&kind) {
|
||||
let msg = self
|
||||
.messages
|
||||
.as_ref()
|
||||
.and_then(|msgs| msgs.get(&kind.to_string()).cloned())
|
||||
.unwrap_or_else(|| "blocked: note kind is not allowed here".to_string());
|
||||
OutputMessage::new(input.event.id.clone(), Action::Reject, Some(msg))
|
||||
} else {
|
||||
OutputMessage::new(input.event.id.clone(), Action::Accept, None)
|
||||
}
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"kinds"
|
||||
}
|
||||
}
|
||||
+2
-14
@@ -1,17 +1,5 @@
|
||||
mod content;
|
||||
mod kinds;
|
||||
mod protected_events;
|
||||
mod ratelimit;
|
||||
mod rate_limit;
|
||||
mod whitelist;
|
||||
|
||||
#[cfg(feature = "forwarder")]
|
||||
mod forwarder;
|
||||
|
||||
pub use content::Content;
|
||||
pub use kinds::Kinds;
|
||||
pub use protected_events::ProtectedEvents;
|
||||
pub use ratelimit::RateLimit;
|
||||
pub use rate_limit::RateLimit;
|
||||
pub use whitelist::Whitelist;
|
||||
|
||||
#[cfg(feature = "forwarder")]
|
||||
pub use forwarder::Forwarder;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
use crate::{Action, InputMessage, NoteFilter, OutputMessage};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
pub struct ProtectedEvents {}
|
||||
|
||||
impl NoteFilter for ProtectedEvents {
|
||||
fn filter_note(&mut self, input: &InputMessage) -> OutputMessage {
|
||||
if let Some(tag) = input.event.tags.first() {
|
||||
if let Some(entry) = tag.first() {
|
||||
if entry == "-" {
|
||||
return OutputMessage::new(
|
||||
input.event.id.clone(),
|
||||
Action::Reject,
|
||||
Some("blocked: event marked as protected".to_string()),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OutputMessage::new(input.event.id.clone(), Action::Accept, None)
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"protected_events"
|
||||
}
|
||||
}
|
||||
+11
-19
@@ -1,31 +1,23 @@
|
||||
use crate::{Action, InputMessage, NoteFilter, OutputMessage};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
#[derive(Deserialize)]
|
||||
pub struct Whitelist {
|
||||
pub pubkeys: Option<Vec<String>>,
|
||||
pub ips: Option<Vec<String>>,
|
||||
pub pubkeys: Vec<String>,
|
||||
pub ips: Vec<String>,
|
||||
}
|
||||
|
||||
impl NoteFilter for Whitelist {
|
||||
fn filter_note(&mut self, msg: &InputMessage) -> OutputMessage {
|
||||
if let Some(pubkeys) = &self.pubkeys {
|
||||
if pubkeys.contains(&msg.event.pubkey) {
|
||||
return OutputMessage::new(msg.event.id.clone(), Action::Accept, None);
|
||||
}
|
||||
if self.pubkeys.contains(&msg.event.pubkey) || self.ips.contains(&msg.source_info) {
|
||||
OutputMessage::new(msg.event.id.clone(), Action::Accept, None)
|
||||
} else {
|
||||
OutputMessage::new(
|
||||
msg.event.id.clone(),
|
||||
Action::Reject,
|
||||
Some("blocked: pubkey not on the whitelist".to_string()),
|
||||
)
|
||||
}
|
||||
|
||||
if let Some(ips) = &self.ips {
|
||||
if ips.contains(&msg.source_info) {
|
||||
return OutputMessage::new(msg.event.id.clone(), Action::Accept, None);
|
||||
}
|
||||
}
|
||||
|
||||
OutputMessage::new(
|
||||
msg.event.id.clone(),
|
||||
Action::Reject,
|
||||
Some("blocked: pubkey/ip not on the whitelist".to_string()),
|
||||
)
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
|
||||
+34
-234
@@ -1,14 +1,9 @@
|
||||
use noteguard::filters::{Content, Kinds, ProtectedEvents, RateLimit, Whitelist};
|
||||
|
||||
#[cfg(feature = "forwarder")]
|
||||
use noteguard::filters::Forwarder;
|
||||
|
||||
use log::info;
|
||||
use noteguard::filters::RateLimit;
|
||||
use noteguard::{Action, InputMessage, NoteFilter, OutputMessage};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::io::{self, Read};
|
||||
use std::io::{self, BufRead, Read, Write};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Config {
|
||||
@@ -46,13 +41,6 @@ impl Noteguard {
|
||||
/// every new instance of [`Noteguard`]
|
||||
fn register_builtin_filters(&mut self) {
|
||||
self.register_filter::<RateLimit>();
|
||||
self.register_filter::<Whitelist>();
|
||||
self.register_filter::<ProtectedEvents>();
|
||||
self.register_filter::<Kinds>();
|
||||
self.register_filter::<Content>();
|
||||
|
||||
#[cfg(feature = "forwarder")]
|
||||
self.register_filter::<Forwarder>();
|
||||
}
|
||||
|
||||
/// Run the loaded filters. You must call `load_config` before calling this, otherwise
|
||||
@@ -85,12 +73,7 @@ impl Noteguard {
|
||||
fn load_config(&mut self, config: &Config) -> Result<(), toml::de::Error> {
|
||||
self.loaded_filters.clear();
|
||||
|
||||
for name in &config.pipeline {
|
||||
let config_value = config
|
||||
.filters
|
||||
.get(name)
|
||||
.unwrap_or_else(|| panic!("could not find filter configuration for {}", name));
|
||||
|
||||
for (name, config_value) in &config.filters {
|
||||
if let Some(constructor) = self.registered_filters.get(name.as_str()) {
|
||||
let filter = constructor(config_value.clone())?;
|
||||
self.loaded_filters.push(filter);
|
||||
@@ -103,25 +86,7 @@ impl Noteguard {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "forwarder")]
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
noteguard();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "forwarder"))]
|
||||
fn main() {
|
||||
noteguard();
|
||||
}
|
||||
|
||||
fn serialize_output_message(msg: &OutputMessage) -> String {
|
||||
serde_json::to_string(msg).expect("OutputMessage should always serialize correctly")
|
||||
}
|
||||
|
||||
fn noteguard() {
|
||||
env_logger::init();
|
||||
info!("running noteguard");
|
||||
|
||||
let config_path = "noteguard.toml";
|
||||
let mut noteguard = Noteguard::new();
|
||||
|
||||
@@ -138,206 +103,41 @@ fn noteguard() {
|
||||
.expect("Expected filter config to be loaded ok");
|
||||
|
||||
let stdin = io::stdin();
|
||||
let stdout = io::stdout();
|
||||
let handle = stdout.lock();
|
||||
let mut writer = io::BufWriter::new(handle);
|
||||
|
||||
for line in stdin.lines() {
|
||||
let line = match line {
|
||||
Ok(line) => line,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to get line: {}", e);
|
||||
continue;
|
||||
for line in stdin.lock().lines() {
|
||||
match line {
|
||||
Ok(input) => {
|
||||
let input_message: InputMessage = match serde_json::from_str(&input) {
|
||||
Ok(msg) => msg,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to parse input: {}", e);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
if input_message.message_type != "new" {
|
||||
eprintln!("Unexpected request type");
|
||||
continue;
|
||||
}
|
||||
|
||||
let output_message = noteguard.run(input_message);
|
||||
|
||||
match serde_json::to_string(&output_message) {
|
||||
Ok(json) => {
|
||||
writeln!(writer, "{}", json).unwrap();
|
||||
writer.flush().unwrap();
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Failed to serialize output: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let input_message: InputMessage = match serde_json::from_str(&line) {
|
||||
Ok(msg) => msg,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to parse input: {}", e);
|
||||
continue;
|
||||
eprintln!("Failed to read line: {}", e);
|
||||
}
|
||||
};
|
||||
|
||||
if input_message.message_type != "new" {
|
||||
let out = OutputMessage::new(
|
||||
input_message.event.id.clone(),
|
||||
Action::Reject,
|
||||
Some("invalid strfry write policy input".to_string()),
|
||||
);
|
||||
println!("{}", serialize_output_message(&out));
|
||||
continue;
|
||||
}
|
||||
|
||||
let out = noteguard.run(input_message);
|
||||
let json = serialize_output_message(&out);
|
||||
|
||||
println!("{}", json);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use noteguard::filters::{Kinds, ProtectedEvents, RateLimit, Whitelist};
|
||||
use noteguard::{Action, Note};
|
||||
use serde_json::json;
|
||||
|
||||
// Helper function to create a mock InputMessage
|
||||
fn create_mock_input_message(event_id: &str, message_type: &str) -> InputMessage {
|
||||
InputMessage {
|
||||
message_type: message_type.to_string(),
|
||||
event: Note {
|
||||
id: event_id.to_string(),
|
||||
pubkey: "mock_pubkey".to_string(),
|
||||
created_at: 0,
|
||||
kind: 1,
|
||||
tags: vec![vec!["-".to_string()]],
|
||||
content: "mock_content".to_string(),
|
||||
sig: "mock_signature".to_string(),
|
||||
},
|
||||
received_at: 0,
|
||||
source_type: "mock_source".to_string(),
|
||||
source_info: "mock_source_info".to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function to create a mock OutputMessage
|
||||
fn create_mock_output_message(
|
||||
event_id: &str,
|
||||
action: Action,
|
||||
msg: Option<&str>,
|
||||
) -> OutputMessage {
|
||||
OutputMessage {
|
||||
id: event_id.to_string(),
|
||||
action,
|
||||
msg: msg.map(|s| s.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_register_builtin_filters() {
|
||||
let noteguard = Noteguard::new();
|
||||
assert!(noteguard.registered_filters.contains_key("ratelimit"));
|
||||
assert!(noteguard.registered_filters.contains_key("whitelist"));
|
||||
assert!(noteguard
|
||||
.registered_filters
|
||||
.contains_key("protected_events"));
|
||||
assert!(noteguard.registered_filters.contains_key("kinds"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_load_config() {
|
||||
let mut noteguard = Noteguard::new();
|
||||
|
||||
// Create a mock config with one filter (RateLimit)
|
||||
let config: Config = toml::from_str(
|
||||
r#"
|
||||
pipeline = ["ratelimit"]
|
||||
|
||||
[filters.ratelimit]
|
||||
posts_per_minute = 3
|
||||
"#,
|
||||
)
|
||||
.expect("Failed to parse config");
|
||||
|
||||
assert!(noteguard.load_config(&config).is_ok());
|
||||
assert_eq!(noteguard.loaded_filters.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_run_filters_accept() {
|
||||
let mut noteguard = Noteguard::new();
|
||||
|
||||
// Create a mock config with one filter (RateLimit)
|
||||
let config: Config = toml::from_str(
|
||||
r#"
|
||||
pipeline = ["ratelimit"]
|
||||
|
||||
[filters.ratelimit]
|
||||
posts_per_minute = 3
|
||||
"#,
|
||||
)
|
||||
.expect("Failed to parse config");
|
||||
|
||||
noteguard
|
||||
.load_config(&config)
|
||||
.expect("Failed to load config");
|
||||
|
||||
let input_message = create_mock_input_message("test_event_1", "new");
|
||||
let output_message = noteguard.run(input_message);
|
||||
|
||||
assert_eq!(output_message.action, Action::Accept);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_run_filters_shadow_reject() {
|
||||
let mut noteguard = Noteguard::new();
|
||||
|
||||
// Create a mock config with one filter (ProtectedEvents) which will shadow reject the input
|
||||
let config: Config = toml::from_str(
|
||||
r#"
|
||||
pipeline = ["protected_events"]
|
||||
|
||||
[filters.protected_events]
|
||||
"#,
|
||||
)
|
||||
.expect("Failed to parse config");
|
||||
|
||||
noteguard
|
||||
.load_config(&config)
|
||||
.expect("Failed to load config");
|
||||
|
||||
let input_message = create_mock_input_message("test_event_3", "new");
|
||||
let output_message = noteguard.run(input_message);
|
||||
|
||||
assert_eq!(output_message.action, Action::Reject);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_whitelist_reject() {
|
||||
let mut noteguard = Noteguard::new();
|
||||
|
||||
// Create a mock config with one filter (Whitelist) which will reject the input
|
||||
let config: Config = toml::from_str(
|
||||
r#"
|
||||
pipeline = ["whitelist"]
|
||||
[filters.whitelist]
|
||||
pubkeys = ["something"]
|
||||
"#,
|
||||
)
|
||||
.expect("Failed to parse config");
|
||||
|
||||
noteguard
|
||||
.load_config(&config)
|
||||
.expect("Failed to load config");
|
||||
|
||||
let input_message = create_mock_input_message("test_event_2", "new");
|
||||
let output_message = noteguard.run(input_message);
|
||||
|
||||
assert_eq!(output_message.action, Action::Reject);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_deserialize_input_message() {
|
||||
let input_json = r#"
|
||||
{
|
||||
"type": "new",
|
||||
"event": {
|
||||
"id": "test_event_5",
|
||||
"pubkey": "mock_pubkey",
|
||||
"created_at": 0,
|
||||
"kind": 1,
|
||||
"tags": [],
|
||||
"content": "mock_content",
|
||||
"sig": "mock_signature"
|
||||
},
|
||||
"receivedAt": 0,
|
||||
"sourceType": "mock_source",
|
||||
"sourceInfo": "mock_source_info"
|
||||
}
|
||||
"#;
|
||||
|
||||
let input_message: InputMessage =
|
||||
serde_json::from_str(input_json).expect("Failed to deserialize input message");
|
||||
assert_eq!(input_message.event.id, "test_event_5");
|
||||
assert_eq!(input_message.message_type, "new");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ pub struct InputMessage {
|
||||
pub source_info: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum Action {
|
||||
Accept,
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
use crate::{InputMessage, OutputMessage};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
#[derive(Deserialize)]
|
||||
pub struct Note {
|
||||
pub id: String,
|
||||
pub pubkey: String,
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
while true
|
||||
do
|
||||
note="$(nostril --silent --content hello)"
|
||||
echo "{\"type\": \"new\",\"receivedAt\":12345,\"sourceType\":\"IP4\",\"sourceInfo\": \"127.0.0.2\",\"event\":$note}"
|
||||
|
||||
sleep ${1:-0.1}
|
||||
done
|
||||
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.3","event":{"id":"eabb9491951fc64d85b6cba28a7d53c333c3f1d59779d63abccf9a8f61a0bdef","pubkey":"5f54041530509de28550475bfe73db709609a4ee1e59281527ba81692923418f","created_at":1722305142,"kind":1,"tags":[["t","lightning"],["t","zapping"],["t","introductions"],["t","freefrom"],["t","help"],["t","nostr"],["t","plebchain"],["t","zapathon"],["t","damus"],["t","bitcoin"],["t","anime"],["t","grownostr"],["t","music"],["t","programming"],["t","cat"],["t","dog"],["t","nsfw"],["t","asknostr"],["t","foodstr"],["t","sports"],["t","acg"],["t","game"],["t","movie"],["t","book"],["t","art"],["t","tech"],["t","science"]],"content":"Freefrom is running out of funds and is about to close down. Please scan the QR code to donate.\n Freefrom 资金不足即将倒闭,请扫描二维码捐款\n https://ice.frostsky.com/2024/07/29/9e447d397cac0c27993f0cbcb6efb235.png\n https://cdn.nostr.build/i/270de92fa4e5118a28352720b7f26c360aa2dbfdb1c12517f3e3117a2f9de47a.png\n ","sig":"6fa13bedffb2250e2437af6898ab3b11444eb3aef5fd4b484b25658632d283774186f98a024c225581cd9bbaccb0966fa1360d13fd5671f97c7f7bf515f94166"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.3","event":{"id": "70651d96a2b6b3431cc06b7543249ccd22ab5c203c6aa590b7688f916f252f8f","pubkey": "879d67486027539073d6531d271e3791b15c3e48becbfe4c3727e93355330cc8","created_at": 1720545068,"kind": 1,"tags": [["-"]],"content": "hello there","sig": "21a901e3663bac846493df588ad2185751a5a2826a64c26afb9edce8f9d9344cf00c1ea43016e7faca69da661eadd2731b457a0c31b207ab6ed509a047bf7845"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.3","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.3","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.1","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.1","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.1","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
@@ -4,6 +4,6 @@ while true
|
||||
do
|
||||
echo '{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}'
|
||||
|
||||
sleep ${1:-0.1}
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.1","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.1","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.1","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
{"type": "new","receivedAt":12345,"sourceType":"IP4","sourceInfo": "127.0.0.2","event":{"id": "68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","pubkey": "16c21558762108afc34e4ff19e4ed51d9a48f79e0c34531efc423d21ab435e93","created_at": 1720408658,"kind": 1,"tags": [],"content": "hi","sig": "7b76471744ded2b720ca832cdc89e670f6093ce38aeef55a5c6a4e077883d7d80dda1e9051032fb1faa1c3c212c517e93ee42b3ceac8e8e9b04bad46a361de90"}}
|
||||
Reference in New Issue
Block a user