Skip to content

Latest commit

History

44 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

policy

cicodecovLicense: AGPL-3.0

Policy plugin and expression language for the Pilot Protocol daemon. The repo ships two packages:

  • policy/ — a coreapi.Service adapter that loads per-network policy files and emits decisions on the event bus.
  • policy/policylang/ — the expr-lang/expr–backed evaluator. Used by the plugin and by cmd/pilotctl for policy linting.

Install

import (
"github.com/pilot-protocol/policy""github.com/pilot-protocol/policy/policylang"
)

Usage

p, err:=policylang.Parse(jsonBytes)
iferr!=nil {
returnerr
}
_=prt.Register(policy.NewService(policy.Config{
PolicyDir: "~/.pilot/policy",
}))

Layout

Root package (github.com/pilot-protocol/policy)

FileWhat it does
runtime.goLoads/reloads policy files and watches the policy dir.
runner.goPer-network expression runner; binds events to the evaluator.
peer.goPer-peer rate/scope state used by directives.
aliases.goRe-exports policylang types for source compatibility.
service.go*Servicecoreapi.Service adapter. Build tag !no_policy.
service_disabled.goStub when build tag no_policy is set.

Subpackage policylang/

FileWhat it does
policy.goPolicy struct and JSON unmarshal.
engine.goCompile and cache compiled programs; evaluate against env.
env.goEvent/peer-context binding for the expr-lang VM.

Build tags

TagEffect
no_policyCompiles a stub whose Start is a no-op.

License

AGPL-3.0-or-later. See LICENSE.

About

Pilot Protocol policy plugin + policy expression language (expr-lang/expr backed)

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages