Browse Source

Add link local wireguard helper methods

master
clerie 2 years ago
parent
commit
4198653fd6
  1. 22
      lib/link-local-wireguard.nix

22
lib/link-local-wireguard.nix

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
{ ... }:
rec {
llIPv6 = localIP: peerIP: interface: {
ips = [
"${localIP}/128"
];
postSetup = ''
ip -6 route flush dev ${interface}
ip addr del dev ${interface} ${localIP}/128 && ip addr add dev ${interface} ${localIP}/128 peer ${peerIP}/128
'';
};
llIPv4 = localIP: peerIP: interface: {
ips = [
"${localIP}/32"
];
postSetup = ''
ip -4 route flush dev ${interface}
ip addr del dev ${interface} ${localIP}/32 && ip addr add dev ${interface} ${localIP}/32 peer ${peerIP}/32
'';
};
}
Loading…
Cancel
Save