fix(telemetry & mesh): align prometheus/grafana compose mounts, add mesh gateway_mode.sh, and enhance file_transfer CLI
This commit is contained in:
1 parent
49d690e316
commit
06211f6959
4 files changed
+43
-3
No files matched your search
Executable
+22
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# OpenWrt BATMAN-adv Gateway Mode Configuration
|
||||||
|
# Engineered for Aira Internet Tower (AIT)
|
||||||
|
# Run on the node connected to upstream backhaul (Fibre / K-FON / ISP)
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "[*] Configuring B.A.T.M.A.N.-adv Gateway Server Mode..."
|
||||||
|
if command -v batctl >/dev/null 2>&1; then
|
||||||
|
batctl gw_mode server 50mbit/10mbit || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v uci >/dev/null 2>&1; then
|
||||||
|
uci set batman-adv.bat0.gw_mode='server'
|
||||||
|
uci set batman-adv.bat0.gw_bandwidth='50mbit/10mbit'
|
||||||
|
uci commit batman-adv
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[*] Enabling IPv4 packet forwarding in kernel..."
|
||||||
|
sysctl -w net.ipv4.ip_forward=1 >/dev/null 2>&1 || echo "1" > /proc/sys/net/ipv4/ip_forward
|
||||||
|
|
||||||
|
echo "[+] Gateway mode active. Mesh client nodes will automatically route through this uplink."
|
||||||
File renamed without changes.
File renamed without changes.
@@ -1,14 +1,32 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Tiny file transfer. Receive: file_transfer.py recv OUT ; Send: file_transfer.py send HOST FILE"""
|
"""Tiny file transfer. Receive: file_transfer.py recv OUT ; Send: file_transfer.py send HOST FILE"""
|
||||||
import socket, sys, os
|
import socket, sys, os
|
||||||
|
|
||||||
PORT = 9002
|
PORT = 9002
|
||||||
|
|
||||||
|
if len(sys.argv) < 3 or sys.argv[1] not in ("recv", "send"):
|
||||||
|
print("Usage:\n Receive: python3 file_transfer.py recv <output_file>\n Send: python3 file_transfer.py send <host> <input_file>")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if sys.argv[1] == "recv":
|
if sys.argv[1] == "recv":
|
||||||
with socket.socket() as s:
|
with socket.socket() as s:
|
||||||
s.bind(("0.0.0.0", PORT)); s.listen(1)
|
s.bind(("0.0.0.0", PORT)); s.listen(1)
|
||||||
|
print(f"[*] Listening for incoming file transfer on port {PORT}...")
|
||||||
conn, a = s.accept()
|
conn, a = s.accept()
|
||||||
with conn, open(os.path.basename(sys.argv[2]), "wb") as f:
|
out_filename = os.path.basename(sys.argv[2])
|
||||||
|
with conn, open(out_filename, "wb") as f:
|
||||||
while chunk := conn.recv(65536): f.write(chunk)
|
while chunk := conn.recv(65536): f.write(chunk)
|
||||||
print("received from", a)
|
print(f"[+] Successfully received file '{out_filename}' from {a}")
|
||||||
else:
|
else:
|
||||||
with socket.create_connection((sys.argv[2], PORT)) as s, open(sys.argv[3], "rb") as f:
|
if len(sys.argv) < 4:
|
||||||
|
print("Usage for send: python3 file_transfer.py send <host> <input_file>")
|
||||||
|
sys.exit(1)
|
||||||
|
target_host = sys.argv[2]
|
||||||
|
source_file = sys.argv[3]
|
||||||
|
if not os.path.exists(source_file):
|
||||||
|
print(f"[-] Error: Source file '{source_file}' does not exist.")
|
||||||
|
sys.exit(1)
|
||||||
|
with socket.create_connection((target_host, PORT)) as s, open(source_file, "rb") as f:
|
||||||
|
print(f"[*] Sending '{source_file}' to {target_host}:{PORT}...")
|
||||||
while chunk := f.read(65536): s.sendall(chunk)
|
while chunk := f.read(65536): s.sendall(chunk)
|
||||||
|
print("[+] File transmission complete.")
|
||||||
Reference in new issue
Block a user