diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-06 09:12:56 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-06 09:12:56 +0100 |
commit | bd2208922ea6a0486074c72a57b01d7df368f885 (patch) | |
tree | 1fca7e8f5c013f0ea9e99a942c47213842f96d50 /src/main/resources | |
parent | 9e353ef7af8164d33544a890e60d2049de7d61cb (diff) | |
download | rules-sandbox-bd2208922ea6a0486074c72a57b01d7df368f885.tar.gz rules-sandbox-bd2208922ea6a0486074c72a57b01d7df368f885.tar.bz2 rules-sandbox-bd2208922ea6a0486074c72a57b01d7df368f885.tar.xz rules-sandbox-bd2208922ea6a0486074c72a57b01d7df368f885.zip |
Generating IP addresses.
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/io/trygvis/rules/acme/vpn.drl | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/main/resources/io/trygvis/rules/acme/vpn.drl b/src/main/resources/io/trygvis/rules/acme/vpn.drl index 90cdce2..0f0b3c8 100644 --- a/src/main/resources/io/trygvis/rules/acme/vpn.drl +++ b/src/main/resources/io/trygvis/rules/acme/vpn.drl @@ -4,13 +4,30 @@ import java.util.ArrayList import io.trygvis.rules.machine.Machine; import io.trygvis.rules.dns.DnsEntry; import io.trygvis.rules.acme.AcmeServer -import io.trygvis.rules.acme.WgHost; +import io.trygvis.rules.network.Ipv4Address +import io.trygvis.rules.network.Ipv4Cidr dialect "mvel" declare WgNet - name : String - domain : String + name : String + domain : String + linkCidr : String + networkCidr : String +end + +rule "Create link network" when + $net : WgNet() + not(Ipv4Cidr(network == IpCalc.cidr($net.linkCidr).network)) +then + insert(IpCalc.cidr($net.linkCidr)) +end + +rule "Create link network addresses" when + $cidr : Ipv4Cidr() + $addresses : Ipv4Address() from $cidr.addresses +then + insert($addresses) end declare WgHost |