bundlewrap/bundles/wireguard/files/pppd-ip-up

13 lines
394 B
Bash

#!/bin/bash
# We need to send some traffic over the wireguard tunnel to make sure
# it gets connected. Easiest way is to simply send some pings to the
# other side.
% for peer, config in node.metadata.get('wireguard/peers', {}).items():
% for ip in sorted(config['ips']):
# refresh connection to ${peer} ${ip}
/usr/bin/ping -c 4 ${ip.split('/')[0] if '/' in ip else ip}
% endfor
% endfor