diff options
-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)? |