Implement MAC lookup (#68)

* Implement MAC lookup

* Refine error processing

* Use long to store MAC consistently

* Link back to macvendors.co

* Undo some havoc

* Do not show mac spans for TV

* Show MAC and IP in a consistent order

* Add IP spans by ipinfo.io

* Add SpanFormatter

* Fix IPv6 ipinfo.io link

* Refine SpanFormatter

* Fix pressing the link
This commit is contained in:
Mygod
2019-01-26 21:20:40 +08:00
committed by GitHub
parent 94114f7a4b
commit d4208affbb
38 changed files with 562 additions and 112 deletions

View File

@@ -0,0 +1,152 @@
{
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "92a6c0406ed7265dbd98eb3c24095651",
"entities": [
{
"tableName": "ClientRecord",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`mac` INTEGER NOT NULL, `nickname` BLOB NOT NULL, `blocked` INTEGER NOT NULL, `macLookupPending` INTEGER NOT NULL, PRIMARY KEY(`mac`))",
"fields": [
{
"fieldPath": "mac",
"columnName": "mac",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "nickname",
"columnName": "nickname",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "blocked",
"columnName": "blocked",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "macLookupPending",
"columnName": "macLookupPending",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"mac"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "TrafficRecord",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `timestamp` INTEGER NOT NULL, `mac` INTEGER NOT NULL, `ip` BLOB NOT NULL, `upstream` TEXT, `downstream` TEXT NOT NULL, `sentPackets` INTEGER NOT NULL, `sentBytes` INTEGER NOT NULL, `receivedPackets` INTEGER NOT NULL, `receivedBytes` INTEGER NOT NULL, `previousId` INTEGER, FOREIGN KEY(`previousId`) REFERENCES `TrafficRecord`(`id`) ON UPDATE RESTRICT ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "timestamp",
"columnName": "timestamp",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "mac",
"columnName": "mac",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "ip",
"columnName": "ip",
"affinity": "BLOB",
"notNull": true
},
{
"fieldPath": "upstream",
"columnName": "upstream",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "downstream",
"columnName": "downstream",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "sentPackets",
"columnName": "sentPackets",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sentBytes",
"columnName": "sentBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "receivedPackets",
"columnName": "receivedPackets",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "receivedBytes",
"columnName": "receivedBytes",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "previousId",
"columnName": "previousId",
"affinity": "INTEGER",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_TrafficRecord_previousId",
"unique": true,
"columnNames": [
"previousId"
],
"createSql": "CREATE UNIQUE INDEX `index_TrafficRecord_previousId` ON `${TABLE_NAME}` (`previousId`)"
}
],
"foreignKeys": [
{
"table": "TrafficRecord",
"onDelete": "CASCADE",
"onUpdate": "RESTRICT",
"columns": [
"previousId"
],
"referencedColumns": [
"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, \"92a6c0406ed7265dbd98eb3c24095651\")"
]
}
}