From 2dcbdffc28b9eeaab68eb7c90eb8813899bd9546 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Wed, 6 Jan 2021 09:30:14 +0100 Subject: Implementing VPN connections. --- src/main/resources/io/trygvis/rules/acme/vpn.drl | 27 ++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src/main/resources/io/trygvis/rules/acme/vpn.drl') diff --git a/src/main/resources/io/trygvis/rules/acme/vpn.drl b/src/main/resources/io/trygvis/rules/acme/vpn.drl index 0f0b3c8..456cbae 100644 --- a/src/main/resources/io/trygvis/rules/acme/vpn.drl +++ b/src/main/resources/io/trygvis/rules/acme/vpn.drl @@ -71,15 +71,30 @@ then insert(DnsEntry.a(fqdn)) end +declare WgConnection + host : String + to : String +end + rule "Connect VPN nodes" salience -1 when $h : WgHost() - $others : ArrayList() - from collect(WgHost(publicName != null, name != $h.name)) + $other : WgHost(publicName != null, name != $h.name) then - System.out.printf("Connection from %s%n", $h.name); - for (WgHost host : $others) { - System.out.printf(" %s%n", host.name); - } + insert(new WgConnection($h.name, $other.name)) end + +//declare AllocatedIp +// owner : Object +// ip : Ipv4Address +//end +// +//rule "Assign IP" +//when +// $host : WgHost() +// $ip : Ipv4Address() +//then +// var allocation = new AllocatedIp($host, $ip); +// insert(allocation) +//end -- cgit v1.2.3