package app import "sync" const ( singBoxProfilesStateVersion = 1 ) const ( singBoxProfileCodeNotFound = "SINGBOX_PROFILE_NOT_FOUND" singBoxProfileCodeIDConflict = "SINGBOX_PROFILE_ID_CONFLICT" singBoxProfileCodeBadID = "SINGBOX_PROFILE_ID_INVALID" singBoxProfileCodeBadMode = "SINGBOX_PROFILE_MODE_INVALID" singBoxProfileCodeBadBaseRevision = "SINGBOX_PROFILE_BASE_REVISION_INVALID" singBoxProfileCodeRevisionMismatch = "SINGBOX_PROFILE_REVISION_MISMATCH" singBoxProfileCodeSaveFailed = "SINGBOX_PROFILE_SAVE_FAILED" singBoxProfileCodeSecretsFailed = "SINGBOX_PROFILE_SECRETS_FAILED" singBoxProfileCodeValidationFailed = "SINGBOX_PROFILE_VALIDATION_FAILED" singBoxProfileCodeRenderFailed = "SINGBOX_PROFILE_RENDER_FAILED" singBoxProfileCodeApplyFailed = "SINGBOX_PROFILE_APPLY_FAILED" singBoxProfileCodeRollbackFailed = "SINGBOX_PROFILE_ROLLBACK_FAILED" singBoxProfileCodeHistoryMissing = "SINGBOX_PROFILE_HISTORY_NOT_FOUND" singBoxProfileCodeNoClient = "SINGBOX_PROFILE_CLIENT_NOT_FOUND" singBoxProfileCodeClientKind = "SINGBOX_PROFILE_CLIENT_KIND_MISMATCH" singBoxProfileCodeRuntimeFailed = "SINGBOX_PROFILE_RUNTIME_FAILED" ) var ( singBoxProfilesMu sync.Mutex singBoxProfilesStatePath = stateDir + "/transport/singbox-profiles.json" singBoxSecretsRootDir = stateDir + "/transport/secrets/singbox" ) type singBoxProfilesState struct { Version int `json:"version"` UpdatedAt string `json:"updated_at,omitempty"` Revision int64 `json:"revision,omitempty"` ActiveProfileID string `json:"active_profile_id,omitempty"` Items []SingBoxProfile `json:"items,omitempty"` }