Compare commits

..

No commits in common. "511d58e9c575cc299adc4cee2f277995006b483f" and "bba90437204a6ad9e4adb2090428f3d03caa04f8" have entirely different histories.

2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
# bambulab-wireguard-proxy # bambulab-wireguard-proxy
``` ```
docker run --rm -it --network container:firezone-firezone-1 --cap-add NET_ADMIN git.f3l.de/asdil12/bambulab-wireguard-proxy:latest docker run --rm -it --network container:firezone-firezone-1 --cap-add NET_ADMIN python:3.11-alpine /bin/sh
``` ```
Send SSDP announcements that imitate the Bambulab printer to each wireguard peer. Send SSDP announcements that imitate the Bambulab printer to each wireguard peer.

View file

@ -26,11 +26,11 @@ while True:
ips = pl.split("\t")[3] ips = pl.split("\t")[3]
for ip in ips.split(","): for ip in ips.split(","):
if ip.endswith("/32"): if ip.endswith("/32"):
UDP_IP = ip[:-3] print(ip[:-3])
print(f"{UDP_IP}:{UDP_PORT} {MESSAGE=}" % MESSAGE) print(f"{ip}:{UDP_PORT} {MESSAGE=}" % MESSAGE)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.bind(('0.0.0.0', 1900)) # 1900 is SSDP src port sock.bind(('0.0.0.0', 1900)) # 1900 is SSDP src port
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT)) sock.sendto(MESSAGE, (ip, UDP_PORT))
sock.close() sock.close()
time.sleep(10) time.sleep(10)