Documentation
¶
Index ¶
- Constants
- func CandidateID(providerID, rawURL string) string
- func CanonicalProviderIDs() []string
- func IsCanonicalProviderID(id string) bool
- func OpenVerifiedProtectedExecutableSHA256(path string, maxBytes int64, expected [sha256.Size]byte) (*os.File, error)
- func OpenVerifiedProtectedRegularFileSHA256(path string, maxBytes int64, expected [sha256.Size]byte) (*os.File, error)
- func ReadProtectedJSONFile(path string, destination any) error
- func ReadProtectedRegularFile(path string, maxBytes int64) ([]byte, error)
- func TicketCodeSHA256(ticketCode string) string
- func ValidateAvailabilitySet(set AvailabilitySet) error
- func ValidateProtectedDirectory(path string) error
- func ValidateProtectedParentChain(path string) error
- func ValidateProtectedRegularFileIfExists(path string) error
- func ValidatePublicCandidate(candidate Candidate) error
- func VerifyProtectedRegularFileSHA256(path string, maxBytes int64, expected [sha256.Size]byte) error
- type Attempt
- type AttemptStatus
- type AvailabilitySet
- type Candidate
- type Eligibility
- type EvidenceStatus
- type FailureDomains
- type Handle
- type Manager
- type NetworkSample
- type Policy
- type ProbeEvidence
- func ProbeBootstrapAsset(ctx context.Context, client *http.Client, candidate Candidate, ...) (ProbeEvidence, error)
- func ProbeBootstrapTemplate(ctx context.Context, client *http.Client, candidate Candidate, ...) (ProbeEvidence, error)
- func ProbeGatewayHealth(ctx context.Context, client *http.Client, candidate Candidate, ...) (ProbeEvidence, error)
- type ProbeFunc
- type Provider
- type ProviderMetadata
- type RegionProfile
- type RegionalEvidence
- type Registry
- type Runtime
- type Selection
- type StartRequest
Constants ¶
const ( BootstrapProbeMarker = "rdev-bootstrap-probe-v1" TicketCodeSHA256Header = "X-Rdev-Ticket-Code-SHA256" BootstrapProbePowerShell = `$ErrorActionPreference = 'Stop' # rdev-bootstrap-probe-v1 Write-Output 'rdev-bootstrap-probe-v1' ` )
const ( ProviderCloudflareQuick = "cloudflare-quick" ProviderLocalhostRun = "localhost-run" ProviderPinggy = "pinggy" ProviderTunn3l = "tunn3l" )
const AvailabilitySchemaVersion = "rdev.tunnel-availability.v1"
const MaxProtectedJSONBytes = 1 << 20
const MaxRegionalEvidenceTTL = 7 * 24 * time.Hour
const ReadinessSchemaVersion = "rdev.connection-readiness.v2"
Variables ¶
This section is empty.
Functions ¶
func CandidateID ¶
CandidateID returns the deterministic, redaction-safe correlation ID used for a provider candidate throughout availability diagnostics.
func CanonicalProviderIDs ¶
func CanonicalProviderIDs() []string
func IsCanonicalProviderID ¶
func OpenVerifiedProtectedExecutableSHA256 ¶
func OpenVerifiedProtectedExecutableSHA256(path string, maxBytes int64, expected [sha256.Size]byte) (*os.File, error)
OpenVerifiedProtectedExecutableSHA256 returns a verified private executable handle rewound to offset zero. Unix executables must have exactly 0700 mode.
func OpenVerifiedProtectedRegularFileSHA256 ¶
func OpenVerifiedProtectedRegularFileSHA256(path string, maxBytes int64, expected [sha256.Size]byte) (*os.File, error)
OpenVerifiedProtectedRegularFileSHA256 returns the verified confidential file handle rewound to offset zero. The caller owns the handle and must close it.
func ReadProtectedJSONFile ¶
ReadProtectedJSONFile opens path before validating and strictly decoding it. Platform-specific permission checks inspect the same opened file handle that is later decoded.
func ReadProtectedRegularFile ¶
ReadProtectedRegularFile reads a local confidential regular file through the same handle used for path, type, identity, and permission validation.
func TicketCodeSHA256 ¶
func ValidateAvailabilitySet ¶
func ValidateAvailabilitySet(set AvailabilitySet) error
func ValidateProtectedParentChain ¶
ValidateProtectedParentChain verifies that untrusted local users cannot replace path through a writable ancestor after the file itself is checked.
func ValidatePublicCandidate ¶
Types ¶
type Attempt ¶
type Attempt struct {
ProviderID string `json:"provider_id"`
CandidateID string `json:"candidate_id,omitempty"`
Status AttemptStatus `json:"status"`
ErrorClass string `json:"error_class,omitempty"`
Probe ProbeEvidence `json:"probe"`
}
type AttemptStatus ¶
type AttemptStatus string
const ( AttemptStarting AttemptStatus = "starting" AttemptHealthy AttemptStatus = "healthy" AttemptDegraded AttemptStatus = "degraded" AttemptExited AttemptStatus = "exited" AttemptStopped AttemptStatus = "stopped" AttemptSkipped AttemptStatus = "skipped" )
type AvailabilitySet ¶
type AvailabilitySet struct {
SchemaVersion string `json:"schema_version"`
Region RegionProfile `json:"region"`
Candidates []Candidate `json:"candidates"`
Attempts []Attempt `json:"attempts"`
}
type Candidate ¶
type Candidate struct {
ProviderID string `json:"provider_id"`
URL string `json:"url"`
FailureDomains FailureDomains `json:"failure_domains"`
}
type Eligibility ¶
type Eligibility struct {
Eligible bool
Reason string
Evidence *RegionalEvidence
}
func EvaluateEligibility ¶
func EvaluateEligibility(meta ProviderMetadata, policy Policy, evidence []RegionalEvidence) Eligibility
type EvidenceStatus ¶
type EvidenceStatus string
const ( EvidenceUnknown EvidenceStatus = "unknown" EvidenceCandidate EvidenceStatus = "candidate" EvidenceVerified EvidenceStatus = "verified" EvidenceDegraded EvidenceStatus = "degraded" EvidenceBlocked EvidenceStatus = "blocked" )
type FailureDomains ¶
type FailureDomains struct {
AuthoritativeDNS string `json:"authoritative_dns,omitempty"`
EdgeNetwork string `json:"edge_network,omitempty"`
OriginNetwork string `json:"origin_network,omitempty"`
ControlPlane string `json:"control_plane,omitempty"`
CertificateDependency string `json:"certificate_dependency,omitempty"`
}
type Manager ¶
type NetworkSample ¶
type ProbeEvidence ¶
type ProbeEvidence struct {
DNSOK bool `json:"dns_ok"`
TCPConnectOK bool `json:"tcp_connect_ok"`
TLSOK bool `json:"tls_ok"`
HealthOK bool `json:"health_ok"`
BootstrapOK bool `json:"bootstrap_ok"`
StaticBootstrapOK bool `json:"static_bootstrap_ok"`
TicketBoundBootstrapOK bool `json:"ticket_bound_bootstrap_ok"`
SmallAssetOK bool `json:"small_asset_ok"`
Latency time.Duration `json:"latency"`
InstanceMarker string `json:"instance_marker,omitempty"`
}
func ProbeBootstrapAsset ¶
func ProbeBootstrapTemplate ¶
func ProbeGatewayHealth ¶
type Provider ¶
type Provider interface {
ID() string
Metadata() ProviderMetadata
// Start must return promptly after ctx cancellation. The context remains
// valid for the returned handle's lifetime; Wait signals only after provider
// resources are reaped. Manager cancels ctx on startup timeout, parent
// cancellation, handle stop, or handle exit.
Start(context.Context, StartRequest) (Handle, error)
}
type ProviderMetadata ¶
type ProviderMetadata struct {
ID string `json:"id"`
DisplayName string `json:"display_name"`
Protocols []string `json:"protocols"`
Anonymous bool `json:"anonymous"`
CredentialRequirement string `json:"credential_requirement,omitempty"`
Executable string `json:"executable"`
DocumentationURL string `json:"documentation_url"`
TermsURL string `json:"terms_url,omitempty"`
DefaultAutomatic bool `json:"default_automatic"`
AutomaticPriority int `json:"automatic_priority,omitempty"`
RequiresSSHPin bool `json:"requires_ssh_pin"`
FailureDomains FailureDomains `json:"failure_domains"`
}
type RegionProfile ¶
type RegionProfile string
const ( RegionGlobal RegionProfile = "global" RegionCNMainland RegionProfile = "cn-mainland" )
type RegionalEvidence ¶
type RegionalEvidence struct {
ProviderID string `json:"provider_id"`
Region RegionProfile `json:"region"`
Status EvidenceStatus `json:"status"`
Issuer string `json:"issuer"`
ObservedAt time.Time `json:"observed_at"`
ExpiresAt time.Time `json:"expires_at"`
Samples []NetworkSample `json:"samples"`
}
func (RegionalEvidence) Validate ¶
func (e RegionalEvidence) Validate() error
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func (Registry) Evaluate ¶
func (r Registry) Evaluate(policy Policy, evidence []RegionalEvidence) []Selection
func (Registry) Providers ¶
func (r Registry) Providers() []ProviderMetadata
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func (*Runtime) Snapshot ¶
func (r *Runtime) Snapshot() AvailabilitySet
type Selection ¶
type Selection struct {
Provider Provider
Metadata ProviderMetadata
Eligibility Eligibility
}
Source Files
¶
- manager.go
- probe.go
- protected_file.go
- protected_file_acl.go
- protected_file_open_unix.go
- protected_file_permissions_unix.go
- protected_path.go
- protected_path_acl_other_unix.go
- protected_path_acl_unix.go
- protected_path_ancestors_unix.go
- protected_path_open_unix.go
- protected_path_permissions_unix.go
- region.go
- registry.go
- types.go