Documentation
¶
Overview ¶
Package exchange defines the public runtime exchange keyspace shared by Nauthilus plugins.
Index ¶
- Constants
- func FeatureKey(name string) string
- func FeatureMarkerValue(marker FeatureMarker) map[string]any
- func FeatureRuntimeDelta(name string, marker FeatureMarker) pluginapi.RuntimeDelta
- func GeoIPReputationRuntimeDelta(fields map[string]any) pluginapi.RuntimeDelta
- func GeoIPReputationValue(fields map[string]any) map[string]any
- func GeoIPRuntimeDelta(fields map[string]any) pluginapi.RuntimeDelta
- func GeoIPValue(fields map[string]any) map[string]any
- func HIBPRuntimeDelta(result HIBPResult) pluginapi.RuntimeDelta
- func HIBPValue(result HIBPResult) map[string]any
- func MapValue(value any) map[string]any
- func StringList(value any) []string
- func StringValue(value any) string
- func Truthy(value any) bool
- type FeatureMarker
- type GeoIPAnalytics
- type GeoIPPrivacyAnalytics
- type HIBPResult
- type Snapshot
- func (s Snapshot) DecisionSources() []string
- func (s Snapshot) DecisionSourcesString() string
- func (s Snapshot) GeoIPAnalytics() GeoIPAnalytics
- func (s Snapshot) GeoIPReputation() map[string]any
- func (s Snapshot) HIBPHashInfo() string
- func (s Snapshot) Map(key string) map[string]any
- func (s Snapshot) Value(key string) any
Constants ¶
const ( // Prefix is the top-level runtime key prefix for standard exchange values. Prefix = "plugin.exchange." // KeyDecisionSources stores stable analytics source names selected by policy-aware components. KeyDecisionSources = Prefix + "decision_sources" // KeyFeaturePrefix is the prefix for standard feature-marker runtime keys. KeyFeaturePrefix = Prefix + "feature." // KeyGeoIP stores GeoIP and ASN enrichment fields. KeyGeoIP = Prefix + "geoip" // KeyGeoIPReputation stores reputation scores and decision hints. KeyGeoIPReputation = Prefix + "geoip_reputation" // KeyFailedLoginHotspot stores failed-login hotspot counters. KeyFailedLoginHotspot = Prefix + "failed_login_hotspot" // KeyAccountProtection stores account-protection state. KeyAccountProtection = Prefix + "account_protection" // KeyGlobalPattern stores global pattern counters. KeyGlobalPattern = Prefix + "global_pattern" // KeyDynamicResponse stores dynamic response diagnostics. KeyDynamicResponse = Prefix + "dynamic_response" // KeyHaveIBeenPwned stores safe Have I Been Pwned result fields. KeyHaveIBeenPwned = Prefix + "haveibeenpwnd" )
const ( // FeatureBlocklist identifies external blocklist policy decisions. FeatureBlocklist = "blocklist" // FeatureRBL identifies built-in RBL policy decisions. FeatureRBL = "rbl" // FeatureBruteForce identifies built-in brute-force policy decisions. FeatureBruteForce = "brute_force" // FeatureGeoIPPolicy identifies delegated GeoIP policy decisions. FeatureGeoIPPolicy = "geoip_policyd" // FeatureFailedLoginHotspot identifies failed-login hotspot decisions. FeatureFailedLoginHotspot = "failed_login_hotspot" // FeatureAccountProtection identifies account-protection policy decisions. FeatureAccountProtection = "account_protection" // FeatureGeoIPReputation identifies reputation-based GeoIP decisions. FeatureGeoIPReputation = "geoip_reputation" // FeatureGlobalPattern identifies global-pattern policy decisions. FeatureGlobalPattern = "global_pattern" // FeatureDynamicResponse identifies dynamic response decisions. FeatureDynamicResponse = "dynamic_response" // FeatureHaveIBeenPwned identifies Have I Been Pwned decisions. FeatureHaveIBeenPwned = "haveibeenpwnd" )
const ( // FieldTriggered marks a feature marker as contributing to the selected decision. FieldTriggered = "triggered" // FieldDecision stores a bounded decision hint such as "suspicious". FieldDecision = "decision" // FieldSource stores a low-cardinality producer or data-source name. FieldSource = "source" // FieldReason stores an optional bounded reason string. FieldReason = "reason" // FieldHashInfo stores the HIBP short prefix/count value used by analytics. FieldHashInfo = "hash_info" // FieldLeaked stores whether HIBP reported a leaked password hash. FieldLeaked = "leaked" // FieldCount stores a non-negative HIBP leak count. FieldCount = "count" )
const ( // FieldPrivacyLookupState stores the privacy lookup availability state. FieldPrivacyLookupState = "privacy_lookup_state" // FieldPrivacyDetected stores the aggregate privacy detection result. FieldPrivacyDetected = "privacy_detected" // FieldPrivacyClasses stores stable matched privacy classes. FieldPrivacyClasses = "privacy_classes" // FieldPrivacyPrimaryClass stores the selected primary privacy class. FieldPrivacyPrimaryClass = "privacy_primary_class" // FieldPrivacyConfidence stores evidence confidence, not authentication risk. FieldPrivacyConfidence = "privacy_confidence" // FieldPrivacySourceAuthorities stores stable evidence authority classes. FieldPrivacySourceAuthorities = "privacy_source_authorities" // FieldPrivacyDataStale stores whether the evaluated evidence is stale. FieldPrivacyDataStale = "privacy_data_stale" // FieldPrivacyDataAgeSeconds stores the non-negative evidence age. FieldPrivacyDataAgeSeconds = "privacy_data_age_seconds" // FieldIsTorExitNode stores official Tor exit evidence. FieldIsTorExitNode = "is_tor_exit_node" // FieldIsKnownVPNExit stores known VPN exit evidence. FieldIsKnownVPNExit = "is_known_vpn_exit" // FieldIsCommunityVPNExit stores community VPN exit evidence. FieldIsCommunityVPNExit = "is_community_vpn_exit" // FieldIsPublicProxy stores public proxy evidence. FieldIsPublicProxy = "is_public_proxy" // FieldIsPrivacyRelay stores privacy relay evidence. FieldIsPrivacyRelay = "is_privacy_relay" // FieldIsHostingNetwork stores hosting or cloud network evidence. FieldIsHostingNetwork = "is_hosting_network" FieldIsSharedEgress = "is_shared_egress" )
Variables ¶
This section is empty.
Functions ¶
func FeatureKey ¶
FeatureKey returns the standard runtime key for a feature marker.
func FeatureMarkerValue ¶
func FeatureMarkerValue(marker FeatureMarker) map[string]any
FeatureMarkerValue builds a JSON-compatible feature-marker map.
func FeatureRuntimeDelta ¶
func FeatureRuntimeDelta(name string, marker FeatureMarker) pluginapi.RuntimeDelta
FeatureRuntimeDelta builds a runtime delta for one feature marker.
func GeoIPReputationRuntimeDelta ¶
func GeoIPReputationRuntimeDelta(fields map[string]any) pluginapi.RuntimeDelta
GeoIPReputationRuntimeDelta builds a runtime delta for GeoIP reputation exchange data.
func GeoIPReputationValue ¶
GeoIPReputationValue returns a defensive copy of GeoIP reputation exchange fields.
func GeoIPRuntimeDelta ¶
func GeoIPRuntimeDelta(fields map[string]any) pluginapi.RuntimeDelta
GeoIPRuntimeDelta builds a runtime delta for GeoIP exchange data.
func GeoIPValue ¶
GeoIPValue returns a defensive copy of GeoIP exchange fields.
func HIBPRuntimeDelta ¶
func HIBPRuntimeDelta(result HIBPResult) pluginapi.RuntimeDelta
HIBPRuntimeDelta builds a runtime delta for HIBP exchange data.
func HIBPValue ¶
func HIBPValue(result HIBPResult) map[string]any
HIBPValue builds a JSON-compatible HIBP exchange map.
func StringList ¶
StringList normalizes string-list exchange values with deterministic map ordering.
func StringValue ¶
StringValue converts scalar optional values to strings.
Types ¶
type FeatureMarker ¶
FeatureMarker describes one standard feature marker value.
type GeoIPAnalytics ¶
type GeoIPAnalytics struct {
Fields map[string]any
Privacy GeoIPPrivacyAnalytics
MalformedFields []string
}
GeoIPAnalytics is a defensive typed view over standard GeoIP exchange data.
type GeoIPPrivacyAnalytics ¶
type GeoIPPrivacyAnalytics struct {
Classes []string
SourceAuthorities []string
LookupState string
PrimaryClass string
Detected *bool
Confidence *float64
DataStale *bool
DataAgeSeconds *uint64
IsTorExitNode *bool
IsKnownVPNExit *bool
IsCommunityVPNExit *bool
IsPublicProxy *bool
IsPrivacyRelay *bool
IsHostingNetwork *bool
}
GeoIPPrivacyAnalytics contains normalized nullable privacy evidence for analytics.
type HIBPResult ¶
HIBPResult contains secret-safe Have I Been Pwned exchange fields.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot is a read-only view over standard exchange runtime values and policy facts.
func NewSnapshot ¶
func NewSnapshot(runtime pluginapi.RuntimeContext, facts []pluginapi.PolicyFact) Snapshot
NewSnapshot builds a standard exchange view from a runtime context and policy facts.
func NewSnapshotFromValues ¶
func NewSnapshotFromValues(values map[string]any, facts []pluginapi.PolicyFact) Snapshot
NewSnapshotFromValues builds a standard exchange view from raw runtime values.
func (Snapshot) DecisionSources ¶
DecisionSources returns deterministic, deduplicated analytics source names.
func (Snapshot) DecisionSourcesString ¶
DecisionSourcesString returns DecisionSources joined for analytics row fields.
func (Snapshot) GeoIPAnalytics ¶
func (s Snapshot) GeoIPAnalytics() GeoIPAnalytics
GeoIPAnalytics returns exchange-first GeoIP data with policy-fact privacy fallback.
func (Snapshot) GeoIPReputation ¶
GeoIPReputation returns exchange reputation data or policy-fact fallback data.
func (Snapshot) HIBPHashInfo ¶
HIBPHashInfo returns the standard HIBP short hash information for analytics.