Преглед изворни кода

contrib/localnet: Five peers for ircd sim.

Luther Blissett пре 3 година
родитељ
комит
565bb2ff12

+ 22 - 0
contrib/localnet/ircd-five-peers/README.md

@@ -0,0 +1,22 @@
+ircd-five-peers
+===============
+
+A local simulation of an ircd network with the topology of five peers.
+
+Connections:
+
+* `A <--> B`
+* `A <--> C`
+* `A <--> D`
+* `B <--> E`
+
+
+## Ports
+
+|Node|JSON-RPC|  P2P  |  IRC  |
+|----|--------|-------|-------|
+| A  | 25550  | 25560 | 25570 |
+| B  | 25551  | 25561 | 25571 |
+| C  | 25552  | 25562 | 25572 |
+| D  | 25553  | 25563 | 25573 |
+| E  | 25554  | 25564 | 25574 |

+ 13 - 0
contrib/localnet/ircd-five-peers/ircd_a.toml

@@ -0,0 +1,13 @@
+# Node A
+rpc_listen = "tcp://127.0.0.1:25550"
+irc_listen = "tcp://127.0.0.1:25570"
+
+[net]
+outbound_connections = 0
+inbound = ["tls://127.0.0.1:25560"]
+external_addr = ["tls://127.0.0.1:25560"]
+seeds = []
+peers = []
+
+[channel."#plain"]
+topic = "Plain unencrypted channel"

+ 5 - 3
contrib/localnet/ircd-three-peers/ircd_b.toml → contrib/localnet/ircd-five-peers/ircd_b.toml

@@ -1,12 +1,14 @@
-rpc_listen = "tcp://127.0.0.1:25560"
-irc_listen = "tcp://127.0.0.1:6668"
+# Node B
+
+rpc_listen = "tcp://127.0.0.1:25551"
+irc_listen = "tcp://127.0.0.1:25571"
 
 [net]
 outbound_connections = 0
 inbound = ["tls://127.0.0.1:25561"]
 external_addr = ["tls://127.0.0.1:25561"]
 seeds = []
-peers = ["tls://127.0.0.1:25551"]
+peers = ["tls://127.0.0.1:25560"]
 
 [channel."#encrypted"]
 topic ="Encrypted channel"

+ 6 - 5
contrib/localnet/ircd-three-peers/ircd_c.toml → contrib/localnet/ircd-five-peers/ircd_c.toml

@@ -1,12 +1,13 @@
-rpc_listen = "tcp://127.0.0.1:25570"
-irc_listen = "tcp://127.0.0.1:6669"
+# Node C
+rpc_listen = "tcp://127.0.0.1:25552"
+irc_listen = "tcp://127.0.0.1:25572"
 
 [net]
 outbound_connections = 0
-inbound = ["tls://127.0.0.1:25571"]
-external_addr = ["tls://127.0.0.1:25571"]
+inbound = ["tls://127.0.0.1:25562"]
+external_addr = ["tls://127.0.0.1:25562"]
 seeds = []
-peers = ["tls://127.0.0.1:25551"]
+peers = ["tls://127.0.0.1:25560"]
 
 [channel."#encrypted"]
 topic ="Encrypted channel"

+ 17 - 0
contrib/localnet/ircd-five-peers/ircd_d.toml

@@ -0,0 +1,17 @@
+# Node D
+rpc_listen = "tcp://127.0.0.1:25553"
+irc_listen = "tcp://127.0.0.1:25573"
+
+[net]
+outbound_connections = 0
+inbound = ["tls://127.0.0.1:25563"]
+external_addr = ["tls://127.0.0.1:25563"]
+seeds = []
+peers = ["tls://127.0.0.1:25560"]
+
+[channel."#encrypted"]
+topic ="Encrypted channel"
+secret = "7CkVuFgwTUpJn5Sv67Q3fyEDpa28yrSeL5Hg2GqQ4jfM"
+
+[channel."#plain"]
+topic = "Plain unencrypted channel"

+ 17 - 0
contrib/localnet/ircd-five-peers/ircd_e.toml

@@ -0,0 +1,17 @@
+# Node D
+rpc_listen = "tcp://127.0.0.1:25554"
+irc_listen = "tcp://127.0.0.1:25574"
+
+[net]
+outbound_connections = 0
+inbound = ["tls://127.0.0.1:25564"]
+external_addr = ["tls://127.0.0.1:25564"]
+seeds = []
+peers = ["tls://127.0.0.1:25561"]
+
+[channel."#encrypted"]
+topic ="Encrypted channel"
+secret = "7CkVuFgwTUpJn5Sv67Q3fyEDpa28yrSeL5Hg2GqQ4jfM"
+
+[channel."#plain"]
+topic = "Plain unencrypted channel"

