Documentation
¶
Index ¶
Constants ¶
const WaypointCap = "redo.com/cap/waypoint"
const WaypointManagerCap = "redo.com/cap/waypointManager"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthResult ¶
type AuthResult struct {
LoginName string
NodeName string
Permissions []string // all merged PG permissions (across all databases)
Limits MergedLimits
MatchedRules []CapRule // rules that matched the backend, for per-database lookup
}
AuthResult is returned after successful authorization.
type BackendCap ¶ added in v0.5.3
type BackendCap struct {
PG *PGCap `json:"pg,omitempty"`
Mongo *MongoCap `json:"mongo,omitempty"`
Limits *LimitsCap `json:"limits,omitempty"`
}
BackendCap holds per-backend capabilities and limits.
type BandwidthCap ¶
BandwidthCap defines a byte budget over a time period.
type BandwidthTier ¶
BandwidthTier defines a byte budget over a time period.
type CapRule ¶
type CapRule struct {
Limits *LimitsCap `json:"limits,omitempty"`
Backends map[string]BackendCap `json:"backends"`
}
CapRule represents a single capability rule from the Tailscale ACL grant. Top-level Limits apply globally (per-user across all backends). Each backend entry in Backends carries its own PG and Limits (per-endpoint).
func (*CapRule) UnmarshalJSON ¶ added in v0.5.3
UnmarshalJSON supports both the current schema (backends as a map) and the legacy schema (backends as a string array with top-level pg/endpoint_limits).
type DBPermissions ¶
type DBPermissions struct {
Permissions []string `json:"permissions"`
Schemas []string `json:"schemas,omitempty"`
SQL []string `json:"sql,omitempty"`
}
DBPermissions defines access grants for a database. Permissions holds preset names ("readonly", "readwrite", "admin"). Schemas controls which schemas presets apply to (default: ["public"]). SQL holds advanced raw SQL templates (gateable by server config). SQL entries are Go text/template strings. Available variables:
- {{.Role}} — the sanitized PG role identifier for the connecting user
func DatabasePermissions ¶
func DatabasePermissions(result *AuthResult, backend string, database string) *DBPermissions
DatabasePermissions returns the merged permissions for a specific database from the matched rules for the given backend. Returns nil if no rules grant access to the database.
type EndpointLimits ¶ added in v0.5.3
type EndpointLimits struct {
MaxConns int
MaxBytesPerConn int64
MaxConnDuration time.Duration
BandwidthTiers []BandwidthTier
}
EndpointLimits holds per-endpoint restriction overrides.
type LimitsCap ¶
type LimitsCap struct {
MaxConns int `json:"max_conns,omitempty"`
MaxBytesPerConn int64 `json:"max_bytes_per_conn,omitempty"`
MaxConnDuration string `json:"max_conn_duration,omitempty"`
Bandwidth []BandwidthCap `json:"bandwidth,omitempty"`
}
LimitsCap defines per-user restriction overrides from ACL grants.
type ManagerAuthResult ¶
ManagerAuthResult is returned after successful manager authorization.
type ManagerCapRule ¶
type ManagerCapRule struct {
}
ManagerCapRule represents a capability rule for the waypoint manager.
type MergedLimits ¶
type MergedLimits struct {
// Per-user (global) limits — checked against root key (waypoint:conns:<user>).
MaxConns int
MaxBytesPerConn int64
MaxConnDuration time.Duration
BandwidthTiers []BandwidthTier
// Per-endpoint limits — checked against leaf key (waypoint:conns:<user>/<listener>).
// Nil means no endpoint-specific limits (only global apply).
Endpoint *EndpointLimits
}
MergedLimits holds the resolved limits after merging all matching rules.
type MongoCap ¶ added in v0.6.3
type MongoCap struct {
Databases map[string]MongoDBPermissions `json:"databases"`
}
MongoCap holds MongoDB-specific capabilities.
type MongoDBPermissions ¶ added in v0.6.3
type MongoDBPermissions struct {
Permissions []string `json:"permissions"`
}
MongoDBPermissions defines access grants for a MongoDB database. Permissions holds preset names ("readonly", "readwrite", "admin").
func MongoDatabasePermissions ¶ added in v0.6.3
func MongoDatabasePermissions(result *AuthResult, backend string, database string) *MongoDBPermissions
MongoDatabasePermissions returns the merged MongoDB permissions for a specific database from the matched rules for the given backend. Returns nil if no rules grant access to the database.
type PGCap ¶
type PGCap struct {
Databases map[string]DBPermissions `json:"databases"`
}
PGCap holds postgres-specific capabilities.