def via_tailnet

near-v-framework@0.4.0.0 · domain/architecture/ops.bend:417

import near-v-framework@0.4.0.0/domain/architecture/ops.bend as Ops
import Base
import near-v-framework@0.4.0.0/general/compound/ops.bend as CO
import near-v-framework@0.4.0.0/general/compound/edge/type.bend as E
import near-v-framework@0.4.0.0/domain/architecture/system/container/type.bend as Ct

417# ---- a device reaches a server only over the tailnet ----
418def via_tailnet(es: List<&2, E.Edge>, +cs: List<&2, Ct.Container>, +servers: List<&2, String>, +devices: List<&2, String>) -> Bool:
419  match es:
420    case []:
421      True{}
422    case e <> rest:
423      match e:
424        case E.Edge{x, +y, _, _}:
425          (Bool.not(CO.has(devices, home(x, cs)) && CO.has(servers, home(y, cs))) || is_tailnet(exposure_of(home(y, cs), cs))) &&
426            via_tailnet(rest, cs, servers, devices)

Uses (12)

Used by (1)