summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2021-01-06 09:30:14 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2021-01-06 09:30:14 +0100
commit2dcbdffc28b9eeaab68eb7c90eb8813899bd9546 (patch)
tree063376df72cd1d5a26dc3a43741db9c8e8ded1f0 /src/main
parent8c38e6ca614b22c39ef2fca549d9eb2265304baa (diff)
downloadrules-sandbox-2dcbdffc28b9eeaab68eb7c90eb8813899bd9546.tar.gz
rules-sandbox-2dcbdffc28b9eeaab68eb7c90eb8813899bd9546.tar.bz2
rules-sandbox-2dcbdffc28b9eeaab68eb7c90eb8813899bd9546.tar.xz
rules-sandbox-2dcbdffc28b9eeaab68eb7c90eb8813899bd9546.zip
Implementing VPN connections.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/trygvis/rules/network/Ipv4Cidr.java2
-rw-r--r--src/main/resources/io/trygvis/rules/acme/vpn.drl27
2 files changed, 21 insertions, 8 deletions
diff --git a/src/main/java/io/trygvis/rules/network/Ipv4Cidr.java b/src/main/java/io/trygvis/rules/network/Ipv4Cidr.java
index 6e1dde9..e69cd02 100644
--- a/src/main/java/io/trygvis/rules/network/Ipv4Cidr.java
+++ b/src/main/java/io/trygvis/rules/network/Ipv4Cidr.java
@@ -6,8 +6,6 @@ import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
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