blob: 4ee1a866d8d54ad04a53120798b4497f8a5a91ff (
plain)
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
|
#!/bin/bash
# This file serves as as an example of how I launch the debug server and client in a tmux session for what I call "Bodeting" (Bodet Alarm and Gong) testing
# Parse command line arguments
SUDO_PASSWORD="mlol-no"
while getopts "p:" opt; do
case $opt in
p) SUDO_PASSWORD="$OPTARG" ;;
*) echo "Usage: $0 [-p sudo_password]" >&2; exit 1 ;;
esac
done
# Create directory for client configs if it doesn't exist
mkdir -p configs
# Create server config with multicast groups
cat > configs/server_config.toml << EOF
secret = "bodeting-secret-key-so-much-secure"
listen_ip = "0.0.0.0"
listen_port = 8989
simple_auth = true
[multicast_groups]
# Bodet Alarm group for 239.192.55.2
[multicast_groups.bodetalarm]
address = "239.192.55.2"
port = 1681
# Bodet Gong group for 239.192.55.1
[multicast_groups.bodetgong]
address = "239.192.55.1"
port = 1681
# Test client authorizations
[[authorized_clients]]
name = "localhost"
ip_address = "127.0.0.1"
group_ids = [] # Empty means all groups
EOF
# Create debug agent config
cat > configs/debug_agent_config.toml << EOF
secret = "bodeting-secret-key-so-much-secure"
server = "127.0.0.1"
port = 8989
multicast_group_ids = []
# Set to true for debug mode
test_mode = true
EOF
# Check if tmux is already running
if [ -z "$TMUX" ]; then
# Start a new tmux session
tmux new-session -d -s debug_server
# Split the window horizontally (side by side)
tmux split-window -h -t debug_server:0.0
# Configure the left pane for the server
if [ -n "$SUDO_PASSWORD" ]; then
tmux send-keys -t debug_server:0.0 "cd $(pwd) && clear && echo 'Starting server...' && echo '$SUDO_PASSWORD' | sudo -S RUST_LOG=debug ./target/release/castrepeat-server --config configs/server_config.toml" C-m
else
tmux send-keys -t debug_server:0.0 "cd $(pwd) && clear && echo 'Starting server...' && sudo RUST_LOG=debug ./target/release/castrepeat-server --config configs/server_config.toml" C-m
fi
# Give the server a moment to start up
sleep 2
# Configure the right pane for the debug agent
tmux send-keys -t debug_server:0.1 "cd $(pwd) && clear && echo 'Starting debug agent...' && RUST_LOG=debug ./target/release/castrepeat-client --config configs/debug_agent_config.toml" C-m
# If you need to test multicast traffic generation, you can add:
# tmux split-window -v -t debug_server:0.1
# tmux send-keys -t debug_server:0.2 "cd $(pwd) && clear && echo 'Starting multicast generator...' && RUST_LOG=debug ./target/release/castrepeat-mcast-test" C-m
# Attach to the session
tmux attach-session -t debug_server
else
echo "Already in a tmux session. Please exit current tmux session before running this script."
exit 1
fi
|