Skip to content

Instantly share code, notes, and snippets.

@elico
Created February 18, 2024 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elico/f64211ede55ae783974d8e22579a0163 to your computer and use it in GitHub Desktop.
Save elico/f64211ede55ae783974d8e22579a0163 to your computer and use it in GitHub Desktop.
: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