43 lines
879 B
Python
43 lines
879 B
Python
import subprocess
|
|
|
|
def main():
|
|
for i in range(100):
|
|
node_add(i)
|
|
node_connect(i, i + 1)
|
|
|
|
def node_add(node_id):
|
|
config = f"""
|
|
[reticulum]
|
|
|
|
enable_transport = True
|
|
|
|
share_instance = Yes
|
|
shared_instance_port = {30000 + node_id}
|
|
instance_control_port = {40000 + node_id}
|
|
|
|
[interfaces]
|
|
|
|
[[Standard Server Interface]]
|
|
type = TCPServerInterface
|
|
interface_enabled = True
|
|
listen_ip = localhost
|
|
listen_port = {50000 + node_id}
|
|
"""
|
|
subprocess.run(["mkdir", "-p", f"nodes/{node_id}"])
|
|
|
|
with open(f"nodes/{node_id}/config", "w+") as file:
|
|
file.write(config)
|
|
|
|
def node_connect(node1, node2):
|
|
with open(f"nodes/{node1}/config", "a") as file:
|
|
file.write(f"""
|
|
[[Connected to Node: {node2}]]
|
|
type = TCPClientInterface
|
|
interface_enabled = True
|
|
target_host = localhost
|
|
target_port = {50000 + node2}
|
|
#END
|
|
""")
|
|
|
|
if __name__ == "__main__":
|
|
main() |