trifid-api 0.3.0-alpha1 and some work on a tfweb rewrite #6

Merged
core merged 12 commits from api-and-web-rewrite into master 2023-12-28 05:44:29 +00:00
12 changed files with 60 additions and 2 deletions
Showing only changes of commit bda0ac2a52 - Show all commits

2
Cargo.lock generated
View File

@ -3075,7 +3075,7 @@ dependencies = [
[[package]]
name = "trifid-api"
version = "0.3.0"
version = "0.3.0-alpha1"
dependencies = [
"actix-cors",
"actix-web",

View File

@ -1,6 +1,6 @@
[package]
name = "trifid-api"
version = "0.3.0"
version = "0.3.0-alpha1"
authors = ["core <core@e3t.cc>"]
edition = "2021"
description = "An open-source reimplementation of the Defined Networking API server"

View File

@ -0,0 +1 @@
DROP TABLE roles;

View File

@ -0,0 +1,6 @@
CREATE TABLE roles (
id VARCHAR NOT NULL PRIMARY KEY,
name VARCHAR NOT NULL,
description VARCHAR NOT NULL,
organizationId VARCHAR NOT NULL REFERENCES organizations(id)
);

View File

@ -0,0 +1 @@
DROP TABLE role_firewall_rules;

View File

@ -0,0 +1,9 @@
CREATE TABLE role_firewall_rules (
id VARCHAR NOT NULL UNIQUE,
roleId VARCHAR NOT NULL REFERENCES roles(id),
protocol VARCHAR NOT NULL,
description VARCHAR NOT NULL,
allowedRoleId VARCHAR NULL,
allowedTags VARCHAR[],
portRange int4range NULL
);

View File

@ -0,0 +1 @@
DROP TABLE hosts;

View File

@ -0,0 +1,21 @@
CREATE TABLE hosts (
id VARCHAR NOT NULL PRIMARY KEY,
organizationId VARCHAR NOT NULL REFERENCES organizations(id),
networkId VARCHAR NOT NULL REFERENCES networks(id),
roleId VARCHAR NULL REFERENCES roles(id),
name VARCHAR NOT NULL,
ipAddress VARCHAR NOT NULL,
staticAddresses VARCHAR[] NOT NULL,
listenPort int2 NOT NULL,
isLighthouse BOOLEAN NOT NULL,
isRelay BOOLEAN NOT NULL,
createdAt TIMESTAMP NOT NULL,
isBlocked BOOLEAN NOT NULL,
lastSeenAt TIMESTAMP NULL,
clientVersion VARCHAR NULL,
platform VARCHAR NULL,
updateAvailable BOOLEAN NULL,
tags VARCHAR[] NOT NULL
);

View File

@ -0,0 +1 @@
DROP TABLE host_overrides;

View File

@ -0,0 +1,6 @@
CREATE TABLE host_overrides (
id VARCHAR NOT NULL PRIMARY KEY,
hostId VARCHAR NOT NULL REFERENCES hosts(id),
key VARCHAR NOT NULL,
value jsonb NOT NULL
);

View File

@ -0,0 +1 @@
-- This file should undo anything in `up.sql`

View File

@ -0,0 +1,11 @@
CREATE TABLE host_keys (
id VARCHAR NOT NULL PRIMARY KEY,
hostId VARCHAR NOT NULL REFERENCES hosts(id),
counter INT NOT NULL,
client_ed_pub bytea NOT NULL,
client_dh_pub bytea NOT NULL,
client_cert bytea NOT NULL,
UNIQUE (hostId, counter)
);