+ 33 - 0
contrib/localnet/ircd-five-peers/tmux_sessions.sh

@@ -0,0 +1,33 @@
+#!/bin/sh
+# Start a tmux session of five ircd nodes, and optionally 5 weechat clients.
+set -e
+
+tmux new-session -s "ircd" -n "ircd" -d
+tmux send-keys "../../../ircd --config ircd_a.toml" Enter && sleep 1
+tmux split-window -h
+tmux send-keys "../../../ircd --config ircd_b.toml" Enter && sleep 1
+tmux select-pane -t 0
+tmux split-window -v
+tmux send-keys "../../../ircd --config ircd_c.toml" Enter
+tmux select-pane -t 2
+tmux split-window -v
+tmux send-keys "../../../ircd --config ircd_d.toml" Enter
+tmux split-window -h
+tmux send-keys "../../../ircd --config ircd_e.toml" Enter
+
+if [ -z "$1" ]; then
+	tmux new-window -t "ircd:1" -n "weechat"
+	tmux send-keys "weechat -t -r '/server add ircd_a 127.0.0.1/25570;/connect ircd_a'" Enter
+	tmux split-window -v
+	tmux send-keys "weechat -t -r '/server add ircd_b 127.0.0.1/25571;/connect ircd_b'" Enter
+	tmux split-window -v
+	tmux send-keys "weechat -t -r '/server add ircd_c 127.0.0.1/25572;/connect ircd_c'" Enter
+	tmux select-pane -t 0
+	tmux split-window -h
+	tmux send-keys "weechat -t -r '/server add ircd_d 127.0.0.1/25573;/connect ircd_d'" Enter
+	tmux select-pane -t 2
+	tmux split-window -h
+	tmux send-keys "weechat -t -r '/server add ircd_e 127.0.0.1/25574;/connect ircd_e'" Enter
+fi
+
+tmux attach

+ 0 - 12
contrib/localnet/ircd-three-peers/README.md

@@ -1,12 +0,0 @@
-ircd-three-peers
-================
-
-A local simulation of an ircd network with the topology of three peers.
-
-Connections:
-
-* `A <--> B`
-* `A <--> C`
-
-Used to confirm that messages sent **from** `C` end up at `B`, by being
-relayed through peer `A`.

+ 0 - 13
contrib/localnet/ircd-three-peers/ircd_a.toml

@@ -1,13 +0,0 @@
-rpc_listen = "tcp://127.0.0.1:25550"
-irc_listen = "tcp://127.0.0.1:6667"
-
-[net]
-outbound_connections = 0
-inbound = ["tls://127.0.0.1:25551"]
-external_addr = ["tls://127.0.0.1:25551"]
-seeds = []
-#peers = ["tls://127.0.0.1:25561", "tls://127.0.0.1:25571"]
-peers = []
-
-[channel."#plain"]
-topic = "Plain unencrypted channel"

+ 0 - 27
contrib/localnet/ircd-three-peers/tmux_sessions.sh

@@ -1,27 +0,0 @@
-#!/bin/sh
-set -e
-
-# Start a tmux session of three ircd nodes.
-
-tmux new-session -s "ircd" -n "ircd" -d
-tmux send-keys "../../../ircd --config ircd_a.toml" Enter
-sleep 1
-tmux split-window -v
-tmux send-keys "../../../ircd --config ircd_b.toml" Enter
-sleep 1
-tmux select-pane -t 0
-tmux split-window -h
-tmux send-keys "../../../ircd --config ircd_c.toml" Enter
-
-if [ -z "$1" ]; then
-	tmux new-window -t "ircd:1" -n weechat
-	tmux send-keys "weechat -t -r '/server add ircd_a 127.0.0.1/6667;/connect ircd_a'" Enter
-	sleep 0.5
-	tmux split-window -v
-	tmux send-keys "weechat -t -r '/server add ircd_b 127.0.0.1/6668;/connect ircd_b'" Enter
-	sleep 0.5
-	tmux split-window -v
-	tmux send-keys "weechat -t -r '/server add ircd_c 127.0.0.1/6669;/connect ircd_c'" Enter
-fi
-
-tmux attach