Documentation
¶
Index ¶
- Constants
- Variables
- func API_ConnectToExisting(w http.ResponseWriter, req *http.Request)
- func API_ForceReform(w http.ResponseWriter, req *http.Request)
- func API_GetConfig(w http.ResponseWriter, req *http.Request)
- func API_GetLogs(w http.ResponseWriter, req *http.Request)
- func API_GetNextIP(w http.ResponseWriter, req *http.Request)
- func API_NATSStatus(w http.ResponseWriter, req *http.Request)
- func API_NewConstellation(w http.ResponseWriter, req *http.Request)
- func API_Ping(w http.ResponseWriter, req *http.Request)
- func API_Reset(w http.ResponseWriter, req *http.Request)
- func API_Restart(w http.ResponseWriter, req *http.Request)
- func AdjustDNS(logBuffer *lumberjack.Logger) error
- func CIAllBuildsRoute(w http.ResponseWriter, req *http.Request)
- func CIBuildActionRoute(w http.ResponseWriter, req *http.Request)
- func CIBuildIdRoute(w http.ResponseWriter, req *http.Request)
- func CIBuildLogsRoute(w http.ResponseWriter, req *http.Request)
- func CIBuildsRoute(w http.ResponseWriter, req *http.Request)
- func CIConnectionReposRoute(w http.ResponseWriter, req *http.Request)
- func CIConnectionsIdRoute(w http.ResponseWriter, req *http.Request)
- func CIConnectionsRoute(w http.ResponseWriter, req *http.Request)
- func CIDetectRoute(w http.ResponseWriter, req *http.Request)
- func CIProjectCopyRoute(w http.ResponseWriter, req *http.Request)
- func CIProjectWebhookRoute(w http.ResponseWriter, req *http.Request)
- func CIProjectsIdRoute(w http.ResponseWriter, req *http.Request)
- func CIProjectsRoute(w http.ResponseWriter, req *http.Request)
- func CIRunnersRoute(w http.ResponseWriter, req *http.Request)
- func CIWebhookRoute(w http.ResponseWriter, req *http.Request)
- func CheckConstellationToken(req *http.Request) error
- func ClientConnectToJS() error
- func ClientHeartbeatInit()
- func CloseNATSClient()
- func ClusterDomain() string
- func ConnectToExisting(yamlBody []byte, config utils.Config) (utils.Config, error)
- func ConstellationAPIDevices(w http.ResponseWriter, req *http.Request)
- func ConstellationConnected() bool
- func DNSEntriesIdRoute(w http.ResponseWriter, req *http.Request)
- func DNSEntriesRoute(w http.ResponseWriter, req *http.Request)
- func DeleteShieldBan(id string) error
- func DeleteShieldBans(clientID string) error
- func DeploymentsHealthRoute(w http.ResponseWriter, req *http.Request)
- func DeploymentsIdRoute(w http.ResponseWriter, req *http.Request)
- func DeploymentsRoute(w http.ResponseWriter, req *http.Request)
- func DeploymentsUnbrokeRoute(w http.ResponseWriter, req *http.Request)
- func DeviceBlock(w http.ResponseWriter, req *http.Request)
- func DeviceCreate_API(w http.ResponseWriter, req *http.Request)
- func DeviceEdit_API(w http.ResponseWriter, req *http.Request)
- func DeviceHostname(deviceName string, clusterDomain string) string
- func DeviceList(w http.ResponseWriter, req *http.Request)
- func DevicePing(w http.ResponseWriter, req *http.Request)
- func DevicePublicList(w http.ResponseWriter, req *http.Request)
- func DispatchTunnelRouteOp(req RouteOpRequest) ([]string, error)
- func ExportDefaultConfigToYAML(outputPath string) error
- func ExportLighthouseFromDB() error
- func FindLocalTunnel(name string) (utils.ConstellationTunnel, bool)
- func FunctionRuntimesRoute(w http.ResponseWriter, req *http.Request)
- func FunctionsDeployRoute(w http.ResponseWriter, req *http.Request)
- func FunctionsIdRoute(w http.ResponseWriter, req *http.Request)
- func FunctionsInvokeRoute(w http.ResponseWriter, req *http.Request)
- func FunctionsRoute(w http.ResponseWriter, req *http.Request)
- func FunctionsVersionsRoute(w http.ResponseWriter, req *http.Request)
- func GetAllDevices() ([]utils.ConstellationDevice, error)
- func GetAllDevicesEvenBlocked() ([]utils.ConstellationDevice, error)
- func GetAllLightHouses() ([]utils.ConstellationDevice, error)
- func GetAllLighthouseIPFromTempConfig() ([]string, error)
- func GetAllTunneledRoutes() []utils.ProxyRouteConfig
- func GetCertFingerprint(certPath string) (string, error)
- func GetClusterIPs() ([]*url.URL, error)
- func GetConfigAttribute(configPath string, attr string) (string, error)
- func GetConstellationFromIP(ip string) *utils.ConstellationDevice
- func GetCurrentDevice() (utils.ConstellationDevice, error)
- func GetCurrentDeviceAPIKey() (string, error)
- func GetCurrentDeviceHostname() (string, error)
- func GetCurrentDeviceIP() (string, error)
- func GetCurrentDeviceIsExitNode() (bool, error)
- func GetCurrentDeviceIsLoadbalancer() (bool, error)
- func GetCurrentDeviceIsRelay() (bool, error)
- func GetCurrentDeviceName() (string, error)
- func GetCurrentLeaderName() string
- func GetDefaultHostnames() []string
- func GetDeviceConfigManualSync(w http.ResponseWriter, req *http.Request)
- func GetDeviceIp(device string) string
- func GetLocalTunnelCache() []utils.ConstellationTunnel
- func GetNATSCredentials() (string, string, error)
- func GetNextAvailableIP(cidr string) string
- func GetStickyTarget(clientKey string) (string, bool)
- func Init()
- func InitConfig()
- func InitDNS()
- func InitHostname()
- func InitNATSClient() error
- func InitPingLighthouses()
- func IsClientConnected() bool
- func IsClientNode() bool
- func IsClientSynced() bool
- func IsConstellationIP(ip string) bool
- func IsConstellationStandalone() bool
- func IsNATSHA() bool
- func IsTunneled(route utils.ProxyRouteConfig) bool
- func ManagedDBBackupRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDBBackupRunRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDBBackupSnapshotsRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDBConnectionRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDBDatabaseIdRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDBDatabasesRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDBIdRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDBRestoreRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDBRotateRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDBRoute(w http.ResponseWriter, req *http.Request)
- func ManagedDatabaseList() []pro.ManagedDatabase
- func MasterNATSClientRouter()
- func NodesUnbrokeRoute(w http.ResponseWriter, req *http.Request)
- func PingLighthouses()
- func PingNATSClient() bool
- func PreviewJoinHostname(yamlBody []byte) (string, error)
- func PublicDeviceListNATS(m *nats.Msg)
- func PublishDomainOp(domain string, state interface{}) error
- func PublishFileDomain(domain string, filename string) error
- func PublishNATSMessage(topic string, payload string) error
- func PublishShieldBan(ban utils.ShieldBan) error
- func ReapplyHostDNS()
- func RegisterRoutesOpResponder(conn *nats.Conn, self string) (*nats.Subscription, error)
- func RegistryClusterHandles() (*sync.RWMutex, nats.JetStreamContext, *nats.Conn)
- func RegistryGCRoute(w http.ResponseWriter, req *http.Request)
- func RegistryGenericFileRoute(w http.ResponseWriter, req *http.Request)
- func RegistryGenericPackageIdRoute(w http.ResponseWriter, req *http.Request)
- func RegistryGenericPackagesRoute(w http.ResponseWriter, req *http.Request)
- func RegistryGenericVersionIdRoute(w http.ResponseWriter, req *http.Request)
- func RegistryGenericVersionsRoute(w http.ResponseWriter, req *http.Request)
- func RegistryIdRoute(w http.ResponseWriter, req *http.Request)
- func RegistryList() []pro.RegistryStatus
- func RegistryNodeInfo() pro.RegistryNodeInfo
- func RegistryRoute(w http.ResponseWriter, req *http.Request)
- func RegistrySettingsRoute(w http.ResponseWriter, req *http.Request)
- func RegistryStaticActivateRoute(w http.ResponseWriter, req *http.Request)
- func RegistryStaticSiteIdRoute(w http.ResponseWriter, req *http.Request)
- func RegistryStaticSitesRoute(w http.ResponseWriter, req *http.Request)
- func RegistryStaticVersionDownloadRoute(w http.ResponseWriter, req *http.Request)
- func RegistryStaticVersionIdRoute(w http.ResponseWriter, req *http.Request)
- func RegistryStaticVersionsRoute(w http.ResponseWriter, req *http.Request)
- func RegistryTokenIdRoute(w http.ResponseWriter, req *http.Request)
- func RegistryTokensRoute(w http.ResponseWriter, req *http.Request)
- func ReloadDNS()
- func RequestRestartNebula()
- func RequestRestartNebulaStaggered()
- func ResetNebula() error
- func RestartNebula()
- func RouteOpTargets(t utils.ConstellationTunnel, self string) ([]string, error)
- func SeaweedFSBackupRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSBackupRunRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSBackupSnapshotsRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSClusterHandles() (*sync.RWMutex, nats.JetStreamContext, *nats.Conn)
- func SeaweedFSDrainRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSIdRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSJobsRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSList() []pro.SeaweedFSStatus
- func SeaweedFSRepairRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSReplaceMasterRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSRestrictRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSS3RouteRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSStatusRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSStorageRoute(w http.ResponseWriter, req *http.Request)
- func SeaweedFSUpgradeRoute(w http.ResponseWriter, req *http.Request)
- func SendNATSMessage(topic string, payload string) (string, error)
- func SendNATSMessageAllReply(topic string, payload string, timeout time.Duration, ...) error
- func SetShieldSyncHandlers(h ShieldSyncHandlers)
- func SetStickyTarget(clientKey string, deviceName string)
- func ShieldBanID(clientID string, at time.Time, node string) string
- func ShieldClientPrefix(clientID string) string
- func ShieldSyncEnabled() bool
- func ShieldSyncInit()
- func StartClientDeviceSync()
- func StartNATS()
- func StartOplogApply()
- func StartSchedulerInConstellation()
- func StartTunnelProber()
- func StateClusterHandles() (*sync.RWMutex, nats.JetStreamContext, *nats.Conn)
- func StateImportRoute(w http.ResponseWriter, req *http.Request)
- func StateRoute(w http.ResponseWriter, req *http.Request)
- func StateStartEmptyRoute(w http.ResponseWriter, req *http.Request)
- func StopDNS()
- func StopHeartbeat()
- func StopNATS()
- func StopOplogApply()
- func StopSchedulerInConstellation()
- func StopShieldSync()
- func StopTunnelProber()
- func TagNodesRoute(w http.ResponseWriter, req *http.Request)
- func TunnelAdvertisers(t utils.ConstellationTunnel) []string
- func TunnelList(w http.ResponseWriter, req *http.Request)
- func UpdateFirewallBlockedClients() error
- func UpdateLocalTunnelCache()
- func ValidateStaticHosts(logBuffer *lumberjack.Logger) error
- type AuthKeysPayload
- type DNSPayload
- type DatabasePayload
- type DeviceBlockRequestJSON
- type DeviceCreateRequestJSON
- type DeviceEditRequestJSON
- type DeviceResyncRequest
- type Domain
- type ErrRouteManaged
- type FilePayload
- type HTTPSSettingsPayload
- type NATSStatus
- type NodeHeartbeat
- type OIDCSigningKeyPayload
- type OpEnvelope
- type OplogSnapshot
- type PublicDeviceInfo
- type RouteOpReply
- type RouteOpRequest
- type ShieldSyncHandlers
Constants ¶
const ( DomainAuthKeys = "auth_keys" DomainDNS = "dns" DomainAPITokens = "api_tokens" DomainRoles = "roles" DomainOpenIDClients = "openid_clients" DomainFileCACrt = "file:ca.crt" DomainFileCAKey = "file:ca.key" DomainFileRclone = "file:rclone.conf" DomainDatabase = "database" DomainDNSZones = "dns_zones" DomainZoneCerts = "zone_certs" DomainHTTPSSettings = "https_settings" DomainOIDCSigningKey = "oidc_signing_key" )
const ( RouteOpUpdate = "update" RouteOpDelete = "delete" )
const ConstellationDNSSuffix = ".constellation."
ConstellationDNSSuffix lets clients that refuse to forward single-label names (systemd-resolved, Windows) reach devices as <name>.constellation
const ShieldBucket = "constellation-shield"
const SubjectRoutesOp = "cosmos.%s.routes.op"
SubjectRoutesOp is the per-node request/reply subject for proxy-route edits coming from another node. A tunneled route lives in the ORIGIN node's config and is only cached on the exit; editing it from the exit's URLs page means asking each advertising origin to change its own copy. Same addressing as cosmos.<node>.manageddb.op: the target is one specific node, never a broadcast, so an edit can only ever land on the nodes that advertised the route.
Variables ¶
var CachedDeviceNames = map[string]string{}
var CachedDevices = map[string]utils.ConstellationDevice{}
var DNSBlacklist = map[string]bool{}
var DNSStarted = false
var NATSClientTopic = ""
var NATSStarted atomic.Bool
var NebulaDefaultConfig utils.NebulaConfig
var NebulaHasStarted = false
var NebulaStarted atomic.Bool
NebulaStarted/NATSStarted are atomic: read from watchdog/supervisor goroutines
var (
ProcessMux sync.Mutex
)
Functions ¶
func API_ConnectToExisting ¶
func API_ConnectToExisting(w http.ResponseWriter, req *http.Request)
API_ConnectToExisting godoc @Summary Connect this node to an existing Constellation VPN network @Tags constellation @Accept application/x-yaml @Produce json @Param body body string true "Nebula YAML configuration" @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/connect [post]
func API_ForceReform ¶ added in v0.23.0
func API_ForceReform(w http.ResponseWriter, req *http.Request)
API_ForceReform godoc @Summary Force the constellation to re-form around this manager @Description HA only. Bumps the op-log epoch, drops local JetStream state, blocks the other managers and restarts NATS, leaving this node writable in formation mode so replacements can be enrolled. Does not touch the CA, keys, config or device data. @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 400 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/force-reform [post]
func API_GetConfig ¶
func API_GetConfig(w http.ResponseWriter, req *http.Request)
API_GetConfig godoc @Summary Get the current Nebula configuration @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/config [get]
func API_GetLogs ¶
func API_GetLogs(w http.ResponseWriter, req *http.Request)
API_GetLogs godoc @Summary Get Nebula VPN service logs @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/logs [get]
func API_GetNextIP ¶ added in v0.21.0
func API_GetNextIP(w http.ResponseWriter, req *http.Request)
API_GetNextIP godoc @Summary Get the next available IP address in the Constellation CIDR range @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/get-next-ip [get]
func API_NATSStatus ¶ added in v0.22.35
func API_NATSStatus(w http.ResponseWriter, req *http.Request)
API_NATSStatus godoc @Summary Detailed NATS/JetStream status for debugging @Description Declared topology (role, HA mode), live NATS server/client/JetStream/KV state, connection counts and known managers. @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Router /api/constellation/nats-status [get]
func API_NewConstellation ¶ added in v0.21.0
func API_NewConstellation(w http.ResponseWriter, req *http.Request)
API_NewConstellation godoc @Summary Create a new Constellation VPN network @Tags constellation @Accept json @Produce json @Param body body object true "Constellation creation payload (deviceName, isLighthouse, hostname, ipRange)" @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 400 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/create [post]
func API_Ping ¶ added in v0.16.0
func API_Ping(w http.ResponseWriter, req *http.Request)
API_Ping godoc @Summary Check if the NATS client connection is alive @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Router /api/constellation/ping [get]
func API_Reset ¶
func API_Reset(w http.ResponseWriter, req *http.Request)
API_Reset godoc @Summary Reset the Nebula VPN configuration @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Router /api/constellation/reset [get]
func API_Restart ¶
func API_Restart(w http.ResponseWriter, req *http.Request)
API_Restart godoc @Summary Restart the Nebula VPN service and HTTP server @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Router /api/constellation/restart [get]
func AdjustDNS ¶ added in v0.19.0
func AdjustDNS(logBuffer *lumberjack.Logger) error
func CIAllBuildsRoute ¶ added in v0.24.0
func CIAllBuildsRoute(w http.ResponseWriter, req *http.Request)
func CIBuildActionRoute ¶ added in v0.24.0
func CIBuildActionRoute(w http.ResponseWriter, req *http.Request)
func CIBuildIdRoute ¶ added in v0.24.0
func CIBuildIdRoute(w http.ResponseWriter, req *http.Request)
func CIBuildLogsRoute ¶ added in v0.24.0
func CIBuildLogsRoute(w http.ResponseWriter, req *http.Request)
func CIBuildsRoute ¶ added in v0.24.0
func CIBuildsRoute(w http.ResponseWriter, req *http.Request)
func CIConnectionReposRoute ¶ added in v0.24.0
func CIConnectionReposRoute(w http.ResponseWriter, req *http.Request)
func CIConnectionsIdRoute ¶ added in v0.24.0
func CIConnectionsIdRoute(w http.ResponseWriter, req *http.Request)
func CIConnectionsRoute ¶ added in v0.24.0
func CIConnectionsRoute(w http.ResponseWriter, req *http.Request)
func CIDetectRoute ¶ added in v0.24.0
func CIDetectRoute(w http.ResponseWriter, req *http.Request)
func CIProjectCopyRoute ¶ added in v0.24.0
func CIProjectCopyRoute(w http.ResponseWriter, req *http.Request)
func CIProjectWebhookRoute ¶ added in v0.24.0
func CIProjectWebhookRoute(w http.ResponseWriter, req *http.Request)
func CIProjectsIdRoute ¶ added in v0.24.0
func CIProjectsIdRoute(w http.ResponseWriter, req *http.Request)
func CIProjectsRoute ¶ added in v0.24.0
func CIProjectsRoute(w http.ResponseWriter, req *http.Request)
func CIRunnersRoute ¶ added in v0.24.0
func CIRunnersRoute(w http.ResponseWriter, req *http.Request)
func CIWebhookRoute ¶ added in v0.24.0
func CIWebhookRoute(w http.ResponseWriter, req *http.Request)
func CheckConstellationToken ¶ added in v0.16.0
TODO: Cache this
func ClientConnectToJS ¶ added in v0.21.0
func ClientConnectToJS() error
func ClientHeartbeatInit ¶ added in v0.21.0
func ClientHeartbeatInit()
func CloseNATSClient ¶ added in v0.16.0
func CloseNATSClient()
func ClusterDomain ¶ added in v0.24.0
func ClusterDomain() string
ClusterDomain is the domain joining servers get their hostname under: the configured one, or the zone this server's own hostname lives in.
func ConnectToExisting ¶ added in v0.22.0
func ConstellationAPIDevices ¶
func ConstellationAPIDevices(w http.ResponseWriter, req *http.Request)
func ConstellationConnected ¶ added in v0.21.0
func ConstellationConnected() bool
func DNSEntriesIdRoute ¶ added in v0.22.0
func DNSEntriesIdRoute(w http.ResponseWriter, req *http.Request)
func DNSEntriesRoute ¶ added in v0.22.0
func DNSEntriesRoute(w http.ResponseWriter, req *http.Request)
func DeleteShieldBan ¶ added in v0.24.0
DeleteShieldBan removes one entry (the shield's cleanup of its own expired bans).
func DeleteShieldBans ¶ added in v0.24.0
DeleteShieldBans removes every entry of a client from the bucket.
func DeploymentsHealthRoute ¶ added in v0.22.19
func DeploymentsHealthRoute(w http.ResponseWriter, req *http.Request)
func DeploymentsIdRoute ¶ added in v0.22.11
func DeploymentsIdRoute(w http.ResponseWriter, req *http.Request)
func DeploymentsRoute ¶ added in v0.22.11
func DeploymentsRoute(w http.ResponseWriter, req *http.Request)
func DeploymentsUnbrokeRoute ¶ added in v0.22.19
func DeploymentsUnbrokeRoute(w http.ResponseWriter, req *http.Request)
func DeviceBlock ¶
func DeviceBlock(w http.ResponseWriter, req *http.Request)
DeviceBlock godoc @Summary Block or unblock a Constellation device @Tags constellation @Accept json @Produce json @Param body body DeviceBlockRequestJSON true "Device block/unblock payload" @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/block [post]
func DeviceCreate_API ¶ added in v0.21.0
func DeviceCreate_API(w http.ResponseWriter, req *http.Request)
DeviceCreate_API godoc @Summary Create a new Constellation device and generate its certificates @Tags constellation @Accept json @Produce json @Param body body DeviceCreateRequestJSON true "Device creation payload" @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/devices [post]
func DeviceEdit_API ¶ added in v0.21.0
func DeviceEdit_API(w http.ResponseWriter, req *http.Request)
DeviceEdit_API godoc @Summary Edit Constellation device properties (this device, or another device's tags) @Tags constellation @Accept json @Produce json @Param body body DeviceEditRequestJSON true "Device edit payload" @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 400 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 404 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/edit-device [post]
func DeviceHostname ¶ added in v0.24.0
DeviceHostname is the hostname a server joining as deviceName gets by default
func DeviceList ¶
func DeviceList(w http.ResponseWriter, req *http.Request)
DeviceList godoc @Summary List Constellation devices for the current user (or all if admin) @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/devices [get]
func DevicePing ¶ added in v0.19.0
func DevicePing(w http.ResponseWriter, req *http.Request)
DevicePing godoc @Summary Ping a Constellation device to check reachability @Tags constellation @Produce json @Param id path string true "Device name/ID" @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 400 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 404 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/devices/{id}/ping [get]
func DevicePublicList ¶ added in v0.19.0
func DevicePublicList(w http.ResponseWriter, req *http.Request)
DevicePublicList godoc @Summary List public information about all non-blocked Constellation devices @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 401 {object} utils.HTTPErrorResult @Failure 500 {object} utils.HTTPErrorResult @Router /api/constellation/public-devices [get]
func DispatchTunnelRouteOp ¶ added in v0.24.0
func DispatchTunnelRouteOp(req RouteOpRequest) ([]string, error)
DispatchTunnelRouteOp sends the op to every advertiser of the named tunnel and returns the nodes that acknowledged. A failure on one origin does not stop the others: the copies are meant to converge, and the operator is told exactly which node refused.
func ExportDefaultConfigToYAML ¶ added in v0.21.0
func ExportLighthouseFromDB ¶ added in v0.21.0
func ExportLighthouseFromDB() error
func FindLocalTunnel ¶ added in v0.24.0
func FindLocalTunnel(name string) (utils.ConstellationTunnel, bool)
FindLocalTunnel returns the cached tunnel advertising the named route.
func FunctionRuntimesRoute ¶ added in v0.24.0
func FunctionRuntimesRoute(w http.ResponseWriter, req *http.Request)
func FunctionsDeployRoute ¶ added in v0.24.0
func FunctionsDeployRoute(w http.ResponseWriter, req *http.Request)
func FunctionsIdRoute ¶ added in v0.24.0
func FunctionsIdRoute(w http.ResponseWriter, req *http.Request)
func FunctionsInvokeRoute ¶ added in v0.24.0
func FunctionsInvokeRoute(w http.ResponseWriter, req *http.Request)
func FunctionsRoute ¶ added in v0.24.0
func FunctionsRoute(w http.ResponseWriter, req *http.Request)
func FunctionsVersionsRoute ¶ added in v0.24.0
func FunctionsVersionsRoute(w http.ResponseWriter, req *http.Request)
func GetAllDevices ¶ added in v0.21.0
func GetAllDevices() ([]utils.ConstellationDevice, error)
func GetAllDevicesEvenBlocked ¶ added in v0.21.0
func GetAllDevicesEvenBlocked() ([]utils.ConstellationDevice, error)
func GetAllLightHouses ¶
func GetAllLightHouses() ([]utils.ConstellationDevice, error)
func GetAllLighthouseIPFromTempConfig ¶ added in v0.21.0
func GetAllTunneledRoutes ¶ added in v0.21.0
func GetAllTunneledRoutes() []utils.ProxyRouteConfig
func GetCertFingerprint ¶
func GetClusterIPs ¶ added in v0.21.0
func GetConfigAttribute ¶ added in v0.18.0
func GetConstellationFromIP ¶ added in v0.22.19
func GetConstellationFromIP(ip string) *utils.ConstellationDevice
func GetCurrentDevice ¶ added in v0.21.0
func GetCurrentDevice() (utils.ConstellationDevice, error)
func GetCurrentDeviceAPIKey ¶ added in v0.21.0
func GetCurrentDeviceHostname ¶ added in v0.21.0
func GetCurrentDeviceIP ¶ added in v0.21.0
func GetCurrentDeviceIsExitNode ¶ added in v0.21.0
func GetCurrentDeviceIsLoadbalancer ¶ added in v0.21.0
func GetCurrentDeviceIsRelay ¶ added in v0.21.0
func GetCurrentDeviceName ¶ added in v0.21.0
func GetCurrentLeaderName ¶ added in v0.22.19
func GetCurrentLeaderName() string
func GetDefaultHostnames ¶ added in v0.21.0
func GetDefaultHostnames() []string
func GetDeviceConfigManualSync ¶ added in v0.16.0
func GetDeviceConfigManualSync(w http.ResponseWriter, req *http.Request)
GetDeviceConfigManualSync godoc @Summary Rebuild a Constellation device configuration for a manual resync @Description Rebuilds the device's configuration, without its private key or API key, for a resync QR code. Allowed for an admin or the device's owner. @Tags constellation @Accept json @Produce json @Security BearerAuth @Param body body DeviceResyncRequest true "Device to resync" @Success 200 {object} utils.APIResponse @Failure 400 {object} utils.HTTPErrorResult @Failure 403 {object} utils.HTTPErrorResult @Failure 404 {object} utils.HTTPErrorResult @Router /api/constellation/config-manual-sync [post]
func GetDeviceIp ¶ added in v0.16.0
func GetLocalTunnelCache ¶ added in v0.21.0
func GetLocalTunnelCache() []utils.ConstellationTunnel
func GetNATSCredentials ¶ added in v0.16.0
func GetNextAvailableIP ¶ added in v0.21.0
GetNextAvailableIP fetches all used IPs from the database and returns the next available IP in the given CIDR range
func GetStickyTarget ¶ added in v0.22.0
func InitConfig ¶
func InitConfig()
func InitHostname ¶ added in v0.21.0
func InitHostname()
func InitNATSClient ¶ added in v0.16.0
func InitNATSClient() error
func InitPingLighthouses ¶ added in v0.19.0
func InitPingLighthouses()
func IsClientConnected ¶ added in v0.16.0
func IsClientConnected() bool
func IsClientNode ¶ added in v0.23.1
func IsClientNode() bool
func IsClientSynced ¶ added in v0.23.1
func IsClientSynced() bool
func IsConstellationIP ¶ added in v0.21.0
func IsConstellationStandalone ¶ added in v0.22.10
func IsConstellationStandalone() bool
IsConstellationStandalone reports whether this server has no Cosmos peers to talk to over NATS — neither peer lighthouses to cluster with nor non- lighthouse Cosmos servers that would connect to this node as clients. Plain Nebula client devices (CosmosNode == 0) don't run NATS so they don't count. When true, all NATS-adjacent activity must be skipped.
func IsNATSHA ¶ added in v0.22.35
func IsNATSHA() bool
IsNATSHA reports whether this constellation was created with the HA (clustered JetStream) option. Immutable: read from the creator's main config (NATSReplicas >= 3) or from this node's device config (cstln_nats_ha).
func IsTunneled ¶ added in v0.21.0
func IsTunneled(route utils.ProxyRouteConfig) bool
func ManagedDBBackupRoute ¶ added in v0.24.0
func ManagedDBBackupRoute(w http.ResponseWriter, req *http.Request)
func ManagedDBBackupRunRoute ¶ added in v0.24.0
func ManagedDBBackupRunRoute(w http.ResponseWriter, req *http.Request)
func ManagedDBBackupSnapshotsRoute ¶ added in v0.24.0
func ManagedDBBackupSnapshotsRoute(w http.ResponseWriter, req *http.Request)
func ManagedDBConnectionRoute ¶ added in v0.24.0
func ManagedDBConnectionRoute(w http.ResponseWriter, req *http.Request)
func ManagedDBDatabaseIdRoute ¶ added in v0.24.0
func ManagedDBDatabaseIdRoute(w http.ResponseWriter, req *http.Request)
func ManagedDBDatabasesRoute ¶ added in v0.24.0
func ManagedDBDatabasesRoute(w http.ResponseWriter, req *http.Request)
func ManagedDBIdRoute ¶ added in v0.24.0
func ManagedDBIdRoute(w http.ResponseWriter, req *http.Request)
func ManagedDBRestoreRoute ¶ added in v0.24.0
func ManagedDBRestoreRoute(w http.ResponseWriter, req *http.Request)
ManagedDBRestoreRoute must be registered before /databases/{name}, which would otherwise match "restore".
func ManagedDBRotateRoute ¶ added in v0.24.0
func ManagedDBRotateRoute(w http.ResponseWriter, req *http.Request)
func ManagedDBRoute ¶ added in v0.24.0
func ManagedDBRoute(w http.ResponseWriter, req *http.Request)
func ManagedDatabaseList ¶ added in v0.24.0
func ManagedDatabaseList() []pro.ManagedDatabase
ManagedDatabaseList is best-effort: a KV failure returns nil so ${db.*} placeholders stay literal.
func MasterNATSClientRouter ¶ added in v0.16.0
func MasterNATSClientRouter()
func NodesUnbrokeRoute ¶ added in v0.22.19
func NodesUnbrokeRoute(w http.ResponseWriter, req *http.Request)
func PingLighthouses ¶ added in v0.19.0
func PingLighthouses()
func PingNATSClient ¶ added in v0.16.0
func PingNATSClient() bool
func PreviewJoinHostname ¶ added in v0.24.0
ConnectToExisting applies a Nebula YAML config to connect this node to an existing Constellation network. It returns the updated config. The caller is responsible for persisting the config and restarting Nebula. PreviewJoinHostname reads the hostname a server would take by joining with this constellation file, without touching anything.
func PublicDeviceListNATS ¶ added in v0.21.0
func PublishDomainOp ¶ added in v0.23.0
PublishDomainOp publishes the full state of a config domain and waits for the apply loop to install it locally. Callers must NOT hold utils.ConfigLock — the apply path takes it.
func PublishFileDomain ¶ added in v0.23.0
PublishFileDomain publishes a loose config file's current contents as the full state of its domain.
func PublishNATSMessage ¶ added in v0.16.0
func PublishShieldBan ¶ added in v0.24.0
func ReapplyHostDNS ¶ added in v0.24.0
func ReapplyHostDNS()
ReapplyHostDNS follows a change of the setting while the DNS runs
func RegisterRoutesOpResponder ¶ added in v0.24.0
RegisterRoutesOpResponder subscribes this node to its own routes-op subject.
func RegistryClusterHandles ¶ added in v0.24.0
RegistryClusterHandles hands pro the current cluster handles, read at call time.
func RegistryGCRoute ¶ added in v0.24.0
func RegistryGCRoute(w http.ResponseWriter, req *http.Request)
func RegistryGenericFileRoute ¶ added in v0.24.0
func RegistryGenericFileRoute(w http.ResponseWriter, req *http.Request)
func RegistryGenericPackageIdRoute ¶ added in v0.24.0
func RegistryGenericPackageIdRoute(w http.ResponseWriter, req *http.Request)
func RegistryGenericPackagesRoute ¶ added in v0.24.0
func RegistryGenericPackagesRoute(w http.ResponseWriter, req *http.Request)
func RegistryGenericVersionIdRoute ¶ added in v0.24.0
func RegistryGenericVersionIdRoute(w http.ResponseWriter, req *http.Request)
func RegistryGenericVersionsRoute ¶ added in v0.24.0
func RegistryGenericVersionsRoute(w http.ResponseWriter, req *http.Request)
func RegistryIdRoute ¶ added in v0.24.0
func RegistryIdRoute(w http.ResponseWriter, req *http.Request)
func RegistryList ¶ added in v0.24.0
func RegistryList() []pro.RegistryStatus
RegistryList is best-effort: a KV failure returns nil, treated as "unavailable", never "no registries".
func RegistryNodeInfo ¶ added in v0.24.0
func RegistryNodeInfo() pro.RegistryNodeInfo
RegistryNodeInfo projects this device onto the registry serving paths: placement tags and the node-to-node auth key.
func RegistryRoute ¶ added in v0.24.0
func RegistryRoute(w http.ResponseWriter, req *http.Request)
func RegistrySettingsRoute ¶ added in v0.24.0
func RegistrySettingsRoute(w http.ResponseWriter, req *http.Request)
func RegistryStaticActivateRoute ¶ added in v0.24.0
func RegistryStaticActivateRoute(w http.ResponseWriter, req *http.Request)
func RegistryStaticSiteIdRoute ¶ added in v0.24.0
func RegistryStaticSiteIdRoute(w http.ResponseWriter, req *http.Request)
func RegistryStaticSitesRoute ¶ added in v0.24.0
func RegistryStaticSitesRoute(w http.ResponseWriter, req *http.Request)
func RegistryStaticVersionDownloadRoute ¶ added in v0.24.0
func RegistryStaticVersionDownloadRoute(w http.ResponseWriter, req *http.Request)
func RegistryStaticVersionIdRoute ¶ added in v0.24.0
func RegistryStaticVersionIdRoute(w http.ResponseWriter, req *http.Request)
func RegistryStaticVersionsRoute ¶ added in v0.24.0
func RegistryStaticVersionsRoute(w http.ResponseWriter, req *http.Request)
func RegistryTokenIdRoute ¶ added in v0.24.0
func RegistryTokenIdRoute(w http.ResponseWriter, req *http.Request)
func RegistryTokensRoute ¶ added in v0.24.0
func RegistryTokensRoute(w http.ResponseWriter, req *http.Request)
func ReloadDNS ¶ added in v0.23.0
func ReloadDNS()
ReloadDNS rebinds the DNS server against the current config. Reaction of the dns op-log domain, replacing the old restart-everything sync.
func RequestRestartNebula ¶ added in v0.23.0
func RequestRestartNebula()
RequestRestartNebula coalesces reactive restarts (oplog apply, snapshot install) so a burst of device writes triggers one restart, not one each.
func RequestRestartNebulaStaggered ¶ added in v0.23.0
func RequestRestartNebulaStaggered()
RequestRestartNebulaStaggered delays each node by its rank in the shared device table, turning a thundering-herd restart into a rolling one.
func ResetNebula ¶
func ResetNebula() error
func RestartNebula ¶
func RestartNebula()
func RouteOpTargets ¶ added in v0.24.0
func RouteOpTargets(t utils.ConstellationTunnel, self string) ([]string, error)
RouteOpTargets decides which nodes an edit of a cached tunnel goes to: exactly its advertisers, minus this node (a local copy is edited locally by the caller, never through NATS). Refuses managed routes up front.
func SeaweedFSBackupRoute ¶ added in v0.24.0
func SeaweedFSBackupRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSBackupRunRoute ¶ added in v0.24.0
func SeaweedFSBackupRunRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSBackupSnapshotsRoute ¶ added in v0.24.0
func SeaweedFSBackupSnapshotsRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSClusterHandles ¶ added in v0.24.0
SeaweedFSClusterHandles hands pro the current cluster handles, read at call time.
func SeaweedFSDrainRoute ¶ added in v0.24.0
func SeaweedFSDrainRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSIdRoute ¶ added in v0.24.0
func SeaweedFSIdRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSJobsRoute ¶ added in v0.24.0
func SeaweedFSJobsRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSList ¶ added in v0.24.0
func SeaweedFSList() []pro.SeaweedFSStatus
SeaweedFSList is best-effort: a KV failure returns nil, treated as "unavailable", never "empty cluster".
func SeaweedFSRepairRoute ¶ added in v0.24.0
func SeaweedFSRepairRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSReplaceMasterRoute ¶ added in v0.24.0
func SeaweedFSReplaceMasterRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSRestrictRoute ¶ added in v0.24.0
func SeaweedFSRestrictRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSRoute ¶ added in v0.24.0
func SeaweedFSRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSS3RouteRoute ¶ added in v0.24.0
func SeaweedFSS3RouteRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSStatusRoute ¶ added in v0.24.0
func SeaweedFSStatusRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSStorageRoute ¶ added in v0.24.0
func SeaweedFSStorageRoute(w http.ResponseWriter, req *http.Request)
func SeaweedFSUpgradeRoute ¶ added in v0.24.0
func SeaweedFSUpgradeRoute(w http.ResponseWriter, req *http.Request)
func SendNATSMessage ¶ added in v0.16.0
func SendNATSMessageAllReply ¶ added in v0.21.0
func SetShieldSyncHandlers ¶ added in v0.24.0
func SetShieldSyncHandlers(h ShieldSyncHandlers)
func SetStickyTarget ¶ added in v0.22.0
func ShieldBanID ¶ added in v0.24.0
ShieldBanID builds the bucket key for a ban: the client prefix lets unban delete a client's whole history with one listing.
func ShieldClientPrefix ¶ added in v0.24.0
func ShieldSyncEnabled ¶ added in v0.24.0
func ShieldSyncEnabled() bool
func ShieldSyncInit ¶ added in v0.24.0
func ShieldSyncInit()
ShieldSyncInit watches the bucket and feeds the registered handlers, the same shape as the nodes-bucket watcher: the outer loop re-establishes the watcher whenever its stream goes away.
func StartClientDeviceSync ¶ added in v0.23.1
func StartClientDeviceSync()
StartClientDeviceSync does one fetch on connect, retried up to 5 times every 15s. A restart bumps the generation so a stale attempt exits.
func StartOplogApply ¶ added in v0.23.0
func StartOplogApply()
StartOplogApply brings up the apply loop; safe to call repeatedly.
func StartSchedulerInConstellation ¶ added in v0.22.11
func StartSchedulerInConstellation()
func StartTunnelProber ¶ added in v0.23.0
func StartTunnelProber()
func StateClusterHandles ¶ added in v0.24.0
StateClusterHandles hands pro the current cluster handles, read at call time.
func StateImportRoute ¶ added in v0.24.0
func StateImportRoute(w http.ResponseWriter, req *http.Request)
func StateRoute ¶ added in v0.24.0
func StateRoute(w http.ResponseWriter, req *http.Request)
func StateStartEmptyRoute ¶ added in v0.24.0
func StateStartEmptyRoute(w http.ResponseWriter, req *http.Request)
func StopHeartbeat ¶ added in v0.21.0
func StopHeartbeat()
func StopOplogApply ¶ added in v0.23.0
func StopOplogApply()
StopOplogApply tears the loop down. Never blocks: it runs from CloseNATSClient/StopNATS, which RestartNebula calls from an apply reaction.
func StopSchedulerInConstellation ¶ added in v0.22.11
func StopSchedulerInConstellation()
func StopShieldSync ¶ added in v0.24.0
func StopShieldSync()
func StopTunnelProber ¶ added in v0.23.0
func StopTunnelProber()
func TagNodesRoute ¶ added in v0.24.0
func TagNodesRoute(w http.ResponseWriter, req *http.Request)
TagNodesRoute answers "which nodes does this tag set select, right now".
func TunnelAdvertisers ¶ added in v0.24.0
func TunnelAdvertisers(t utils.ConstellationTunnel) []string
TunnelAdvertisers lists the device names advertising a cached tunnel.
func TunnelList ¶ added in v0.21.0
func TunnelList(w http.ResponseWriter, req *http.Request)
TunnelList godoc @Summary List all active Constellation tunnels @Tags constellation @Produce json @Security BearerAuth @Success 200 {object} utils.APIResponse @Failure 403 {object} utils.HTTPErrorResult @Router /api/constellation/tunnels [get]
func UpdateFirewallBlockedClients ¶ added in v0.19.0
func UpdateFirewallBlockedClients() error
func UpdateLocalTunnelCache ¶ added in v0.21.0
func UpdateLocalTunnelCache()
func ValidateStaticHosts ¶ added in v0.19.0
func ValidateStaticHosts(logBuffer *lumberjack.Logger) error
Types ¶
type AuthKeysPayload ¶ added in v0.23.0
type DNSPayload ¶ added in v0.23.0
type DatabasePayload ¶ added in v0.23.0
type DatabasePayload struct {
PostgresHost string `json:"postgresHost"`
PostgresDatabase string `json:"postgresDatabase"`
PostgresUsername string `json:"postgresUsername"`
PostgresPassword string `json:"postgresPassword"`
}
DatabasePayload carries the Postgres connection only. NodeName stays node-local: it is this node's metrics identity.
type DeviceBlockRequestJSON ¶
type DeviceCreateRequestJSON ¶
type DeviceCreateRequestJSON struct {
DeviceName string `json:"deviceName" validate:"required,min=3,max=32"`
IP string `json:"ip" validate:"required,ipv4"`
// for devices only
Nickname string `json:"nickname,omitempty" validate:"omitempty,max=32"`
Invisible bool `json:"invisible,omitempty"`
// for lighthouse only
IsLighthouse bool `json:"isLighthouse,omitempty"`
CosmosNode int `json:"cosmosNode,omitempty"`
IsRelay bool `json:"isRelay,omitempty"`
IsLoadBalancer bool `json:"isLoadBalancer,omitempty"`
IsExitNode bool `json:"isExitNode,omitempty"`
PublicHostname string `json:"PublicHostname,omitempty"`
Port string `json:"port,omitempty"`
// internal
APIKey string `json:"-"`
}
func DeviceCreate ¶
func DeviceCreate(request DeviceCreateRequestJSON) (string, string, string, DeviceCreateRequestJSON, error)
type DeviceEditRequestJSON ¶ added in v0.21.0
type DeviceEditRequestJSON struct {
// Empty means "this node" (full edit); set means a remote tags-only edit.
DeviceName string `json:"deviceName" validate:"omitempty,min=3,max=32"`
IsLighthouse bool `json:"isLighthouse"`
IsRelay bool `json:"isRelay"`
IsExitNode bool `json:"isExitNode"`
IsLoadBalancer bool `json:"isLoadBalancer"`
Tags []string `json:"tags" validate:"omitempty,dive,min=1,max=64"`
}
type DeviceResyncRequest ¶ added in v0.16.0
type Domain ¶ added in v0.23.0
type Domain struct {
Name string
Apply func(state json.RawMessage) error
React func(old json.RawMessage, new json.RawMessage)
Snapshot func() (json.RawMessage, error)
}
Everything the op-log replicates that isn't a SQLite row lives here, one entry per domain. Adding a future domain is one registry entry — that is the point of the indirection.
Apply runs with utils.ConfigLock already held by the caller; React runs after the sequence is committed, and must not block the apply loop.
type ErrRouteManaged ¶ added in v0.24.0
ErrRouteManaged is returned when the edit targets a route an owner materializes. Those are edited on the owner, never through this path: the owner would overwrite the change on its next apply.
func (ErrRouteManaged) Error ¶ added in v0.24.0
func (e ErrRouteManaged) Error() string
type FilePayload ¶ added in v0.23.0
type FilePayload struct {
Data string `json:"data"`
}
FilePayload carries a loose config file as base64. Empty Data means "no such file here" and is never applied, so a node that lacks a CA can't wipe everyone's.
type HTTPSSettingsPayload ¶ added in v0.24.0
type HTTPSSettingsPayload struct {
SSLEmail string `json:"sslEmail"`
}
HTTPSSettingsPayload is what the servers of a cluster share about HTTPS besides the zones: the contact their certificates are requested with. Everything else about HTTPS belongs to a zone, or to one server (HTTP only).
type NATSStatus ¶ added in v0.22.35
type NATSStatus struct {
// declared topology
Role string `json:"role"` // "manager" | "agent"
HAMode bool `json:"haMode"` // clustered JetStream constellation
// live state
NebulaStarted bool `json:"nebulaStarted"`
ServerRunning bool `json:"serverRunning"`
ClientConnected bool `json:"clientConnected"`
// Starting: within the post-start grace period — failing steps are
// likely still coming up rather than broken
Starting bool `json:"starting"`
// "disabled" (agents, proxied to managers) | "standalone" | "clustered"
JetStreamMode string `json:"jetstreamMode"`
JetStreamReady bool `json:"jetstreamReady"` // JS API answers
KVNodesReady bool `json:"kvNodesReady"` // constellation-nodes bucket reachable
KnownManagers []string `json:"knownManagers"`
// connection counts from the embedded server
ConnectedClients int `json:"connectedClients"`
ConnectedLeafs int `json:"connectedLeafs"` // manager: attached agents; agent: 1 when attached to a manager
ClusterRoutes int `json:"clusterRoutes"` // HA managers: connected manager routes
// ManagerLinkUp: can this node reach a manager's NATS — matters on
// agents, whose local client is always connected to its own server.
ManagerLinkUp bool `json:"managerLinkUp"`
// op-log health. OplogAttached is also "config is writable here": writes
// are published, not applied locally, so a detached node is read-only.
OplogAttached bool `json:"oplogAttached"`
OplogHalted bool `json:"oplogHalted"`
OplogHaltReason string `json:"oplogHaltReason,omitempty"`
OplogEpoch uint64 `json:"oplogEpoch"`
OplogSeq uint64 `json:"oplogSeq"`
ConfigWritable bool `json:"configWritable"`
// OplogReplicas is the log's actual replication factor, 0 when the stream is
// not reachable. It is the only externally visible evidence that the R1→R3
// scale-up happened: writes succeed perfectly well against an R1 stream, so a
// cluster that silently never scaled looks identical to a healthy one.
OplogReplicas int `json:"oplogReplicas"`
}
NATSStatus is a debugging snapshot of this node's declared topology and the live state of the embedded NATS stack.
func GetNATSStatus ¶ added in v0.22.35
func GetNATSStatus() NATSStatus
type NodeHeartbeat ¶ added in v0.21.0
type NodeHeartbeat struct {
DeviceName string
IP string
IsRelay bool
IsLighthouse bool
IsExitNode bool
CosmosNode int
Tunnels []utils.ProxyRouteConfig
// Hostnames are the names this node serves itself (main hostname and
// non-tunneled routes) so every constellation DNS can answer for them.
Hostnames []string `json:"hostnames,omitempty"`
// PublicAddr is the address the public DNS records of this node point at
// (see HTTPConfig.AdvertisedAddress), empty when no zone manages records.
PublicAddr string `json:"publicAddr,omitempty"`
// RunningDeployments is the list of scheduler-managed deployment names
// currently running on this node, derived from docker containers carrying
// the `cosmos-deployment` label. Populated from docker at heartbeat time;
// see UpdateLocalTunnelCache / heartbeat goroutine in tunnels.go.
RunningDeployments []string `json:"runningDeployments"`
// RunningDeploymentVersions maps each running deployment name to the spec
// version its containers were created from (the cosmos-deployment-version
// label). The scheduler diffs this against the desired Deployment.Version to
// detect a node running a stale spec and trigger a rolling re-apply. Built
// from docker alongside RunningDeployments each heartbeat.
RunningDeploymentVersions map[string]int `json:"runningDeploymentVersions,omitempty"`
// Liveness only, from the `cosmos-managed-db` label; never folded into
// RunningDeployments, which the scheduler prunes of unrecognized entries.
ManagedDBs []string `json:"managedDBs,omitempty"`
// Same contract as ManagedDBs, from the `cosmos-seaweedfs` label (masters
// only; the volume/filer tiers are deployments and report normally).
SeaweedFS []string `json:"seaweedfs,omitempty"`
// Registry endpoints this node serves. Same contract as ManagedDBs, but
// derived from the access records and this node's tags, not from docker.
Registries []string `json:"registries,omitempty"`
// Load sample from pro.GetCurrentResources(); RAMPercent is memory
// pressure (PSI + exhaustion guard), not occupancy. Zero when MonitoringOn is false.
CPUPercent float64 `json:"cpuPercent,omitempty"`
RAMPercent float64 `json:"ramPercent,omitempty"`
// MonitoringOn signals whether CPU/RAM numbers are trustworthy. False when
// the operator disabled monitoring (MonitoringDisabled config flag) or
// when the sampler hasn't produced a reading yet.
MonitoringOn bool `json:"monitoringOn"`
// Tags mirror ConstellationDevice.Tags so the leader can filter eligible
// placement targets by deployment affinity without an extra DB round-trip.
Tags []string `json:"tags,omitempty"`
// Draining is set while a restart waits for this node's running jobs:
// the leader must not hand it new CI builds (see utils.PlanRestart).
Draining bool `json:"draining,omitempty"`
// Arch is the CPU architecture; Platforms the container platforms the
// node can build for (native plus QEMU-emulated), for the CI runners page.
Arch string `json:"arch,omitempty"`
Platforms []string `json:"platforms,omitempty"`
}
type OIDCSigningKeyPayload ¶ added in v0.24.0
type OIDCSigningKeyPayload struct {
Key string `json:"key"`
}
type OpEnvelope ¶ added in v0.23.0
type OpEnvelope struct {
V int `json:"v"`
Epoch uint64 `json:"epoch"`
Kind string `json:"kind"` // "db" | "domain"
Table string `json:"table,omitempty"`
Domain string `json:"domain,omitempty"`
Op string `json:"op"`
PK string `json:"pk,omitempty"` // informational, for log reading
Filter map[string]interface{} `json:"filter,omitempty"`
Doc json.RawMessage `json:"doc,omitempty"`
Origin string `json:"origin"`
ReqID string `json:"reqId"`
}
OpEnvelope is one entry in the log. Domain payloads carry the FULL domain state with op "set", which makes them idempotent and last-writer-wins in stream order; db payloads carry a filter+doc mutation.
type OplogSnapshot ¶ added in v0.23.0
type OplogSnapshot struct {
Epoch uint64 `json:"epoch"`
Seq uint64 `json:"seq"`
Dump json.RawMessage `json:"dump"`
Domains map[string]json.RawMessage `json:"domains"`
}
type PublicDeviceInfo ¶ added in v0.19.0
type PublicDeviceInfo struct {
DeviceID string `json:"id"`
DeviceName string `json:"name"`
User string `json:"user"`
IP string `json:"ip"`
IsLighthouse bool `json:"isLighthouse"`
CosmosNode int `json:"cosmosNode"`
IsRelay bool `json:"isRelay"`
IsExitNode bool `json:"isExitNode"`
PublicHostname string `json:"publicHostname"`
Port string `json:"port"`
}
PublicDeviceInfo represents the limited device information exposed to the public API
type RouteOpReply ¶ added in v0.24.0
RouteOpReply is the origin→exit response.
func ExecuteRouteOp ¶ added in v0.24.0
func ExecuteRouteOp(req RouteOpRequest) RouteOpReply
ExecuteRouteOp applies one op to THIS node's config. Exported so the NATS responder and any in-process caller share exactly one implementation.
The sequence is the one every route mutation uses: ConfigLock → read the file → mutate → SetBaseMainConfig → async restart.
type RouteOpRequest ¶ added in v0.24.0
type RouteOpRequest struct {
Op string `json:"op"`
Name string `json:"name"`
// Route is the full new route for an update. Its Name may differ from
// Name (a rename); the origin replaces the entry found by Name.
Route *utils.ProxyRouteConfig `json:"route,omitempty"`
// Origin is the device that issued the edit, for logs.
Origin string `json:"origin,omitempty"`
}
RouteOpRequest is the exit→origin payload.
Source Files
¶
- DNS.go
- NATS.go
- NATS_client_only.go
- api_ci.go
- api_deployments.go
- api_devices_block.go
- api_devices_config.go
- api_devices_create.go
- api_devices_edit.go
- api_devices_index.go
- api_devices_list.go
- api_devices_ping.go
- api_devices_public.go
- api_dns.go
- api_force_reform.go
- api_functions.go
- api_get_ip.go
- api_manageddb.go
- api_nebula.go
- api_nebula_connect.go
- api_registry.go
- api_seaweedfs.go
- api_state.go
- api_tunnels.go
- config-manip.go
- dns_cluster.go
- dns_match.go
- hostdns.go
- hostdns_linux.go
- index.go
- nebula.go
- nebula_default.go
- oplog.go
- oplog_apply.go
- oplog_domains.go
- oplog_snapshot.go
- routes_op.go
- scheduler.go
- shield_kv.go
- tunnel_health.go
- tunnels.go
- zones.go
- zones_records.go