mirror of
https://github.com/foxhole-team/foxhole-guard.git
synced 2026-10-21 10:45:41 +02:00
1281 lines
39 KiB
JSON
1281 lines
39 KiB
JSON
{
|
|
"formatVersion": 1,
|
|
"database": {
|
|
"version": 13,
|
|
"identityHash": "9a9accb62f281e314b538ae74926ea7d",
|
|
"entities": [
|
|
{
|
|
"tableName": "profiles",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `sourceType` TEXT NOT NULL, `secretRef` TEXT NOT NULL, `protocolHint` TEXT NOT NULL, `lastUpdatedAt` INTEGER, `lastEtag` TEXT, `isActive` INTEGER NOT NULL)",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "name",
|
|
"columnName": "name",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "sourceType",
|
|
"columnName": "sourceType",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "secretRef",
|
|
"columnName": "secretRef",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "protocolHint",
|
|
"columnName": "protocolHint",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "lastUpdatedAt",
|
|
"columnName": "lastUpdatedAt",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "lastEtag",
|
|
"columnName": "lastEtag",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "isActive",
|
|
"columnName": "isActive",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"tableName": "routing_presets",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `source` TEXT NOT NULL, `catalogId` INTEGER, `overrideMode` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `updatedAt` INTEGER NOT NULL, `isActive` INTEGER NOT NULL)",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "name",
|
|
"columnName": "name",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "source",
|
|
"columnName": "source",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "catalogId",
|
|
"columnName": "catalogId",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "overrideMode",
|
|
"columnName": "overrideMode",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "enabled",
|
|
"columnName": "enabled",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "updatedAt",
|
|
"columnName": "updatedAt",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "isActive",
|
|
"columnName": "isActive",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
},
|
|
"indices": [
|
|
{
|
|
"name": "index_routing_presets_catalogId",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"catalogId"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_routing_presets_catalogId` ON `${TABLE_NAME}` (`catalogId`)"
|
|
},
|
|
{
|
|
"name": "index_routing_presets_isActive",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"isActive"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_routing_presets_isActive` ON `${TABLE_NAME}` (`isActive`)"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tableName": "routing_rules",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `presetId` INTEGER NOT NULL, `name` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `order` INTEGER NOT NULL, `action` TEXT NOT NULL, `matchDomains` TEXT NOT NULL, `matchIpCidrs` TEXT NOT NULL, `matchPorts` TEXT NOT NULL, `matchProtocols` TEXT NOT NULL, `matchNetworks` TEXT NOT NULL, FOREIGN KEY(`presetId`) REFERENCES `routing_presets`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "presetId",
|
|
"columnName": "presetId",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "name",
|
|
"columnName": "name",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "enabled",
|
|
"columnName": "enabled",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "order",
|
|
"columnName": "order",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "action",
|
|
"columnName": "action",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "matchDomains",
|
|
"columnName": "matchDomains",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "matchIpCidrs",
|
|
"columnName": "matchIpCidrs",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "matchPorts",
|
|
"columnName": "matchPorts",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "matchProtocols",
|
|
"columnName": "matchProtocols",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "matchNetworks",
|
|
"columnName": "matchNetworks",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
},
|
|
"indices": [
|
|
{
|
|
"name": "index_routing_rules_presetId",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"presetId"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_routing_rules_presetId` ON `${TABLE_NAME}` (`presetId`)"
|
|
}
|
|
],
|
|
"foreignKeys": [
|
|
{
|
|
"table": "routing_presets",
|
|
"onDelete": "CASCADE",
|
|
"onUpdate": "NO ACTION",
|
|
"columns": [
|
|
"presetId"
|
|
],
|
|
"referencedColumns": [
|
|
"id"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tableName": "routing_catalogs",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT NOT NULL, `url` TEXT NOT NULL, `enabled` INTEGER NOT NULL, `etag` TEXT, `lastSyncAt` INTEGER, `warningAcceptedAt` INTEGER, `cachedManifestJson` TEXT)",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "name",
|
|
"columnName": "name",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "url",
|
|
"columnName": "url",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "enabled",
|
|
"columnName": "enabled",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "etag",
|
|
"columnName": "etag",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "lastSyncAt",
|
|
"columnName": "lastSyncAt",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "warningAcceptedAt",
|
|
"columnName": "warningAcceptedAt",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "cachedManifestJson",
|
|
"columnName": "cachedManifestJson",
|
|
"affinity": "TEXT"
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
},
|
|
"indices": [
|
|
{
|
|
"name": "index_routing_catalogs_url",
|
|
"unique": true,
|
|
"columnNames": [
|
|
"url"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_routing_catalogs_url` ON `${TABLE_NAME}` (`url`)"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tableName": "traffic_windows",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `startedAtMs` INTEGER NOT NULL, `durationSec` INTEGER NOT NULL, `networkType` TEXT NOT NULL, `vpnMode` TEXT NOT NULL, `profileId` TEXT, `protocol` TEXT, `hourBucket` INTEGER NOT NULL, `rxBytes` INTEGER NOT NULL, `txBytes` INTEGER NOT NULL, `blockedDns` INTEGER NOT NULL, `allowedDns` INTEGER NOT NULL, `reconnects` INTEGER NOT NULL, `latencyMs` INTEGER, `destinationCountries` TEXT NOT NULL, `blockedDnsDomains` TEXT NOT NULL, `blockedDnsByCategory` TEXT NOT NULL DEFAULT '{}', `blockedDnsApps` TEXT NOT NULL DEFAULT '{}')",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "startedAtMs",
|
|
"columnName": "startedAtMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "durationSec",
|
|
"columnName": "durationSec",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "networkType",
|
|
"columnName": "networkType",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "vpnMode",
|
|
"columnName": "vpnMode",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "profileId",
|
|
"columnName": "profileId",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "protocol",
|
|
"columnName": "protocol",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "hourBucket",
|
|
"columnName": "hourBucket",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "rxBytes",
|
|
"columnName": "rxBytes",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "txBytes",
|
|
"columnName": "txBytes",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "blockedDns",
|
|
"columnName": "blockedDns",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "allowedDns",
|
|
"columnName": "allowedDns",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "reconnects",
|
|
"columnName": "reconnects",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "latencyMs",
|
|
"columnName": "latencyMs",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "destinationCountries",
|
|
"columnName": "destinationCountries",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "blockedDnsDomains",
|
|
"columnName": "blockedDnsDomains",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "blockedDnsByCategory",
|
|
"columnName": "blockedDnsByCategory",
|
|
"affinity": "TEXT",
|
|
"notNull": true,
|
|
"defaultValue": "'{}'"
|
|
},
|
|
{
|
|
"fieldPath": "blockedDnsApps",
|
|
"columnName": "blockedDnsApps",
|
|
"affinity": "TEXT",
|
|
"notNull": true,
|
|
"defaultValue": "'{}'"
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
},
|
|
"indices": [
|
|
{
|
|
"name": "index_traffic_windows_startedAtMs",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"startedAtMs"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_traffic_windows_startedAtMs` ON `${TABLE_NAME}` (`startedAtMs`)"
|
|
},
|
|
{
|
|
"name": "index_traffic_windows_profileId_protocol_networkType_hourBucket",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"profileId",
|
|
"protocol",
|
|
"networkType",
|
|
"hourBucket"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_traffic_windows_profileId_protocol_networkType_hourBucket` ON `${TABLE_NAME}` (`profileId`, `protocol`, `networkType`, `hourBucket`)"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tableName": "app_traffic_windows",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `packageName` TEXT NOT NULL, `uid` INTEGER NOT NULL, `startedAtMs` INTEGER NOT NULL, `durationSec` INTEGER NOT NULL, `rxBytes` INTEGER NOT NULL, `txBytes` INTEGER NOT NULL, `foreground` INTEGER, `networkType` TEXT NOT NULL, `hourBucket` INTEGER NOT NULL)",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "packageName",
|
|
"columnName": "packageName",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "uid",
|
|
"columnName": "uid",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "startedAtMs",
|
|
"columnName": "startedAtMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "durationSec",
|
|
"columnName": "durationSec",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "rxBytes",
|
|
"columnName": "rxBytes",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "txBytes",
|
|
"columnName": "txBytes",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "foreground",
|
|
"columnName": "foreground",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "networkType",
|
|
"columnName": "networkType",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "hourBucket",
|
|
"columnName": "hourBucket",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
},
|
|
"indices": [
|
|
{
|
|
"name": "index_app_traffic_windows_startedAtMs",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"startedAtMs"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_app_traffic_windows_startedAtMs` ON `${TABLE_NAME}` (`startedAtMs`)"
|
|
},
|
|
{
|
|
"name": "index_app_traffic_windows_packageName",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"packageName"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_app_traffic_windows_packageName` ON `${TABLE_NAME}` (`packageName`)"
|
|
},
|
|
{
|
|
"name": "index_app_traffic_windows_packageName_networkType_hourBucket",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"packageName",
|
|
"networkType",
|
|
"hourBucket"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_app_traffic_windows_packageName_networkType_hourBucket` ON `${TABLE_NAME}` (`packageName`, `networkType`, `hourBucket`)"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tableName": "traffic_baselines",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`baselineKey` TEXT NOT NULL, `profileId` TEXT, `protocol` TEXT, `networkType` TEXT NOT NULL, `hourBucket` INTEGER NOT NULL, `metric` TEXT NOT NULL, `median` REAL NOT NULL, `mad` REAL NOT NULL, `ewma` REAL NOT NULL, `ewmad` REAL NOT NULL, `sampleCount` INTEGER NOT NULL, `lastUpdatedAt` INTEGER NOT NULL, PRIMARY KEY(`baselineKey`))",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "baselineKey",
|
|
"columnName": "baselineKey",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "profileId",
|
|
"columnName": "profileId",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "protocol",
|
|
"columnName": "protocol",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "networkType",
|
|
"columnName": "networkType",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "hourBucket",
|
|
"columnName": "hourBucket",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "metric",
|
|
"columnName": "metric",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "median",
|
|
"columnName": "median",
|
|
"affinity": "REAL",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "mad",
|
|
"columnName": "mad",
|
|
"affinity": "REAL",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "ewma",
|
|
"columnName": "ewma",
|
|
"affinity": "REAL",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "ewmad",
|
|
"columnName": "ewmad",
|
|
"affinity": "REAL",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "sampleCount",
|
|
"columnName": "sampleCount",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "lastUpdatedAt",
|
|
"columnName": "lastUpdatedAt",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": false,
|
|
"columnNames": [
|
|
"baselineKey"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"tableName": "app_baselines",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`baselineKey` TEXT NOT NULL, `packageName` TEXT NOT NULL, `profileId` TEXT, `protocol` TEXT, `networkType` TEXT NOT NULL, `hourBucket` INTEGER NOT NULL, `metric` TEXT NOT NULL, `median` REAL NOT NULL, `mad` REAL NOT NULL, `ewma` REAL NOT NULL, `ewmad` REAL NOT NULL, `sampleCount` INTEGER NOT NULL, `lastUpdatedAt` INTEGER NOT NULL, PRIMARY KEY(`baselineKey`))",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "baselineKey",
|
|
"columnName": "baselineKey",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "packageName",
|
|
"columnName": "packageName",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "profileId",
|
|
"columnName": "profileId",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "protocol",
|
|
"columnName": "protocol",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "networkType",
|
|
"columnName": "networkType",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "hourBucket",
|
|
"columnName": "hourBucket",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "metric",
|
|
"columnName": "metric",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "median",
|
|
"columnName": "median",
|
|
"affinity": "REAL",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "mad",
|
|
"columnName": "mad",
|
|
"affinity": "REAL",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "ewma",
|
|
"columnName": "ewma",
|
|
"affinity": "REAL",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "ewmad",
|
|
"columnName": "ewmad",
|
|
"affinity": "REAL",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "sampleCount",
|
|
"columnName": "sampleCount",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "lastUpdatedAt",
|
|
"columnName": "lastUpdatedAt",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": false,
|
|
"columnNames": [
|
|
"baselineKey"
|
|
]
|
|
},
|
|
"indices": [
|
|
{
|
|
"name": "index_app_baselines_packageName",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"packageName"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_app_baselines_packageName` ON `${TABLE_NAME}` (`packageName`)"
|
|
},
|
|
{
|
|
"name": "index_app_baselines_packageName_networkType_hourBucket",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"packageName",
|
|
"networkType",
|
|
"hourBucket"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_app_baselines_packageName_networkType_hourBucket` ON `${TABLE_NAME}` (`packageName`, `networkType`, `hourBucket`)"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tableName": "anomaly_events",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `createdAtMs` INTEGER NOT NULL, `type` TEXT NOT NULL, `severity` TEXT NOT NULL, `score` INTEGER NOT NULL, `reason` TEXT NOT NULL, `evidence` TEXT NOT NULL, `packageName` TEXT, `profileId` TEXT, `protocol` TEXT, `notificationShown` INTEGER NOT NULL)",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "createdAtMs",
|
|
"columnName": "createdAtMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "type",
|
|
"columnName": "type",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "severity",
|
|
"columnName": "severity",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "score",
|
|
"columnName": "score",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "reason",
|
|
"columnName": "reason",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "evidence",
|
|
"columnName": "evidence",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "packageName",
|
|
"columnName": "packageName",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "profileId",
|
|
"columnName": "profileId",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "protocol",
|
|
"columnName": "protocol",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "notificationShown",
|
|
"columnName": "notificationShown",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
},
|
|
"indices": [
|
|
{
|
|
"name": "index_anomaly_events_createdAtMs",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"createdAtMs"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_anomaly_events_createdAtMs` ON `${TABLE_NAME}` (`createdAtMs`)"
|
|
},
|
|
{
|
|
"name": "index_anomaly_events_packageName",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"packageName"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_anomaly_events_packageName` ON `${TABLE_NAME}` (`packageName`)"
|
|
},
|
|
{
|
|
"name": "index_anomaly_events_type_packageName_createdAtMs",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"type",
|
|
"packageName",
|
|
"createdAtMs"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_anomaly_events_type_packageName_createdAtMs` ON `${TABLE_NAME}` (`type`, `packageName`, `createdAtMs`)"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tableName": "protocol_metric_events",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestampMs` INTEGER NOT NULL, `profileId` INTEGER NOT NULL, `optionId` TEXT, `protocol` TEXT NOT NULL, `event` TEXT NOT NULL, `latencyMs` INTEGER, `reasonCode` TEXT)",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "timestampMs",
|
|
"columnName": "timestampMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "profileId",
|
|
"columnName": "profileId",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "optionId",
|
|
"columnName": "optionId",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "protocol",
|
|
"columnName": "protocol",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "event",
|
|
"columnName": "event",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "latencyMs",
|
|
"columnName": "latencyMs",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "reasonCode",
|
|
"columnName": "reasonCode",
|
|
"affinity": "TEXT"
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
},
|
|
"indices": [
|
|
{
|
|
"name": "index_protocol_metric_events_timestampMs",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"timestampMs"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_protocol_metric_events_timestampMs` ON `${TABLE_NAME}` (`timestampMs`)"
|
|
},
|
|
{
|
|
"name": "index_protocol_metric_events_profileId",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"profileId"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_protocol_metric_events_profileId` ON `${TABLE_NAME}` (`profileId`)"
|
|
},
|
|
{
|
|
"name": "index_protocol_metric_events_protocol_event_timestampMs",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"protocol",
|
|
"event",
|
|
"timestampMs"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_protocol_metric_events_protocol_event_timestampMs` ON `${TABLE_NAME}` (`protocol`, `event`, `timestampMs`)"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tableName": "network_activity_events",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `timestampMs` INTEGER NOT NULL, `packageNames` TEXT NOT NULL, `protocol` TEXT NOT NULL, `remoteHost` TEXT NOT NULL, `remotePort` INTEGER, `countryCode` TEXT, `bytesRx` INTEGER NOT NULL, `bytesTx` INTEGER NOT NULL, `profileId` INTEGER, `sessionId` TEXT)",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "timestampMs",
|
|
"columnName": "timestampMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "packageNames",
|
|
"columnName": "packageNames",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "protocol",
|
|
"columnName": "protocol",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "remoteHost",
|
|
"columnName": "remoteHost",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "remotePort",
|
|
"columnName": "remotePort",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "countryCode",
|
|
"columnName": "countryCode",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "bytesRx",
|
|
"columnName": "bytesRx",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "bytesTx",
|
|
"columnName": "bytesTx",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "profileId",
|
|
"columnName": "profileId",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "sessionId",
|
|
"columnName": "sessionId",
|
|
"affinity": "TEXT"
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
},
|
|
"indices": [
|
|
{
|
|
"name": "index_network_activity_events_timestampMs",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"timestampMs"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_network_activity_events_timestampMs` ON `${TABLE_NAME}` (`timestampMs`)"
|
|
},
|
|
{
|
|
"name": "index_network_activity_events_profileId",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"profileId"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_network_activity_events_profileId` ON `${TABLE_NAME}` (`profileId`)"
|
|
},
|
|
{
|
|
"name": "index_network_activity_events_sessionId",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"sessionId"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_network_activity_events_sessionId` ON `${TABLE_NAME}` (`sessionId`)"
|
|
},
|
|
{
|
|
"name": "index_network_activity_events_remoteHost",
|
|
"unique": false,
|
|
"columnNames": [
|
|
"remoteHost"
|
|
],
|
|
"orders": [],
|
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_network_activity_events_remoteHost` ON `${TABLE_NAME}` (`remoteHost`)"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"tableName": "seen_destination_countries",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`country` TEXT NOT NULL, `firstSeenMs` INTEGER NOT NULL, `lastSeenMs` INTEGER NOT NULL, `totalBytes` INTEGER NOT NULL, PRIMARY KEY(`country`))",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "country",
|
|
"columnName": "country",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "firstSeenMs",
|
|
"columnName": "firstSeenMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "lastSeenMs",
|
|
"columnName": "lastSeenMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "totalBytes",
|
|
"columnName": "totalBytes",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": false,
|
|
"columnNames": [
|
|
"country"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"tableName": "app_network_presence",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`packageName` TEXT NOT NULL, `firstSeenMs` INTEGER NOT NULL, `lastSeenMs` INTEGER NOT NULL, `windowCount` INTEGER NOT NULL, PRIMARY KEY(`packageName`))",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "packageName",
|
|
"columnName": "packageName",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "firstSeenMs",
|
|
"columnName": "firstSeenMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "lastSeenMs",
|
|
"columnName": "lastSeenMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "windowCount",
|
|
"columnName": "windowCount",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": false,
|
|
"columnNames": [
|
|
"packageName"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"tableName": "anomaly_counters",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`counterKey` TEXT NOT NULL, `value` INTEGER NOT NULL, PRIMARY KEY(`counterKey`))",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "counterKey",
|
|
"columnName": "counterKey",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "value",
|
|
"columnName": "value",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": false,
|
|
"columnNames": [
|
|
"counterKey"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"tableName": "i2p_traffic_buckets",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`hourStartMs` INTEGER NOT NULL, `ownBytes` INTEGER NOT NULL, `transitBytes` INTEGER NOT NULL, PRIMARY KEY(`hourStartMs`))",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "hourStartMs",
|
|
"columnName": "hourStartMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "ownBytes",
|
|
"columnName": "ownBytes",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "transitBytes",
|
|
"columnName": "transitBytes",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": false,
|
|
"columnNames": [
|
|
"hourStartMs"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"tableName": "i2p_traffic_totals",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `ownBytes` INTEGER NOT NULL, `transitBytes` INTEGER NOT NULL, PRIMARY KEY(`id`))",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "ownBytes",
|
|
"columnName": "ownBytes",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "transitBytes",
|
|
"columnName": "transitBytes",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": false,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"tableName": "web_apps",
|
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `url` TEXT NOT NULL, `name` TEXT NOT NULL, `iconPath` TEXT, `sortOrder` INTEGER NOT NULL, `route` TEXT NOT NULL, `badgeCount` INTEGER NOT NULL, `lastPolledAtMs` INTEGER, `createdAtMs` INTEGER NOT NULL)",
|
|
"fields": [
|
|
{
|
|
"fieldPath": "id",
|
|
"columnName": "id",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "url",
|
|
"columnName": "url",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "name",
|
|
"columnName": "name",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "iconPath",
|
|
"columnName": "iconPath",
|
|
"affinity": "TEXT"
|
|
},
|
|
{
|
|
"fieldPath": "sortOrder",
|
|
"columnName": "sortOrder",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "route",
|
|
"columnName": "route",
|
|
"affinity": "TEXT",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "badgeCount",
|
|
"columnName": "badgeCount",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
},
|
|
{
|
|
"fieldPath": "lastPolledAtMs",
|
|
"columnName": "lastPolledAtMs",
|
|
"affinity": "INTEGER"
|
|
},
|
|
{
|
|
"fieldPath": "createdAtMs",
|
|
"columnName": "createdAtMs",
|
|
"affinity": "INTEGER",
|
|
"notNull": true
|
|
}
|
|
],
|
|
"primaryKey": {
|
|
"autoGenerate": true,
|
|
"columnNames": [
|
|
"id"
|
|
]
|
|
}
|
|
}
|
|
],
|
|
"setupQueries": [
|
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '9a9accb62f281e314b538ae74926ea7d')"
|
|
]
|
|
}
|
|
} |