Created
February 18, 2024 13:30
-
-
Save elico/f64211ede55ae783974d8e22579a0163 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:local endpoint www.example.com; | |
:local wireguardInterface wireguard3; | |
:local wireguardInterfacePort [/interface/wireguard/get $wireguardInterface listen-port]; | |
:foreach i in=[/interface/wireguard/peers/find where disabled=no endpoint-address=$endpoint] do={ | |
:local LastHandshake [/interface/wireguard/peers/get $i last-handshake]; | |
:if (([:tostr $LastHandshake] = "") or ($LastHandshake > [:totime "5m"])) do={ | |
/interface/wireguard/set 0 listen-port=$wireguardInterfacePort name=$wireguardInterface; | |
:log warning "fixed wireguard"; | |
} else { | |
:log warning "Didn't fixed wireguard since it's ok" ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment