Add link local wireguard helper methods
This commit is contained in:
parent
e8797c6ad0
commit
4198653fd6
22
lib/link-local-wireguard.nix
Normal file
22
lib/link-local-wireguard.nix
Normal file
@ -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…
Reference in New Issue
Block a user