Documentation
¶
Overview ¶
Package glivela defines Petauron's runtime-independent account, access, routing, quota, deployment, and subscription rules for managed Xray entries.
Index ¶
- Constants
- func CompositePublicIP(address netip.Addr) bool
- func Hysteria2LinkForCredential(endpoint HysteriaEndpoint, material CredentialMaterial, name string) (string, error)
- func HysteriaCertificateNotAfter(endpoint HysteriaEndpoint) (time.Time, error)
- func Identity(secret string) string
- func LinkForCredential(endpoint RealityEndpoint, material CredentialMaterial, name string) (string, error)
- func PrivateClientIPv4(value string) bool
- func PublicTransportIPv4(value string) bool
- func PublicTransportIPv6(value string) bool
- func RenderAethersailorProfile(body []byte, items []SubscriptionItem) ([]byte, error)
- func RenderLinks(entries []NativeEntry, accountID string, mode PublishingMode, ...) ([]byte, error)
- func RenderShadowrocketNodes(body []byte) ([]byte, error)
- func RenderShadowrocketProfile(body []byte) ([]byte, error)
- func RenderXrayConfiguration(plan XrayPlan) ([]byte, error)
- func RouteUser(grantID string) string
- func SealImportLedger(m ImportMaterial, key []byte, snapshotID, archiveSHA256 string) ([]byte, error)
- func SealImportMaterial(m ImportMaterial, key []byte, snapshotID string) ([]byte, error)
- func SubscriptionTokenFingerprint(token string) string
- func ValidIdentifier(value string) bool
- func ValidIdentity(value string) bool
- func ValidRealityTargetPin(target, pin string) bool
- func ValidateCompositeExitPair(ipv6, ipv4 RoutePeer) error
- func ValidateCompositePeers(grant RouteGrant, ipv6, ipv4 RoutePeer) error
- func ValidateEndpointImport(material ImportMaterial, endpoints []ImportEndpoint) error
- func VerifyAppliedReceipt(desired DesiredArtifact, receipt AppliedReceipt) error
- type AccessGate
- type Account
- type AccountPlan
- type AppliedReceipt
- type BusinessOwnership
- type ClientChain
- type ClientChainRelay
- type ClientLanding
- type CounterSnapshot
- type Credential
- type CredentialKind
- type CredentialMaterial
- type DesiredArtifact
- type EgressPolicy
- type HysteriaEndpoint
- type ImportAccount
- type ImportApplication
- type ImportEndpoint
- type ImportLandingSelection
- type ImportMaterial
- type ImportNode
- type ImportPlan
- type ImportPublication
- type ImportReferences
- type ImportResetSchedule
- type ImportService
- type ImportTrafficCounters
- type NativeEntry
- type PrivateClientLink
- type PrivateClientPolicy
- type PrivateTransport
- type ProtocolKind
- type PrunedEntry
- type PublicSSHPolicy
- type PublishedClientChain
- type PublishedRoute
- type PublishingMode
- type QuotaProjection
- type RealityEndpoint
- type RealityInitialRepair
- type RealityListenerBinding
- type RealityPublicIngress
- type RealityTargetChange
- type RetiredLanding
- type RouteGrant
- type RoutePeer
- type ServerTransport
- type SubscriptionItem
- type SubscriptionOrder
- type TransportListener
- type UsageMember
- type XrayPlan
Constants ¶
const ( MaxIdentifierLength = 128 MaxDisplayNameLength = 512 MaxResetDays = 3650 )
const ( DefaultRealityPort = 443 RealityBackendPort = 10443 DefaultLandingSOCKSPort = 1080 XrayAPIListenPort = 10085 XrayMinimumClient = "0.0.0" )
const IPv4ClientSS2022 = "ipv4-ss2022"
const IPv4ClientSS2022Method = "2022-blake3-aes-256-gcm"
const IPv4RelaySS2022 = "ipv4-relay-ss2022"
IPv4RelaySS2022 is an exact-source client-only relay, independent of the server-forwarding source grants.
const ManagedLocalTLSTarget = "127.0.0.1:24483"
ManagedLocalTLSTarget is the fixed TLS origin published on loopback by Vastora's managed gateway. It is not a general private-target allowance.
const SS2022Method = "2022-blake3-aes-128-gcm"
const XrayRenderVersion uint8 = 127
XrayRenderVersion identifies the deterministic entry configuration format. Bit zero retains the REALITY UDP 443 policy. Bit one removes the retired management-port blacklist. Bit two enables automatic TCP family fallback. Bit three selects IPv6 resolver transport for explicit IPv6-only entries. Bit four permits explicitly scoped provider-LAN client sockets. Bit five enables explicitly authorized UDP-over-TCP server routes. Bit six disables Xray access logging while retaining warning/error logs. Versions 0..3, 7, 15, 31 and 63 remain immutable snapshot readers.
Variables ¶
This section is empty.
Functions ¶
func CompositePublicIP ¶
CompositePublicIP validates reported public exit addresses before publication.
func Hysteria2LinkForCredential ¶
func Hysteria2LinkForCredential(endpoint HysteriaEndpoint, material CredentialMaterial, name string) (string, error)
func HysteriaCertificateNotAfter ¶
func HysteriaCertificateNotAfter(endpoint HysteriaEndpoint) (time.Time, error)
func LinkForCredential ¶
func LinkForCredential(endpoint RealityEndpoint, material CredentialMaterial, name string) (string, error)
func PrivateClientIPv4 ¶
func PublicTransportIPv4 ¶
PublicTransportIPv4 permits a single canonical unicast endpoint, never a subnet, wildcard, private management address or DNS-dependent destination.
func PublicTransportIPv6 ¶
PublicTransportIPv6 accepts only a canonical, non-transition global unicast address. Transport endpoints and authorized sources are exact addresses, never prefixes or names resolved by a different network namespace.
func RenderAethersailorProfile ¶
func RenderAethersailorProfile(body []byte, items []SubscriptionItem) ([]byte, error)
RenderAethersailorProfile wraps the already-authorized Mihomo inventory. It never edits proxy transport settings, credentials, ordering or helpers.
func RenderLinks ¶
func RenderLinks(entries []NativeEntry, accountID string, mode PublishingMode, routes []PublishedRoute, order []string, encoded bool) ([]byte, error)
func RenderShadowrocketNodes ¶
RenderShadowrocketNodes retains the published inventory but uses native URI fields. Shadowrocket's Clash importer can select Chrome120 even when the source requests chrome plus ML-KEM; its native fingerprint field is explicit.
func RenderShadowrocketProfile ¶
RenderShadowrocketProfile renders native policy configuration for the same node subscription. Shadowrocket keeps subscribed nodes separate from .conf files: exact names bind these groups to the unchanged native node inventory. No General, Host, DNS, scripts, rewrites or local override sections are emitted.
func RenderXrayConfiguration ¶
func SealImportLedger ¶
func SealImportLedger(m ImportMaterial, key []byte, snapshotID, archiveSHA256 string) ([]byte, error)
func SealImportMaterial ¶
func SealImportMaterial(m ImportMaterial, key []byte, snapshotID string) ([]byte, error)
SealImportMaterial uses standard authenticated encryption with an externally supplied 256-bit transfer key. Nonces come from Go's GCM implementation. The authenticated snapshot identifier prevents swapping material between exports. Successful decryption is not evidence that the legacy writer is fenced.
func ValidIdentifier ¶
func ValidIdentity ¶
func ValidRealityTargetPin ¶
ValidRealityTargetPin checks the durable hostname/port and reviewed address. The only non-public destination is the managed same-host TLS origin.
func ValidateCompositePeers ¶
func ValidateCompositePeers(grant RouteGrant, ipv6, ipv4 RoutePeer) error
Composite routes keep one client credential and one quota membership. The private transport family is independent of each exit's final public family.
func ValidateEndpointImport ¶
func ValidateEndpointImport(material ImportMaterial, endpoints []ImportEndpoint) error
ValidateEndpointImport covers every credential's existing entry, not just entries selected for the first landing migration. Empty account inventories may legitimately coexist with configured endpoints and vice versa.
func VerifyAppliedReceipt ¶
func VerifyAppliedReceipt(desired DesiredArtifact, receipt AppliedReceipt) error
Types ¶
type AccessGate ¶
type Account ¶
type Account struct {
ID string `json:"id"`
DisplayName string `json:"displayName"`
Plan AccountPlan `json:"plan"`
DesiredRevision uint64 `json:"desiredRevision"`
AppliedRevision uint64 `json:"appliedRevision"`
}
type AccountPlan ¶
type AccountPlan struct {
TotalBytes int64 `json:"totalBytes"`
ExpiryTime int64 `json:"expiryTime"`
ResetDays int `json:"resetDays"`
Enabled bool `json:"enabled"`
}
func (AccountPlan) Validate ¶
func (p AccountPlan) Validate() error
type AppliedReceipt ¶
type BusinessOwnership ¶
type BusinessOwnership struct {
Origin string `json:"origin,omitempty"`
SourceSHA256 string `json:"sourceSha256"`
CaptureSHA256 string `json:"captureSha256"`
PreviousWriterID string `json:"previousWriterId"`
StoppedAt string `json:"stoppedAt"`
CapturedAt string `json:"capturedAt"`
}
BusinessOwnership is sealed with the business data by the one-time offline handover tool after it verifies the final backup and stopped old writer. It records data authority, never current process/route health. The previous writer identity is opaque to the controller, not a host capability contract.
func (BusinessOwnership) Validate ¶
func (o BusinessOwnership) Validate(sourceSHA256 string) error
type ClientChain ¶
type ClientChain struct {
PrivateLink *PrivateClientLink `json:"privateLink,omitempty"`
EgressIP string `json:"egressIp,omitempty"`
Relay *ClientChainRelay `json:"relay,omitempty"`
// IPv6SS2022 chains carry separately authorized, exact transport addresses.
// Empty transport fields identify existing IPv4 client chains.
Transport string `json:"transport,omitempty"`
SourceIPv6 string `json:"sourceIpv6,omitempty"`
ServerIPv6 string `json:"serverIpv6,omitempty"`
EntryCertificateID string `json:"entryCertificateId,omitempty"`
LandingCertificateID string `json:"landingCertificateId,omitempty"`
ID string `json:"id"`
AccountID string `json:"accountId"`
EntryID string `json:"entryId"`
EgressID string `json:"egressId"`
Name string `json:"name"`
Port int `json:"port"`
Key string `json:"key"`
Enabled bool `json:"enabled"`
}
ClientChain contains a dedicated user credential, never the server transport key. It is stored only inside the encrypted business material.
func (ClientChain) Validate ¶
func (c ClientChain) Validate() error
type ClientChainRelay ¶
type ClientChainRelay struct {
NodeID string `json:"nodeId"`
CertificateID string `json:"certificateId"`
Transport string `json:"transport,omitempty"`
SourceIPv4 string `json:"sourceIpv4,omitempty"`
ServerIPv4 string `json:"serverIpv4,omitempty"`
SourceIPv6 string `json:"sourceIpv6"`
ServerIPv6 string `json:"serverIpv6"`
Port int `json:"port"`
Key string `json:"key"`
}
ClientChainRelay holds a separate credential for the intermediate hop. As with the final landing credential, it remains encrypted at rest.
func (ClientChainRelay) ValidateServerRelay ¶
func (r ClientChainRelay) ValidateServerRelay(final PrivateTransport) error
type ClientLanding ¶
ClientLanding is a shared transport credential owned by one account. It survives that account's client-to-server forwarding migration; original per-chain configuration stays retained for explicit forward recovery.
type CounterSnapshot ¶
type CounterSnapshot struct {
CredentialID string `json:"credentialId"`
UpBytes int64 `json:"upBytes"`
DownBytes int64 `json:"downBytes"`
}
func ParseXrayUserCounters ¶
func ParseXrayUserCounters(materials []CredentialMaterial, payload []byte) ([]CounterSnapshot, error)
ParseXrayUserCounters accepts the bounded result of Xray's StatsService query. Names are matched against the complete expected name, so an imported user label containing Xray's delimiter remains unambiguous.
func (CounterSnapshot) TotalBytes ¶
func (s CounterSnapshot) TotalBytes() int64
type Credential ¶
type Credential struct {
ID string `json:"id"`
AccountID string `json:"accountId"`
Kind CredentialKind `json:"kind"`
User string `json:"user"`
Identity string `json:"identity"`
EntryID string `json:"entryId"`
EgressID string `json:"egressId,omitempty"`
Enabled bool `json:"enabled"`
}
func (Credential) Validate ¶
func (c Credential) Validate() error
type CredentialKind ¶
type CredentialKind string
const ( NativeCredential CredentialKind = "native" RouteCredential CredentialKind = "route" )
type CredentialMaterial ¶
type CredentialMaterial struct {
Credential Credential `json:"credential"`
ProtocolID string `json:"protocolId"`
HysteriaAuth string `json:"hysteriaAuth,omitempty"`
HysteriaIdentity string `json:"hysteriaIdentity,omitempty"`
}
func (CredentialMaterial) Validate ¶
func (m CredentialMaterial) Validate() error
type DesiredArtifact ¶
type DesiredArtifact struct {
Revision uint64 `json:"revision"`
Config []byte `json:"config"`
ConfigSHA256 string `json:"configSha256"`
}
func BuildDesiredArtifact ¶
func BuildDesiredArtifact(plan XrayPlan) (DesiredArtifact, error)
func BuildDesiredArtifactVersion ¶
func BuildDesiredArtifactVersion(plan XrayPlan, version uint8) (DesiredArtifact, error)
BuildDesiredArtifactVersion verifies persisted entry snapshots using their exact rendering format. Callers creating new desired state use the current version; loading a snapshot never rewrites its bytes, digest or revision.
func (DesiredArtifact) Validate ¶
func (a DesiredArtifact) Validate() error
type EgressPolicy ¶
type EgressPolicy string
EgressPolicy controls the final destination family of native traffic. Fixed routes keep their SOCKS transport and the landing's own egress policy.
const ( EgressAuto EgressPolicy = "auto" EgressIPv4Only EgressPolicy = "ipv4_only" EgressIPv6Only EgressPolicy = "ipv6_only" )
func (EgressPolicy) Validate ¶
func (p EgressPolicy) Validate() error
The zero value keeps automatic family selection, not the host/control-plane resolver. Every native policy uses Glivela's explicit business DNS.
type HysteriaEndpoint ¶
type HysteriaEndpoint struct {
ID string `json:"id"`
EntryID string `json:"entryId"`
InboundTag string `json:"inboundTag"`
ListenPort int `json:"listenPort"`
AdvertiseHost string `json:"advertiseHost"`
AdvertisePort int `json:"advertisePort"`
ServerName string `json:"serverName"`
CertificatePEM string `json:"certificatePem"`
PrivateKeyPEM string `json:"privateKeyPem"`
}
func (HysteriaEndpoint) Validate ¶
func (e HysteriaEndpoint) Validate() error
type ImportAccount ¶
type ImportAccount struct {
// RetiredUsageBytes preserves this period's account-wide consumption after
// dedicated route credentials and per-node watermarks have been erased.
RetiredUsageBytes int64 `json:"retiredUsageBytes,omitempty"`
Account Account `json:"account"`
SubscriptionTokenFingerprint string `json:"subscriptionTokenFingerprint"`
Credentials []Credential `json:"credentials"`
HysteriaIdentities map[string]string `json:"hysteriaIdentities,omitempty"`
Grants []RouteGrant `json:"grants"`
Usage []UsageMember `json:"usage"`
}
func (ImportAccount) Quota ¶
func (a ImportAccount) Quota() (QuotaProjection, error)
Quota retains consumed bytes from permanently retired routes without retaining their credentials or attributing them to another live counter.
type ImportApplication ¶
type ImportEndpoint ¶
type ImportEndpoint struct {
// PreviousAdvertiseHost authorizes recovery of the latest metadata-only
// subscription address change, without accepting unrelated runtime drift.
PreviousAdvertiseHost string `json:"previousAdvertiseHost,omitempty"`
PreviousPublicIngress *RealityPublicIngress `json:"previousPublicIngress,omitempty"`
RealityChanges []RealityTargetChange `json:"realityChanges,omitempty"`
Reality RealityEndpoint `json:"reality"`
Hysteria *HysteriaEndpoint `json:"hysteria,omitempty"`
ServiceID string `json:"serviceId"`
RuntimeCertificateID string `json:"runtimeCertificateId,omitempty"`
RuntimeConfigSHA256 string `json:"runtimeConfigSha256,omitempty"`
TargetIP string `json:"targetIp"`
VLESSEnabled bool `json:"vlessEnabled"`
HysteriaEnabled bool `json:"hysteriaEnabled"`
TotalBytes int64 `json:"totalBytes"`
UsedBytes int64 `json:"usedBytes"`
QuotaAppliedEnabled bool `json:"quotaAppliedEnabled"`
ResetDay int `json:"resetDay"`
ResetSchedule ImportResetSchedule `json:"resetSchedule"`
DesiredRevision uint64 `json:"desiredRevision"`
AppliedRevision uint64 `json:"appliedRevision"`
HistoricalHealthy bool `json:"historicalHealthy"`
PreviousStatus string `json:"previousStatus"`
PreviousError string `json:"previousError"`
LegacyRetired bool `json:"legacyRetired"`
// Retired is the current endpoint policy. LegacyRetired above only
// records retirement of the old implementation, not this endpoint.
Retired bool `json:"retired"`
SourcePeerJSON json.RawMessage `json:"sourcePeer"`
CertificateNotAfter string `json:"certificateNotAfter"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
ImportEndpoint retains the existing proxy configuration and historical observations. None of PreviousStatus, AppliedRevision or HistoricalHealthy is fresh runtime evidence for the newly enrolled controller.
func (ImportEndpoint) Validate ¶
func (e ImportEndpoint) Validate() error
type ImportLandingSelection ¶
type ImportLandingSelection struct {
NodeIDs []string `json:"nodeIds"`
LandingRegionCodes map[string]string `json:"landingRegionCodes,omitempty"`
LandingNameSuffixes map[string]string `json:"landingNameSuffixes,omitempty"`
RetiringNodeIDs []string `json:"retiringNodeIds,omitempty"`
Revision uint64 `json:"revision"`
}
type ImportMaterial ¶
type ImportMaterial struct {
ServerTransportVersion uint8 `json:"serverTransportVersion,omitempty"`
ServerTransports map[string]ServerTransport `json:"serverTransports,omitempty"`
// Grant ID to enrolled landing certificate. Bound by the immutable grant
// account/entry/exit; captured only after current mutual enrollment proof.
ManagedRouteLandings map[string]string `json:"managedRouteLandings,omitempty"`
PrunedEntries map[string]PrunedEntry `json:"prunedEntries,omitempty"`
RetiredLandings map[string]RetiredLanding `json:"retiredLandings,omitempty"`
SubscriptionOrders map[string]SubscriptionOrder `json:"subscriptionOrders,omitempty"`
// Deleted entries remain disabled and retained for identity and accounting history.
DeletedRoutes map[string]bool `json:"deletedRoutes,omitempty"`
DeletedClientChains map[string]bool `json:"deletedClientChains,omitempty"`
ClientLandings map[string]ClientLanding `json:"clientLandings,omitempty"`
ClientChains []ClientChain `json:"clientChains,omitempty"`
SourceSHA256 string `json:"sourceSha256"`
RetainedSource json.RawMessage `json:"retainedSource"`
Endpoints []ImportEndpoint `json:"endpoints"`
References ImportReferences `json:"references"`
Plan ImportPlan `json:"plan"`
SubscriptionTokens map[string]string `json:"subscriptionTokens"`
ProtocolSecrets map[string]string `json:"protocolSecrets"`
HysteriaSecrets map[string]string `json:"hysteriaSecrets"`
ResetSchedules map[string]ImportResetSchedule `json:"resetSchedules"`
TrafficCounters map[string]ImportTrafficCounters `json:"trafficCounters"`
Ownership *BusinessOwnership `json:"ownership,omitempty"`
// contains filtered or unexported fields
}
ImportMaterial is one atomic, sensitive handover checkpoint. RetainedSource is migration history, never a second live configuration source. An explicit offline retirement operation may redact expired-host history while retaining its source identity header. Never send this material in a receipt or logs.
func OpenImportLedger ¶
func OpenImportLedger(sealed, key []byte, snapshotID, archiveSHA256 string, archive ImportMaterial) (ImportMaterial, error)
func OpenImportMaterial ¶
func OpenImportMaterial(sealed, key []byte, snapshotID string) (ImportMaterial, error)
func (ImportMaterial) EffectiveClientChain ¶
func (m ImportMaterial) EffectiveClientChain(c ClientChain) (ClientChain, error)
func (ImportMaterial) Validate ¶
func (m ImportMaterial) Validate() error
type ImportNode ¶
type ImportNode struct {
Name string `json:"name"`
PreviousStatus string `json:"previousStatus"`
ServiceAddress string `json:"serviceAddress"`
PrivateAddress string `json:"privateAddress"`
PeerJSON json.RawMessage `json:"peer,omitempty"`
EgressAddressesJSON json.RawMessage `json:"egressAddresses,omitempty"`
}
type ImportPlan ¶
type ImportPlan struct {
Accounts []ImportAccount `json:"accounts"`
SHA256 string `json:"sha256"`
}
func PlanImport ¶
func PlanImport(accounts []ImportAccount) (ImportPlan, error)
PlanImport validates a complete one-time authority transfer before a caller writes any state. It carries only the subscription-token fingerprint; the caller must move the raw token directly between encrypted stores.
type ImportPublication ¶
type ImportPublication struct {
ServiceID string `json:"serviceId"`
EntryNodeID string `json:"entryNodeId"`
Kind string `json:"kind"`
IngressOwner string `json:"ingressOwner"`
Hostname string `json:"hostname"`
SNIHostname string `json:"sniHostname"`
DNSProvider string `json:"dnsProvider"`
DNSRecordID string `json:"dnsRecordId"`
AccessApplicationID string `json:"accessApplicationId"`
TLSEnabled bool `json:"tlsEnabled"`
DesiredRevision uint64 `json:"desiredRevision"`
AppliedRevision uint64 `json:"appliedRevision"`
PreviousStatus string `json:"previousStatus"`
PreviousError string `json:"previousError"`
ActionRequired bool `json:"actionRequired"`
CleanupPending bool `json:"cleanupPending"`
CleanupAttempt int64 `json:"cleanupAttempt"`
CleanupRetryAt string `json:"cleanupRetryAt"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type ImportReferences ¶
type ImportReferences struct {
Nodes map[string]ImportNode `json:"nodes"`
Applications map[string]ImportApplication `json:"applications"`
Services map[string]ImportService `json:"services"`
Publications map[string]ImportPublication `json:"publications"`
LandingSelection *ImportLandingSelection `json:"landingSelection,omitempty"`
}
ImportReferences preserves object identities and display/publication data. PreviousStatus and saved network observations are not current reachability or write authority. No platform credentials/capability matrix are imported.
type ImportResetSchedule ¶
type ImportResetSchedule struct {
NextResetAt string `json:"nextResetAt"`
LastResetAt string `json:"lastResetAt"`
}
Preserve the recorded schedule, not a newly calculated cycle from import time. Strings retain the source timestamp's precision and offset verbatim.
type ImportService ¶
type ImportService struct {
Timezone string `json:"timezone"`
ApplicationID string `json:"applicationId"`
Name string `json:"name"`
DisplayName string `json:"displayName"`
RegionCode string `json:"regionCode"`
Protocol string `json:"protocol"`
ApplicationProtocol string `json:"applicationProtocol"`
ContainerPort int `json:"containerPort"`
HostPort int `json:"hostPort"`
Endpoint string `json:"endpoint"`
PreviousStatus string `json:"previousStatus"`
}
type ImportTrafficCounters ¶
type ImportTrafficCounters struct {
UploadBytes int64 `json:"uploadBytes"`
DownloadBytes int64 `json:"downloadBytes"`
RawUploadBytes int64 `json:"rawUploadBytes"`
RawDownloadBytes int64 `json:"rawDownloadBytes"`
StartedAt string `json:"startedAt"`
ObservedAt string `json:"observedAt"`
WatermarkObservedAt string `json:"watermarkObservedAt"`
}
Directional totals and raw counter watermarks have different meanings from the account quota baseline. Neither may be reconstructed from their sum.
type NativeEntry ¶
type NativeEntry struct {
Material CredentialMaterial `json:"material"`
Protocol ProtocolKind `json:"protocol"`
Link string `json:"link"`
}
type PrivateClientLink ¶
type PrivateClientLink struct {
Source string `json:"source"`
Address string `json:"address"`
SourceInterface string `json:"sourceInterface"`
Interface string `json:"interface"`
}
PrivateClientLink authorizes one provider-LAN socket, never a private subnet. Interface ownership is checked again on each owning native runtime.
func (PrivateClientLink) Validate ¶
func (p PrivateClientLink) Validate() error
type PrivateClientPolicy ¶
type PrivateClientPolicy struct {
PrivateClientLink
ID string `json:"id"`
AccountID string `json:"accountId"`
Port int `json:"port"`
}
type PrivateTransport ¶
type PrivateTransport struct {
// PrivateLink binds an existing client listener to one enrolled provider-LAN
// socket. PublicAddress retains its wire field name but must equal Address.
PrivateLink *PrivateClientLink `json:"privateLink,omitempty"`
// Port is explicit only for the shared public SS2022 listener. Zero reads
// retained server policies at their original port; it is not dial fallback.
ClientListenerID string `json:"clientListenerId,omitempty"`
Port int `json:"port,omitempty"`
Protocol string `json:"protocol,omitempty"`
Key string `json:"key,omitempty"`
PublicAddress string `json:"publicAddress,omitempty"`
}
PrivateTransport belongs to the server entry-to-landing connection; never serialize this policy into a public subscription or diagnostic output. An explicitly shared listener can use an already-issued client key, without exposing any retained server-only key. Empty values read retained SOCKS policy.
func (PrivateTransport) Endpoint ¶
func (t PrivateTransport) Endpoint(privateAddress string) string
func (PrivateTransport) ListenerPort ¶
func (t PrivateTransport) ListenerPort() int
func (PrivateTransport) Method ¶
func (t PrivateTransport) Method() string
Method reuses the cipher implied by the issued listener's canonical key.
func (PrivateTransport) Validate ¶
func (t PrivateTransport) Validate() error
type ProtocolKind ¶
type ProtocolKind string
const ( VLESSReality ProtocolKind = "vless-reality" Hysteria2 ProtocolKind = "hysteria2" )
func (ProtocolKind) Valid ¶
func (p ProtocolKind) Valid() bool
type PrunedEntry ¶
type PrunedEntry struct {
CertificateID string `json:"certificateId"`
Revision uint64 `json:"revision,string"`
EndpointID string `json:"endpointId"`
ServiceID string `json:"serviceId"`
InboundTag string `json:"inboundTag"`
TotalBytes int64 `json:"totalBytes"`
UsedBytes int64 `json:"usedBytes"`
ResetDay int `json:"resetDay"`
ResetSchedule ImportResetSchedule `json:"resetSchedule"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
PrunedEntry is a non-executable accounting identity and certificate revocation fence. It contains no hostname, listener, TLS key or deployment configuration. Historical credentials, watermarks and the original source archive stay intact.
type PublicSSHPolicy ¶
type PublicSSHPolicy struct {
HostPublicAddresses []string `json:"hostPublicAddresses"`
AddressesComplete bool `json:"addressesComplete"`
}
PublicSSHPolicy decodes the retired optional SSH policy in immutable historical artifacts and exact firewall cleanup only. New desired builders remove it; there is no management API or maintenance command that enables this policy.
func (*PublicSSHPolicy) Clone ¶
func (p *PublicSSHPolicy) Clone() *PublicSSHPolicy
func (*PublicSSHPolicy) RequireHost ¶
func (p *PublicSSHPolicy) RequireHost(value string) error
RequireHost catches omissions of already-known public literals. Hostnames and private NAT interfaces do not prove a complete external mapping.
func (*PublicSSHPolicy) Validate ¶
func (p *PublicSSHPolicy) Validate() error
type PublishedClientChain ¶
type PublishedClientChain struct {
Chain ClientChain
Base NativeEntry
Server string
EgressRegionPrefix string
EgressNameSuffix string
}
type PublishedRoute ¶
type PublishedRoute struct {
UDP bool `json:"udp,omitempty"`
Name string `json:"name,omitempty"`
Grant RouteGrant `json:"grant"`
Protocol ProtocolKind `json:"protocol"`
EntryName string `json:"entryName"`
EgressNameSuffix string `json:"egressNameSuffix,omitempty"`
EgressRegionPrefix string `json:"egressRegionPrefix,omitempty"`
IPv4EgressRegionPrefix string `json:"ipv4EgressRegionPrefix,omitempty"`
BaseLink string `json:"baseLink"`
RouteLink string `json:"routeLink"`
BaseProtocolIdentity string `json:"baseProtocolIdentity"`
RouteProtocolIdentity string `json:"routeProtocolIdentity"`
}
type PublishingMode ¶
type PublishingMode string
const FixedMode PublishingMode = "fixed"
func (PublishingMode) Valid ¶
func (m PublishingMode) Valid() bool
type QuotaProjection ¶
type QuotaProjection struct {
UsedBytes int64 `json:"usedBytes"`
Enabled bool `json:"enabled"`
Gates []AccessGate `json:"gates"`
}
func ProjectQuota ¶
func ProjectQuota(plan AccountPlan, members []UsageMember) (QuotaProjection, error)
ProjectQuota computes one account-wide usage value and projects only an on/off gate to each credential. It never splits the remaining quota between credentials, which would duplicate the plan or rewrite Xray on every sample.
type RealityEndpoint ¶
type RealityEndpoint struct {
ID string `json:"id"`
EntryID string `json:"entryId"`
InboundTag string `json:"inboundTag"`
ListenAddress string `json:"listenAddress"`
IPv4ListenAddress string `json:"ipv4ListenAddress,omitempty"`
ListenPort int `json:"listenPort"`
AdvertiseHost string `json:"advertiseHost"`
AdvertisePort int `json:"advertisePort"`
Target string `json:"target"`
ServerNames []string `json:"serverNames"`
PrivateKey string `json:"privateKey"`
PublicKey string `json:"publicKey"`
ShortIDs []string `json:"shortIds"`
Fingerprint string `json:"fingerprint"`
}
func (RealityEndpoint) InboundTags ¶
func (e RealityEndpoint) InboundTags() []string
func (RealityEndpoint) ListenerBindings ¶
func (e RealityEndpoint) ListenerBindings() []RealityListenerBinding
func (RealityEndpoint) Validate ¶
func (e RealityEndpoint) Validate() error
type RealityInitialRepair ¶
type RealityInitialRepair struct {
CertificateID string `json:"certificateId"`
ConfigSHA256 string `json:"configSha256"`
EvidenceSHA256 string `json:"evidenceSha256"`
VerifiedAt string `json:"verifiedAt"`
}
RealityInitialRepair records an administrator attestation, not a node receipt or public-client acceptance. The full evidence stays outside business state.
type RealityListenerBinding ¶
One logical endpoint retains its credentials, routes and user counters across two exact sockets. No wildcard binding or second account is introduced.
type RealityPublicIngress ¶
type RealityPublicIngress struct {
ListenPort int `json:"listenPort"`
AdvertisePort int `json:"advertisePort"`
IPv4ListenAddress string `json:"ipv4ListenAddress,omitempty"`
}
RealityPublicIngress is the exact previous socket tuple for forward recovery; it contains no credentials, target, account or traffic snapshot.
type RealityTargetChange ¶
type RealityTargetChange struct {
InitialRepair *RealityInitialRepair `json:"initialRepair,omitempty"`
RevertedAt string `json:"revertedAt,omitempty"`
Reason string `json:"reason,omitempty"`
PreviousTarget string `json:"previousTarget"`
PreviousTargetIP string `json:"previousTargetIp"`
PreviousServerNames []string `json:"previousServerNames"`
Target string `json:"target"`
TargetIP string `json:"targetIp"`
ServerName string `json:"serverName"`
State string `json:"state"`
ChangedAt string `json:"changedAt"`
EvidenceSHA256 string `json:"evidenceSha256,omitempty"`
VerifiedAt string `json:"verifiedAt,omitempty"`
}
RealityTargetChange retains only fields needed for forward recovery. It never snapshots account secrets, quotas or traffic ledgers.
type RetiredLanding ¶
type RetiredLanding struct {
HostID string `json:"hostId,omitempty"`
CertificateID string `json:"certificateId"`
Revision uint64 `json:"revision,string"`
}
RetiredLanding retains only a revocation fence, never a reusable credential. HostID also fences the original host when an entry has a distinct runtime ID.
type RouteGrant ¶
type RouteGrant struct {
UDP bool `json:"udp,omitempty"`
// ClientChainID selects one retained three-hop path without replacing a direct peer.
ClientChainID string `json:"clientChainId,omitempty"`
ID string `json:"id"`
AccountID string `json:"accountId"`
EntryID string `json:"entryId"`
EgressID string `json:"egressId"`
IPv4EgressID string `json:"ipv4EgressId,omitempty"`
InboundTag string `json:"inboundTag"`
Base Credential `json:"base"`
Route Credential `json:"route"`
Mode PublishingMode `json:"mode"`
Enabled bool `json:"enabled"`
HideNative bool `json:"hideNative"`
DesiredRev uint64 `json:"desiredRevision"`
AppliedRev uint64 `json:"appliedRevision"`
RuntimeGood bool `json:"runtimeHealthy"`
}
func (RouteGrant) Deployable ¶
func (g RouteGrant) Deployable() bool
Deployable reports whether the desired grant belongs in the next Xray projection. AppliedRev and RuntimeGood describe the previous receipt, so they deliberately do not gate creation of a newer desired configuration.
func (RouteGrant) PeerKey ¶
func (g RouteGrant) PeerKey() string
func (RouteGrant) Publishable ¶
func (g RouteGrant) Publishable() bool
Publishable follows configured authorization; runtime observations are advisory.
func (RouteGrant) Validate ¶
func (g RouteGrant) Validate() error
type RoutePeer ¶
type RoutePeer struct {
ClientChainID string `json:"clientChainId,omitempty"`
Relay *ClientChainRelay `json:"relay,omitempty"`
Transport PrivateTransport `json:"transport,omitzero"`
EgressID string `json:"egressId"`
Address string `json:"address"`
Port int `json:"port"`
ExitFamily EgressPolicy `json:"exitFamily,omitempty"`
Ready bool `json:"ready,omitempty"`
}
func (RoutePeer) DialTransport ¶
func (p RoutePeer) DialTransport() PrivateTransport
DialTransport is the only socket opened by the entry. The final SS2022 connection is carried inside the separately authorized intermediate hop.
func (RoutePeer) ServerOutbounds ¶
ServerOutbounds retains both independent issued credentials and chains the final proxy through the relay. Neither outbound has a direct fallback.
type ServerTransport ¶
type ServerTransport struct {
ID string `json:"id"`
Name string `json:"name"`
AccountID string `json:"accountId"`
EntryID string `json:"entryId"`
EgressID string `json:"egressId"`
EntryCertificateID string `json:"entryCertificateId"`
LandingCertificateID string `json:"landingCertificateId"`
Peer RoutePeer `json:"peer"`
ExpectedExit string `json:"expectedExit"`
Listener TransportListener `json:"listener"`
RelayListener *TransportListener `json:"relayListener,omitempty"`
}
ServerTransport owns a server route's already-enrolled transport. Its ID is a stable physical listener identity, not a reference to a client publication. Secrets live only in the authenticated encrypted business checkpoint.
func (ServerTransport) Validate ¶
func (r ServerTransport) Validate() error
type SubscriptionItem ¶
type SubscriptionItem struct {
ID string `json:"id"`
Kind string `json:"kind"`
Name string `json:"name"`
Protocol ProtocolKind `json:"protocol"`
}
SubscriptionItem identifies an actual selectable output without its credential.
func RenderMihomo ¶
func RenderMihomo(entries []NativeEntry, accountID string, mode PublishingMode, routes []PublishedRoute, order []string, chains ...PublishedClientChain) ([]byte, []SubscriptionItem, error)
type SubscriptionOrder ¶
type SubscriptionOrder struct {
Revision uint64 `json:"revision,string"`
IDs []string `json:"ids"`
}
SubscriptionOrder is presentation-only account data in the encrypted business source. Its revision is independent of node configurations and traffic.
func (SubscriptionOrder) Validate ¶
func (o SubscriptionOrder) Validate() error
type TransportListener ¶
type TransportListener struct {
Interface string `json:"interface,omitempty"`
EgressIP string `json:"egressIp,omitempty"`
Transport string `json:"transport,omitempty"`
Address string `json:"address,omitempty"`
ID string `json:"id"`
Port int `json:"port"`
Key string `json:"key"`
Source string `json:"source"`
}
TransportListener is an exact-source SS2022 socket policy. Publication mode does not own this wire contract; both server and client policies render it.
type UsageMember ¶
type UsageMember struct {
CredentialID string `json:"credentialId"`
Baseline int64 `json:"baseline"`
Observed int64 `json:"observed"`
Active bool `json:"active"`
}
func ObserveUsage ¶
func ObserveUsage(members []UsageMember, counters map[string]int64) ([]UsageMember, error)
func ResetUsage ¶
func ResetUsage(members []UsageMember) []UsageMember
type XrayPlan ¶
type XrayPlan struct {
ClientLinks []PrivateClientPolicy `json:"clientLinks,omitempty"`
PublicSSH *PublicSSHPolicy `json:"publicSSH,omitempty"`
Revision uint64 `json:"revision"`
NativeEgress EgressPolicy `json:"nativeEgress,omitempty"`
RealityEndpoints []RealityEndpoint `json:"realityEndpoints,omitempty"`
HysteriaEndpoints []HysteriaEndpoint `json:"hysteriaEndpoints,omitempty"`
Credentials []CredentialMaterial `json:"credentials"`
Grants []RouteGrant `json:"grants"`
Peers []RoutePeer `json:"peers"`
}
Source Files
¶
- business_ownership.go
- client_chain.go
- composite.go
- composite_xray.go
- deployment.go
- doc.go
- egress.go
- import_account_state.go
- import_endpoint.go
- import_ledger.go
- import_material.go
- import_references.go
- link.go
- migration.go
- model.go
- private_client_link.go
- private_transport.go
- pruned_entry.go
- public_ssh.go
- quota.go
- reality_target.go
- server_transport.go
- subscription.go
- subscription_order.go
- subscription_profile.go
- subscription_shadowrocket.go
- subscription_shadowrocket_nodes.go
- xray.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
glivela
command
Glivela owns node communication; the installer only supplies bootstrap files.
|
Glivela owns node communication; the installer only supplies bootstrap files. |
|
Package control implements Glivela's direct, authenticated node channel.
|
Package control implements Glivela's direct, authenticated node channel. |
|
internal
|
|
|
Package ipquality defines the bounded, public subset of an IPQuality report.
|
Package ipquality defines the bounded, public subset of an IPQuality report. |
|
Package landing contains the node-local boundary for optional SOCKS5 egress.
|
Package landing contains the node-local boundary for optional SOCKS5 egress. |
|
tools
|
|
|
alpine-acceptance
command
Isolated native-runtime acceptance fixture.
|
Isolated native-runtime acceptance fixture. |