mirror of
https://github.com/mikedilger/chorus.git
synced 2026-05-03 06:51:42 +00:00
Compare commits
3 Commits
72c874ff37
...
3f15894aaa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f15894aaa | ||
|
|
2ca4b17b73 | ||
|
|
e5251e0f57 |
@ -10,10 +10,10 @@
|
|||||||
2) Users and moderators are now dynamically configured in the database. Use `chorus_cmd` to
|
2) Users and moderators are now dynamically configured in the database. Use `chorus_cmd` to
|
||||||
manage them from the command line:
|
manage them from the command line:
|
||||||
|
|
||||||
* Adding a user: `chorus_cmd add_user <pubkey> 0`
|
* Adding a user: `chorus_cmd <chorus.toml> add_user <pubkey> 0`
|
||||||
* Adding a moderator: `chorus_cmd add_user <pubkey> 1`
|
* Adding a moderator: `chorus_cmd <chorus.toml> add_user <pubkey> 1`
|
||||||
* Removing a user or moderator: `chorus_cmd rm_user <pubkey>`
|
* Removing a user or moderator: `chorus_cmd <chorus.toml> rm_user <pubkey>`
|
||||||
* Listing users and moderators: `chorus_cmd dump_users`
|
* Listing users and moderators: `chorus_cmd <chorus.toml> dump_users`
|
||||||
|
|
||||||
3) Remove the following from your config file as these are no longer used:
|
3) Remove the following from your config file as these are no longer used:
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,7 @@ fn main() -> Result<(), Error> {
|
|||||||
// Get args (config path)
|
// Get args (config path)
|
||||||
let mut args = env::args();
|
let mut args = env::args();
|
||||||
if args.len() <= 1 {
|
if args.len() <= 1 {
|
||||||
panic!("USAGE: chorus_moderate <config_path>");
|
panic!("USAGE: chorus_cmd <config_path> <command> [args...]");
|
||||||
}
|
}
|
||||||
let _ = args.next(); // ignore program name
|
let _ = args.next(); // ignore program name
|
||||||
|
|
||||||
|
|||||||
27
src/bin/chorus_init.rs
Normal file
27
src/bin/chorus_init.rs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
use chorus::error::Error;
|
||||||
|
use chorus::globals::GLOBALS;
|
||||||
|
use std::env;
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() -> Result<(), Error> {
|
||||||
|
// Get args (config path)
|
||||||
|
let mut args = env::args();
|
||||||
|
if args.len() <= 1 {
|
||||||
|
panic!("USAGE: chorus <config_path>");
|
||||||
|
}
|
||||||
|
let _ = args.next(); // ignore program name
|
||||||
|
let config_path = args.next().unwrap();
|
||||||
|
|
||||||
|
let config = chorus::load_config(&config_path)?;
|
||||||
|
|
||||||
|
chorus::setup_logging(&config);
|
||||||
|
|
||||||
|
// Log host name
|
||||||
|
log::info!(target: "Server", "HOSTNAME = {}", config.hostname);
|
||||||
|
|
||||||
|
chorus::setup_store(&config)?;
|
||||||
|
|
||||||
|
let _ = GLOBALS.store.get().unwrap().sync();
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
3
test_with_relay_tester/.gitignore
vendored
Normal file
3
test_with_relay_tester/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
data
|
||||||
|
relay-tester
|
||||||
|
|
||||||
12
test_with_relay_tester/README.md
Normal file
12
test_with_relay_tester/README.md
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Testing Chorus with relay-tester
|
||||||
|
|
||||||
|
First, git clone https://github.com/mikedilger/relay-tester and build that project
|
||||||
|
(cargo build --release).
|
||||||
|
|
||||||
|
Then copy that target/release/relay-tester binary into this directory.
|
||||||
|
|
||||||
|
Then run from two different shells, in this order:
|
||||||
|
|
||||||
|
shell1: ./test_chorus.sh
|
||||||
|
|
||||||
|
shell2: ./run_relay_tester.sh
|
||||||
12
test_with_relay_tester/run_relay_tester.sh
Executable file
12
test_with_relay_tester/run_relay_tester.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ ! -x relay-tester ] ; then
|
||||||
|
echo "You must build https://github.com/mikedilge/relay-tester and copy the "
|
||||||
|
echo "resultant target/release/relay-tester binary into this directory."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
./relay-tester \
|
||||||
|
ws://localhost:8080/ \
|
||||||
|
nsec16xfd467kyd3xpu9x5u4933u00v73xrl0jyq9rk5ktd9t2j38k20qtwxuj3 \
|
||||||
|
nsec1l50yuf6uxm2l5qxm87fkm56z3m7g88jnfy5s6az5wscxpu5l2yqq6qwk88
|
||||||
10
test_with_relay_tester/test_chorus.sh
Executable file
10
test_with_relay_tester/test_chorus.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Use ws://localhost:8080/ as the relay url"
|
||||||
|
|
||||||
|
cargo build --release
|
||||||
|
rm -rf ./data/
|
||||||
|
../target/release/chorus_init ./test_chorus.toml
|
||||||
|
../target/release/chorus_cmd ./test_chorus.toml add_user de16d3ed2d5ceb91d33e39dbe30585164e0c19f3f2e2a5b121def086b447a2e5 0
|
||||||
|
../target/release/chorus_cmd ./test_chorus.toml add_user 35d6bbcf17fc31a9c4f7a2f68aa40ad32c8f9de1ae77505dc5eb3722d8b2987d 0
|
||||||
|
../target/release/chorus ./test_chorus.toml
|
||||||
40
test_with_relay_tester/test_chorus.toml
Normal file
40
test_with_relay_tester/test_chorus.toml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# See contrib/chorus.toml for a documented config file
|
||||||
|
|
||||||
|
data_directory = "./data"
|
||||||
|
ip_address = "127.0.0.1"
|
||||||
|
port = 8080
|
||||||
|
hostname = "localhost"
|
||||||
|
chorus_is_behind_a_proxy = false
|
||||||
|
use_tls = false
|
||||||
|
certchain_pem_path = "tls/fullchain.pem"
|
||||||
|
key_pem_path = "tls/privkey.pem"
|
||||||
|
name = "Chorus Sample"
|
||||||
|
description = "A sample run of the Chorus relay"
|
||||||
|
#icon_url =
|
||||||
|
open_relay = false
|
||||||
|
admin_hex_keys = [
|
||||||
|
"ee11a5dff40c19a555f41fe42b48f00e618c91225622ae37b6c2bb67b76c4e49",
|
||||||
|
|
||||||
|
# npub1mctd8mfdtn4er5e788d7xpv9ze8qcx0n7t32tvfpmmcgddz85tjsuyxe7z
|
||||||
|
"de16d3ed2d5ceb91d33e39dbe30585164e0c19f3f2e2a5b121def086b447a2e5",
|
||||||
|
|
||||||
|
# npub1xhtthnchlsc6n38h5tmg4fq26vkgl80p4em4qhw9avmj9k9jnp7sm78ql6
|
||||||
|
"35d6bbcf17fc31a9c4f7a2f68aa40ad32c8f9de1ae77505dc5eb3722d8b2987d"
|
||||||
|
]
|
||||||
|
verify_events = true
|
||||||
|
allow_scraping = false
|
||||||
|
allow_scrape_if_limited_to = 100
|
||||||
|
allow_scrape_if_max_seconds = 7200
|
||||||
|
max_subscriptions = 128
|
||||||
|
serve_ephemeral = true
|
||||||
|
serve_relay_lists = true
|
||||||
|
server_log_level = "Info"
|
||||||
|
library_log_level = "Info"
|
||||||
|
client_log_level = "Debug"
|
||||||
|
enable_ip_blocking = false
|
||||||
|
minimum_ban_seconds = 1
|
||||||
|
timeout_seconds = 60
|
||||||
|
max_connections_per_ip = 5
|
||||||
|
throttling_bytes_per_second = 131072
|
||||||
|
throttling_burst = 4194304
|
||||||
|
enable_negentropy = true
|
||||||
Loading…
x
Reference in New Issue
Block a user