diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2023-10-27 11:07:12 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2023-10-27 11:07:12 +0200 |
commit | 14fb889f021c50763d21c77ff0f25e8bdbabd3a9 (patch) | |
tree | 2633c228f2e5113fd4982acbf3367bc2d717c6eb | |
parent | 276ca263fd7f9d86af3076cae5c81a59c38e915e (diff) | |
download | prolog-firewall-14fb889f021c50763d21c77ff0f25e8bdbabd3a9.tar.gz prolog-firewall-14fb889f021c50763d21c77ff0f25e8bdbabd3a9.tar.bz2 prolog-firewall-14fb889f021c50763d21c77ff0f25e8bdbabd3a9.tar.xz prolog-firewall-14fb889f021c50763d21c77ff0f25e8bdbabd3a9.zip |
wip
-rw-r--r-- | 2.dl | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -0,0 +1,40 @@ +#lang datalog + +edge(a, b). edge(b, c). edge(c, d). edge(d, a). +path(X, Y) :- edge(X, Y). +path(X, Y) :- edge(X, Z), path(Z, Y). + +public-key(conflatorio, "pk conflatorio"). +public-key(lhn2ix, "pk lhn2ix"). +public-key(knot, "pk knot"). + +router-link(knot,lhn2ix, "1:1::1"). +router-link(knot,kv24ix, "1:1::2"). +router-link(lhn2ix, knot, "1:2::1"). +router-link(lhn2ix, conflatorio, "1:2::2"). +router-link(conflatorio, lhn2ix, "1:3::1"). + +% network(R, address, range) +network(lhn2ix, "1:dbea::", 64). +network(conflatorio, "1:e5b0::", 64). +network(knot, "1:f11b::", 64). + +host(H) :- router-link(H, B, Ip). +host(H) :- router-link(A, H, Ip). +host(H)? + +bgp-connection(H, R) :- + host(H), host(R), + router-link(H, R, IpH), + router-link(R, H, IpR). + +bgp-connection(H, Remote)? + +wg-if(H, R, PK) :- bgp-connection(H, R), public-key(R, PK). +wg-if(H, R, PK)? +wg-if-allowed-ips(H, Ip, 128) :- bgp-connection(H, R), router-link(H, R, Ip). +wg-if-allowed-ips(H, Ip, Range) :- bgp-connection(H, R), network(R, Ip, Range). +wg-if-allowed-ips(H, Ip, Range)? + +bgp-config(H) :- bgp-connection(H, Name). +bgp-config(H)? |