diff options
31 files changed, 240 insertions, 1417 deletions
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 7196d4e..663f437 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml | |||
@@ -5,7 +5,6 @@ on: [ pull_request, workflow_dispatch ] | |||
5 | env: | 5 | env: |
6 | SCCACHE_GHA_ENABLED: "true" | 6 | SCCACHE_GHA_ENABLED: "true" |
7 | RUSTC_WRAPPER: "sccache" | 7 | RUSTC_WRAPPER: "sccache" |
8 | SQLX_OFFLINE: "true" | ||
9 | CARGO_TERM_COLOR: always | 8 | CARGO_TERM_COLOR: always |
10 | 9 | ||
11 | jobs: | 10 | jobs: |
diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d41941b..30edefa 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml | |||
@@ -1,15 +1,11 @@ | |||
1 | name: build and push | 1 | name: container |
2 | 2 | ||
3 | on: | 3 | on: |
4 | push: | 4 | push: |
5 | branches: [ "main" ] | 5 | branches: |
6 | workflow_dispatch: | 6 | - "main" |
7 | 7 | tags: | |
8 | env: | 8 | - "v*.*.*" |
9 | SCCACHE_GHA_ENABLED: "true" | ||
10 | RUSTC_WRAPPER: "sccache" | ||
11 | SQLX_OFFLINE: "true" | ||
12 | CARGO_TERM_COLOR: always | ||
13 | 9 | ||
14 | jobs: | 10 | jobs: |
15 | test: | 11 | test: |
@@ -23,28 +19,42 @@ jobs: | |||
23 | - run: cargo check --release | 19 | - run: cargo check --release |
24 | - run: cargo clippy --release | 20 | - run: cargo clippy --release |
25 | 21 | ||
26 | build: | 22 | docker: |
27 | runs-on: ubuntu-latest | 23 | runs-on: ubuntu-latest |
28 | needs: test | ||
29 | steps: | 24 | steps: |
25 | - name: Checkout | ||
26 | uses: actions/checkout@v4 | ||
27 | - name: Docker meta | ||
28 | id: meta | ||
29 | uses: docker/metadata-action@v5 | ||
30 | with: | ||
31 | # list of Docker images to use as base name for tags | ||
32 | images: ghcr.io/fxqnlr/webol | ||
33 | # generate Docker tags based on the following events/attributes | ||
34 | tags: | | ||
35 | type=schedule | ||
36 | type=ref,event=branch | ||
37 | type=ref,event=pr | ||
38 | type=semver,pattern={{version}} | ||
39 | type=semver,pattern={{major}}.{{minor}} | ||
40 | type=semver,pattern={{major}} | ||
41 | type=sha | ||
30 | - name: Set up QEMU | 42 | - name: Set up QEMU |
31 | uses: docker/setup-qemu-action@v3 | 43 | uses: docker/setup-qemu-action@v3 |
32 | - name: Set up Docker Buildx | 44 | - name: Set up Docker Buildx |
33 | uses: docker/setup-buildx-action@v2 | 45 | uses: docker/setup-buildx-action@v3 |
34 | - name: Login to DockerHub | 46 | - name: Login to GHCR |
35 | uses: docker/login-action@v2 | 47 | if: github.event_name != 'pull_request' |
48 | uses: docker/login-action@v3 | ||
36 | with: | 49 | with: |
37 | registry: ghcr.io | 50 | registry: ghcr.io |
38 | username: ${{ github.actor }} | 51 | username: ${{ github.repository_owner }} |
39 | password: ${{ secrets.GITHUB_TOKEN }} | 52 | password: ${{ secrets.GITHUB_TOKEN }} |
40 | - name: Build and push | 53 | - name: Build and push |
41 | id: docker_build | 54 | uses: docker/build-push-action@v5 |
42 | uses: docker/build-push-action@v3 | ||
43 | with: | 55 | with: |
44 | push: true | 56 | context: . |
45 | platforms: linux/amd64,linux/arm64 | 57 | platforms: linux/amd64,linux/arm64 |
46 | cache-from: type=gha | 58 | push: ${{ github.event_name != 'pull_request' }} |
47 | cache-to: type=gha,mode=max | 59 | tags: ${{ steps.meta.outputs.tags }} |
48 | tags: | | 60 | labels: ${{ steps.meta.outputs.labels }} |
49 | ghcr.io/fxqnlr/webol:dev-latest | ||
50 | ghcr.io/fxqnlr/webol:dev-${{ github.run_number }} | ||
@@ -17,4 +17,5 @@ config.* | |||
17 | .lapce | 17 | .lapce |
18 | 18 | ||
19 | logs/ | 19 | logs/ |
20 | devices/ | ||
20 | *.log | 21 | *.log |
diff --git a/.sqlx/query-1dc5f44967ffdee882f4cef32262fd643b452aacca373ee527c978e816115de6.json b/.sqlx/query-1dc5f44967ffdee882f4cef32262fd643b452aacca373ee527c978e816115de6.json deleted file mode 100644 index dd85eaa..0000000 --- a/.sqlx/query-1dc5f44967ffdee882f4cef32262fd643b452aacca373ee527c978e816115de6.json +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n UPDATE devices\n SET mac = $1, broadcast_addr = $2, ip = $3 WHERE id = $4\n RETURNING id, mac, broadcast_addr, ip, times;\n ", | ||
4 | "describe": { | ||
5 | "columns": [ | ||
6 | { | ||
7 | "ordinal": 0, | ||
8 | "name": "id", | ||
9 | "type_info": "Varchar" | ||
10 | }, | ||
11 | { | ||
12 | "ordinal": 1, | ||
13 | "name": "mac", | ||
14 | "type_info": "Macaddr" | ||
15 | }, | ||
16 | { | ||
17 | "ordinal": 2, | ||
18 | "name": "broadcast_addr", | ||
19 | "type_info": "Varchar" | ||
20 | }, | ||
21 | { | ||
22 | "ordinal": 3, | ||
23 | "name": "ip", | ||
24 | "type_info": "Inet" | ||
25 | }, | ||
26 | { | ||
27 | "ordinal": 4, | ||
28 | "name": "times", | ||
29 | "type_info": "Int8Array" | ||
30 | } | ||
31 | ], | ||
32 | "parameters": { | ||
33 | "Left": [ | ||
34 | "Macaddr", | ||
35 | "Varchar", | ||
36 | "Inet", | ||
37 | "Text" | ||
38 | ] | ||
39 | }, | ||
40 | "nullable": [ | ||
41 | false, | ||
42 | false, | ||
43 | false, | ||
44 | false, | ||
45 | true | ||
46 | ] | ||
47 | }, | ||
48 | "hash": "1dc5f44967ffdee882f4cef32262fd643b452aacca373ee527c978e816115de6" | ||
49 | } | ||
diff --git a/.sqlx/query-25ab5caa92ff80ef3f85ddce1174021ce0fb896a818a6deee291a1eb85ae2a8a.json b/.sqlx/query-25ab5caa92ff80ef3f85ddce1174021ce0fb896a818a6deee291a1eb85ae2a8a.json deleted file mode 100644 index 71438e3..0000000 --- a/.sqlx/query-25ab5caa92ff80ef3f85ddce1174021ce0fb896a818a6deee291a1eb85ae2a8a.json +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n UPDATE devices\n SET times = array_append(times, $1)\n WHERE id = $2;\n ", | ||
4 | "describe": { | ||
5 | "columns": [], | ||
6 | "parameters": { | ||
7 | "Left": [ | ||
8 | "Int8", | ||
9 | "Text" | ||
10 | ] | ||
11 | }, | ||
12 | "nullable": [] | ||
13 | }, | ||
14 | "hash": "25ab5caa92ff80ef3f85ddce1174021ce0fb896a818a6deee291a1eb85ae2a8a" | ||
15 | } | ||
diff --git a/.sqlx/query-566c84386614590144dfebce2248cb3a734074014a493a7aad6fa03bb1286dc8.json b/.sqlx/query-566c84386614590144dfebce2248cb3a734074014a493a7aad6fa03bb1286dc8.json deleted file mode 100644 index 735c3bb..0000000 --- a/.sqlx/query-566c84386614590144dfebce2248cb3a734074014a493a7aad6fa03bb1286dc8.json +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n INSERT INTO devices (id, mac, broadcast_addr, ip)\n VALUES ($1, $2, $3, $4)\n RETURNING id, mac, broadcast_addr, ip, times;\n ", | ||
4 | "describe": { | ||
5 | "columns": [ | ||
6 | { | ||
7 | "ordinal": 0, | ||
8 | "name": "id", | ||
9 | "type_info": "Varchar" | ||
10 | }, | ||
11 | { | ||
12 | "ordinal": 1, | ||
13 | "name": "mac", | ||
14 | "type_info": "Macaddr" | ||
15 | }, | ||
16 | { | ||
17 | "ordinal": 2, | ||
18 | "name": "broadcast_addr", | ||
19 | "type_info": "Varchar" | ||
20 | }, | ||
21 | { | ||
22 | "ordinal": 3, | ||
23 | "name": "ip", | ||
24 | "type_info": "Inet" | ||
25 | }, | ||
26 | { | ||
27 | "ordinal": 4, | ||
28 | "name": "times", | ||
29 | "type_info": "Int8Array" | ||
30 | } | ||
31 | ], | ||
32 | "parameters": { | ||
33 | "Left": [ | ||
34 | "Varchar", | ||
35 | "Macaddr", | ||
36 | "Varchar", | ||
37 | "Inet" | ||
38 | ] | ||
39 | }, | ||
40 | "nullable": [ | ||
41 | false, | ||
42 | false, | ||
43 | false, | ||
44 | false, | ||
45 | true | ||
46 | ] | ||
47 | }, | ||
48 | "hash": "566c84386614590144dfebce2248cb3a734074014a493a7aad6fa03bb1286dc8" | ||
49 | } | ||
diff --git a/.sqlx/query-5ac2b9a76338dd1342938cc09e37b14c828c4ee44b696d83f87f739022be6948.json b/.sqlx/query-5ac2b9a76338dd1342938cc09e37b14c828c4ee44b696d83f87f739022be6948.json deleted file mode 100644 index c385101..0000000 --- a/.sqlx/query-5ac2b9a76338dd1342938cc09e37b14c828c4ee44b696d83f87f739022be6948.json +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "SELECT times FROM devices;", | ||
4 | "describe": { | ||
5 | "columns": [ | ||
6 | { | ||
7 | "ordinal": 0, | ||
8 | "name": "times", | ||
9 | "type_info": "Int8Array" | ||
10 | } | ||
11 | ], | ||
12 | "parameters": { | ||
13 | "Left": [] | ||
14 | }, | ||
15 | "nullable": [ | ||
16 | true | ||
17 | ] | ||
18 | }, | ||
19 | "hash": "5ac2b9a76338dd1342938cc09e37b14c828c4ee44b696d83f87f739022be6948" | ||
20 | } | ||
diff --git a/.sqlx/query-62c84231c7e9c85dc91d71f6b4f7ee6dae2130c2109fb6f1e47e0990ec395744.json b/.sqlx/query-62c84231c7e9c85dc91d71f6b4f7ee6dae2130c2109fb6f1e47e0990ec395744.json deleted file mode 100644 index 905bb51..0000000 --- a/.sqlx/query-62c84231c7e9c85dc91d71f6b4f7ee6dae2130c2109fb6f1e47e0990ec395744.json +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n SELECT id, mac, broadcast_addr, ip, times\n FROM devices\n WHERE id = $1;\n ", | ||
4 | "describe": { | ||
5 | "columns": [ | ||
6 | { | ||
7 | "ordinal": 0, | ||
8 | "name": "id", | ||
9 | "type_info": "Varchar" | ||
10 | }, | ||
11 | { | ||
12 | "ordinal": 1, | ||
13 | "name": "mac", | ||
14 | "type_info": "Macaddr" | ||
15 | }, | ||
16 | { | ||
17 | "ordinal": 2, | ||
18 | "name": "broadcast_addr", | ||
19 | "type_info": "Varchar" | ||
20 | }, | ||
21 | { | ||
22 | "ordinal": 3, | ||
23 | "name": "ip", | ||
24 | "type_info": "Inet" | ||
25 | }, | ||
26 | { | ||
27 | "ordinal": 4, | ||
28 | "name": "times", | ||
29 | "type_info": "Int8Array" | ||
30 | } | ||
31 | ], | ||
32 | "parameters": { | ||
33 | "Left": [ | ||
34 | "Text" | ||
35 | ] | ||
36 | }, | ||
37 | "nullable": [ | ||
38 | false, | ||
39 | false, | ||
40 | false, | ||
41 | false, | ||
42 | true | ||
43 | ] | ||
44 | }, | ||
45 | "hash": "62c84231c7e9c85dc91d71f6b4f7ee6dae2130c2109fb6f1e47e0990ec395744" | ||
46 | } | ||
diff --git a/.sqlx/query-a1114f47abaa2ace231ef61cbd787a2f2a30efc581ea075b7e86ae75458c9014.json b/.sqlx/query-a1114f47abaa2ace231ef61cbd787a2f2a30efc581ea075b7e86ae75458c9014.json deleted file mode 100644 index 53608ed..0000000 --- a/.sqlx/query-a1114f47abaa2ace231ef61cbd787a2f2a30efc581ea075b7e86ae75458c9014.json +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n SELECT id, mac, broadcast_addr, ip, times\n FROM devices\n WHERE id = $1;\n ", | ||
4 | "describe": { | ||
5 | "columns": [ | ||
6 | { | ||
7 | "ordinal": 0, | ||
8 | "name": "id", | ||
9 | "type_info": "Varchar" | ||
10 | }, | ||
11 | { | ||
12 | "ordinal": 1, | ||
13 | "name": "mac", | ||
14 | "type_info": "Macaddr" | ||
15 | }, | ||
16 | { | ||
17 | "ordinal": 2, | ||
18 | "name": "broadcast_addr", | ||
19 | "type_info": "Varchar" | ||
20 | }, | ||
21 | { | ||
22 | "ordinal": 3, | ||
23 | "name": "ip", | ||
24 | "type_info": "Inet" | ||
25 | }, | ||
26 | { | ||
27 | "ordinal": 4, | ||
28 | "name": "times", | ||
29 | "type_info": "Int8Array" | ||
30 | } | ||
31 | ], | ||
32 | "parameters": { | ||
33 | "Left": [ | ||
34 | "Text" | ||
35 | ] | ||
36 | }, | ||
37 | "nullable": [ | ||
38 | false, | ||
39 | false, | ||
40 | false, | ||
41 | false, | ||
42 | true | ||
43 | ] | ||
44 | }, | ||
45 | "hash": "a1114f47abaa2ace231ef61cbd787a2f2a30efc581ea075b7e86ae75458c9014" | ||
46 | } | ||
diff --git a/.sqlx/query-adead45e1a6b02d5eabd68b8cf06394a302d288e91f5eedde65db6630021f737.json b/.sqlx/query-adead45e1a6b02d5eabd68b8cf06394a302d288e91f5eedde65db6630021f737.json deleted file mode 100644 index d25b12e..0000000 --- a/.sqlx/query-adead45e1a6b02d5eabd68b8cf06394a302d288e91f5eedde65db6630021f737.json +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n INSERT INTO devices (id, mac, broadcast_addr, ip)\n VALUES ($1, $2, $3, $4);\n ", | ||
4 | "describe": { | ||
5 | "columns": [], | ||
6 | "parameters": { | ||
7 | "Left": [ | ||
8 | "Varchar", | ||
9 | "Macaddr", | ||
10 | "Varchar", | ||
11 | "Inet" | ||
12 | ] | ||
13 | }, | ||
14 | "nullable": [] | ||
15 | }, | ||
16 | "hash": "adead45e1a6b02d5eabd68b8cf06394a302d288e91f5eedde65db6630021f737" | ||
17 | } | ||
diff --git a/.sqlx/query-df462bb016e2d258de146e248493f4458a532eee554d57438ef7849758238185.json b/.sqlx/query-df462bb016e2d258de146e248493f4458a532eee554d57438ef7849758238185.json deleted file mode 100644 index e448b24..0000000 --- a/.sqlx/query-df462bb016e2d258de146e248493f4458a532eee554d57438ef7849758238185.json +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n UPDATE devices\n SET times = array_append(times, $1)\n WHERE id = $2;\n ", | ||
4 | "describe": { | ||
5 | "columns": [], | ||
6 | "parameters": { | ||
7 | "Left": [ | ||
8 | "Int8", | ||
9 | "Text" | ||
10 | ] | ||
11 | }, | ||
12 | "nullable": [] | ||
13 | }, | ||
14 | "hash": "df462bb016e2d258de146e248493f4458a532eee554d57438ef7849758238185" | ||
15 | } | ||
diff --git a/.sqlx/query-e452c5ed8bdaec2011d78386cffd2b4739d88b3061931562e07c3e8dd24e6359.json b/.sqlx/query-e452c5ed8bdaec2011d78386cffd2b4739d88b3061931562e07c3e8dd24e6359.json deleted file mode 100644 index 75ec121..0000000 --- a/.sqlx/query-e452c5ed8bdaec2011d78386cffd2b4739d88b3061931562e07c3e8dd24e6359.json +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n UPDATE devices\n SET mac = $1, broadcast_addr = $2, ip = $3 WHERE id = $4\n RETURNING id, mac, broadcast_addr, ip, times;\n ", | ||
4 | "describe": { | ||
5 | "columns": [ | ||
6 | { | ||
7 | "ordinal": 0, | ||
8 | "name": "id", | ||
9 | "type_info": "Varchar" | ||
10 | }, | ||
11 | { | ||
12 | "ordinal": 1, | ||
13 | "name": "mac", | ||
14 | "type_info": "Macaddr" | ||
15 | }, | ||
16 | { | ||
17 | "ordinal": 2, | ||
18 | "name": "broadcast_addr", | ||
19 | "type_info": "Varchar" | ||
20 | }, | ||
21 | { | ||
22 | "ordinal": 3, | ||
23 | "name": "ip", | ||
24 | "type_info": "Inet" | ||
25 | }, | ||
26 | { | ||
27 | "ordinal": 4, | ||
28 | "name": "times", | ||
29 | "type_info": "Int8Array" | ||
30 | } | ||
31 | ], | ||
32 | "parameters": { | ||
33 | "Left": [ | ||
34 | "Macaddr", | ||
35 | "Varchar", | ||
36 | "Inet", | ||
37 | "Text" | ||
38 | ] | ||
39 | }, | ||
40 | "nullable": [ | ||
41 | false, | ||
42 | false, | ||
43 | false, | ||
44 | false, | ||
45 | true | ||
46 | ] | ||
47 | }, | ||
48 | "hash": "e452c5ed8bdaec2011d78386cffd2b4739d88b3061931562e07c3e8dd24e6359" | ||
49 | } | ||
diff --git a/.sqlx/query-edc4ecf39512caec1076be1b2849b2530be7bcdcbe14362077b3fd47cd711c89.json b/.sqlx/query-edc4ecf39512caec1076be1b2849b2530be7bcdcbe14362077b3fd47cd711c89.json deleted file mode 100644 index 2b17c9b..0000000 --- a/.sqlx/query-edc4ecf39512caec1076be1b2849b2530be7bcdcbe14362077b3fd47cd711c89.json +++ /dev/null | |||
@@ -1,17 +0,0 @@ | |||
1 | { | ||
2 | "db_name": "PostgreSQL", | ||
3 | "query": "\n INSERT INTO devices (id, mac, broadcast_addr, ip)\n VALUES ($1, $2, $3, $4);\n ", | ||
4 | "describe": { | ||
5 | "columns": [], | ||
6 | "parameters": { | ||
7 | "Left": [ | ||
8 | "Varchar", | ||
9 | "Macaddr", | ||
10 | "Varchar", | ||
11 | "Inet" | ||
12 | ] | ||
13 | }, | ||
14 | "nullable": [] | ||
15 | }, | ||
16 | "hash": "edc4ecf39512caec1076be1b2849b2530be7bcdcbe14362077b3fd47cd711c89" | ||
17 | } | ||
@@ -18,19 +18,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" | 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" |
19 | 19 | ||
20 | [[package]] | 20 | [[package]] |
21 | name = "ahash" | ||
22 | version = "0.8.11" | ||
23 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
24 | checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" | ||
25 | dependencies = [ | ||
26 | "cfg-if", | ||
27 | "getrandom", | ||
28 | "once_cell", | ||
29 | "version_check", | ||
30 | "zerocopy", | ||
31 | ] | ||
32 | |||
33 | [[package]] | ||
34 | name = "aho-corasick" | 21 | name = "aho-corasick" |
35 | version = "1.1.3" | 22 | version = "1.1.3" |
36 | source = "registry+https://github.com/rust-lang/crates.io-index" | 23 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -40,12 +27,6 @@ dependencies = [ | |||
40 | ] | 27 | ] |
41 | 28 | ||
42 | [[package]] | 29 | [[package]] |
43 | name = "allocator-api2" | ||
44 | version = "0.2.16" | ||
45 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
46 | checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" | ||
47 | |||
48 | [[package]] | ||
49 | name = "async-trait" | 30 | name = "async-trait" |
50 | version = "0.1.79" | 31 | version = "0.1.79" |
51 | source = "registry+https://github.com/rust-lang/crates.io-index" | 32 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -57,15 +38,6 @@ dependencies = [ | |||
57 | ] | 38 | ] |
58 | 39 | ||
59 | [[package]] | 40 | [[package]] |
60 | name = "atoi" | ||
61 | version = "2.0.0" | ||
62 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
63 | checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" | ||
64 | dependencies = [ | ||
65 | "num-traits", | ||
66 | ] | ||
67 | |||
68 | [[package]] | ||
69 | name = "autocfg" | 41 | name = "autocfg" |
70 | version = "1.2.0" | 42 | version = "1.2.0" |
71 | source = "registry+https://github.com/rust-lang/crates.io-index" | 43 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -163,12 +135,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
163 | checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" | 135 | checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" |
164 | 136 | ||
165 | [[package]] | 137 | [[package]] |
166 | name = "base64ct" | ||
167 | version = "1.6.0" | ||
168 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
169 | checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" | ||
170 | |||
171 | [[package]] | ||
172 | name = "bitflags" | 138 | name = "bitflags" |
173 | version = "1.3.2" | 139 | version = "1.3.2" |
174 | source = "registry+https://github.com/rust-lang/crates.io-index" | 140 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -264,12 +230,6 @@ dependencies = [ | |||
264 | ] | 230 | ] |
265 | 231 | ||
266 | [[package]] | 232 | [[package]] |
267 | name = "const-oid" | ||
268 | version = "0.9.6" | ||
269 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
270 | checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" | ||
271 | |||
272 | [[package]] | ||
273 | name = "const-random" | 233 | name = "const-random" |
274 | version = "0.1.18" | 234 | version = "0.1.18" |
275 | source = "registry+https://github.com/rust-lang/crates.io-index" | 235 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -308,21 +268,6 @@ dependencies = [ | |||
308 | ] | 268 | ] |
309 | 269 | ||
310 | [[package]] | 270 | [[package]] |
311 | name = "crc" | ||
312 | version = "3.2.1" | ||
313 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
314 | checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" | ||
315 | dependencies = [ | ||
316 | "crc-catalog", | ||
317 | ] | ||
318 | |||
319 | [[package]] | ||
320 | name = "crc-catalog" | ||
321 | version = "2.4.0" | ||
322 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
323 | checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" | ||
324 | |||
325 | [[package]] | ||
326 | name = "crc32fast" | 271 | name = "crc32fast" |
327 | version = "1.4.0" | 272 | version = "1.4.0" |
328 | source = "registry+https://github.com/rust-lang/crates.io-index" | 273 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -341,15 +286,6 @@ dependencies = [ | |||
341 | ] | 286 | ] |
342 | 287 | ||
343 | [[package]] | 288 | [[package]] |
344 | name = "crossbeam-queue" | ||
345 | version = "0.3.11" | ||
346 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
347 | checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" | ||
348 | dependencies = [ | ||
349 | "crossbeam-utils", | ||
350 | ] | ||
351 | |||
352 | [[package]] | ||
353 | name = "crossbeam-utils" | 289 | name = "crossbeam-utils" |
354 | version = "0.8.19" | 290 | version = "0.8.19" |
355 | source = "registry+https://github.com/rust-lang/crates.io-index" | 291 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -391,17 +327,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
391 | checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" | 327 | checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" |
392 | 328 | ||
393 | [[package]] | 329 | [[package]] |
394 | name = "der" | ||
395 | version = "0.7.9" | ||
396 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
397 | checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" | ||
398 | dependencies = [ | ||
399 | "const-oid", | ||
400 | "pem-rfc7468", | ||
401 | "zeroize", | ||
402 | ] | ||
403 | |||
404 | [[package]] | ||
405 | name = "deranged" | 330 | name = "deranged" |
406 | version = "0.3.11" | 331 | version = "0.3.11" |
407 | source = "registry+https://github.com/rust-lang/crates.io-index" | 332 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -417,9 +342,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
417 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" | 342 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" |
418 | dependencies = [ | 343 | dependencies = [ |
419 | "block-buffer", | 344 | "block-buffer", |
420 | "const-oid", | ||
421 | "crypto-common", | 345 | "crypto-common", |
422 | "subtle", | ||
423 | ] | 346 | ] |
424 | 347 | ||
425 | [[package]] | 348 | [[package]] |
@@ -432,54 +355,12 @@ dependencies = [ | |||
432 | ] | 355 | ] |
433 | 356 | ||
434 | [[package]] | 357 | [[package]] |
435 | name = "dotenvy" | ||
436 | version = "0.15.7" | ||
437 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
438 | checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" | ||
439 | |||
440 | [[package]] | ||
441 | name = "either" | ||
442 | version = "1.10.0" | ||
443 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
444 | checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" | ||
445 | dependencies = [ | ||
446 | "serde", | ||
447 | ] | ||
448 | |||
449 | [[package]] | ||
450 | name = "equivalent" | 358 | name = "equivalent" |
451 | version = "1.0.1" | 359 | version = "1.0.1" |
452 | source = "registry+https://github.com/rust-lang/crates.io-index" | 360 | source = "registry+https://github.com/rust-lang/crates.io-index" |
453 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" | 361 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" |
454 | 362 | ||
455 | [[package]] | 363 | [[package]] |
456 | name = "errno" | ||
457 | version = "0.3.8" | ||
458 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
459 | checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" | ||
460 | dependencies = [ | ||
461 | "libc", | ||
462 | "windows-sys 0.52.0", | ||
463 | ] | ||
464 | |||
465 | [[package]] | ||
466 | name = "etcetera" | ||
467 | version = "0.8.0" | ||
468 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
469 | checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" | ||
470 | dependencies = [ | ||
471 | "cfg-if", | ||
472 | "home", | ||
473 | "windows-sys 0.48.0", | ||
474 | ] | ||
475 | |||
476 | [[package]] | ||
477 | name = "event-listener" | ||
478 | version = "2.5.3" | ||
479 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
480 | checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" | ||
481 | |||
482 | [[package]] | ||
483 | name = "eyre" | 364 | name = "eyre" |
484 | version = "0.6.12" | 365 | version = "0.6.12" |
485 | source = "registry+https://github.com/rust-lang/crates.io-index" | 366 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -490,18 +371,6 @@ dependencies = [ | |||
490 | ] | 371 | ] |
491 | 372 | ||
492 | [[package]] | 373 | [[package]] |
493 | name = "fastrand" | ||
494 | version = "2.0.2" | ||
495 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
496 | checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" | ||
497 | |||
498 | [[package]] | ||
499 | name = "finl_unicode" | ||
500 | version = "1.2.0" | ||
501 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
502 | checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" | ||
503 | |||
504 | [[package]] | ||
505 | name = "flate2" | 374 | name = "flate2" |
506 | version = "1.0.28" | 375 | version = "1.0.28" |
507 | source = "registry+https://github.com/rust-lang/crates.io-index" | 376 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -512,17 +381,6 @@ dependencies = [ | |||
512 | ] | 381 | ] |
513 | 382 | ||
514 | [[package]] | 383 | [[package]] |
515 | name = "flume" | ||
516 | version = "0.11.0" | ||
517 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
518 | checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" | ||
519 | dependencies = [ | ||
520 | "futures-core", | ||
521 | "futures-sink", | ||
522 | "spin 0.9.8", | ||
523 | ] | ||
524 | |||
525 | [[package]] | ||
526 | name = "fnv" | 384 | name = "fnv" |
527 | version = "1.0.7" | 385 | version = "1.0.7" |
528 | source = "registry+https://github.com/rust-lang/crates.io-index" | 386 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -544,7 +402,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
544 | checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" | 402 | checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" |
545 | dependencies = [ | 403 | dependencies = [ |
546 | "futures-core", | 404 | "futures-core", |
547 | "futures-sink", | ||
548 | ] | 405 | ] |
549 | 406 | ||
550 | [[package]] | 407 | [[package]] |
@@ -554,34 +411,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
554 | checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" | 411 | checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" |
555 | 412 | ||
556 | [[package]] | 413 | [[package]] |
557 | name = "futures-executor" | ||
558 | version = "0.3.30" | ||
559 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
560 | checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" | ||
561 | dependencies = [ | ||
562 | "futures-core", | ||
563 | "futures-task", | ||
564 | "futures-util", | ||
565 | ] | ||
566 | |||
567 | [[package]] | ||
568 | name = "futures-intrusive" | ||
569 | version = "0.5.0" | ||
570 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
571 | checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" | ||
572 | dependencies = [ | ||
573 | "futures-core", | ||
574 | "lock_api", | ||
575 | "parking_lot", | ||
576 | ] | ||
577 | |||
578 | [[package]] | ||
579 | name = "futures-io" | ||
580 | version = "0.3.30" | ||
581 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
582 | checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" | ||
583 | |||
584 | [[package]] | ||
585 | name = "futures-sink" | 414 | name = "futures-sink" |
586 | version = "0.3.30" | 415 | version = "0.3.30" |
587 | source = "registry+https://github.com/rust-lang/crates.io-index" | 416 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -600,10 +429,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
600 | checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" | 429 | checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" |
601 | dependencies = [ | 430 | dependencies = [ |
602 | "futures-core", | 431 | "futures-core", |
603 | "futures-io", | ||
604 | "futures-sink", | 432 | "futures-sink", |
605 | "futures-task", | 433 | "futures-task", |
606 | "memchr", | ||
607 | "pin-project-lite", | 434 | "pin-project-lite", |
608 | "pin-utils", | 435 | "pin-utils", |
609 | "slab", | 436 | "slab", |
@@ -653,28 +480,12 @@ name = "hashbrown" | |||
653 | version = "0.14.3" | 480 | version = "0.14.3" |
654 | source = "registry+https://github.com/rust-lang/crates.io-index" | 481 | source = "registry+https://github.com/rust-lang/crates.io-index" |
655 | checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" | 482 | checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" |
656 | dependencies = [ | ||
657 | "ahash", | ||
658 | "allocator-api2", | ||
659 | ] | ||
660 | |||
661 | [[package]] | ||
662 | name = "hashlink" | ||
663 | version = "0.8.4" | ||
664 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
665 | checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" | ||
666 | dependencies = [ | ||
667 | "hashbrown 0.14.3", | ||
668 | ] | ||
669 | 483 | ||
670 | [[package]] | 484 | [[package]] |
671 | name = "heck" | 485 | name = "heck" |
672 | version = "0.4.1" | 486 | version = "0.4.1" |
673 | source = "registry+https://github.com/rust-lang/crates.io-index" | 487 | source = "registry+https://github.com/rust-lang/crates.io-index" |
674 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" | 488 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" |
675 | dependencies = [ | ||
676 | "unicode-segmentation", | ||
677 | ] | ||
678 | 489 | ||
679 | [[package]] | 490 | [[package]] |
680 | name = "hermit-abi" | 491 | name = "hermit-abi" |
@@ -689,33 +500,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
689 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" | 500 | checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" |
690 | 501 | ||
691 | [[package]] | 502 | [[package]] |
692 | name = "hkdf" | ||
693 | version = "0.12.4" | ||
694 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
695 | checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" | ||
696 | dependencies = [ | ||
697 | "hmac", | ||
698 | ] | ||
699 | |||
700 | [[package]] | ||
701 | name = "hmac" | ||
702 | version = "0.12.1" | ||
703 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
704 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" | ||
705 | dependencies = [ | ||
706 | "digest", | ||
707 | ] | ||
708 | |||
709 | [[package]] | ||
710 | name = "home" | ||
711 | version = "0.5.9" | ||
712 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
713 | checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" | ||
714 | dependencies = [ | ||
715 | "windows-sys 0.52.0", | ||
716 | ] | ||
717 | |||
718 | [[package]] | ||
719 | name = "http" | 503 | name = "http" |
720 | version = "1.1.0" | 504 | version = "1.1.0" |
721 | source = "registry+https://github.com/rust-lang/crates.io-index" | 505 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -833,15 +617,6 @@ dependencies = [ | |||
833 | ] | 617 | ] |
834 | 618 | ||
835 | [[package]] | 619 | [[package]] |
836 | name = "itertools" | ||
837 | version = "0.12.1" | ||
838 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
839 | checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" | ||
840 | dependencies = [ | ||
841 | "either", | ||
842 | ] | ||
843 | |||
844 | [[package]] | ||
845 | name = "itoa" | 620 | name = "itoa" |
846 | version = "1.0.11" | 621 | version = "1.0.11" |
847 | source = "registry+https://github.com/rust-lang/crates.io-index" | 622 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -863,9 +638,6 @@ name = "lazy_static" | |||
863 | version = "1.4.0" | 638 | version = "1.4.0" |
864 | source = "registry+https://github.com/rust-lang/crates.io-index" | 639 | source = "registry+https://github.com/rust-lang/crates.io-index" |
865 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" | 640 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" |
866 | dependencies = [ | ||
867 | "spin 0.5.2", | ||
868 | ] | ||
869 | 641 | ||
870 | [[package]] | 642 | [[package]] |
871 | name = "libc" | 643 | name = "libc" |
@@ -874,35 +646,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
874 | checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" | 646 | checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" |
875 | 647 | ||
876 | [[package]] | 648 | [[package]] |
877 | name = "libm" | ||
878 | version = "0.2.8" | ||
879 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
880 | checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" | ||
881 | |||
882 | [[package]] | ||
883 | name = "libsqlite3-sys" | ||
884 | version = "0.27.0" | ||
885 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
886 | checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" | ||
887 | dependencies = [ | ||
888 | "cc", | ||
889 | "pkg-config", | ||
890 | "vcpkg", | ||
891 | ] | ||
892 | |||
893 | [[package]] | ||
894 | name = "linked-hash-map" | 649 | name = "linked-hash-map" |
895 | version = "0.5.6" | 650 | version = "0.5.6" |
896 | source = "registry+https://github.com/rust-lang/crates.io-index" | 651 | source = "registry+https://github.com/rust-lang/crates.io-index" |
897 | checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" | 652 | checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" |
898 | 653 | ||
899 | [[package]] | 654 | [[package]] |
900 | name = "linux-raw-sys" | ||
901 | version = "0.4.13" | ||
902 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
903 | checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" | ||
904 | |||
905 | [[package]] | ||
906 | name = "lock_api" | 655 | name = "lock_api" |
907 | version = "0.4.11" | 656 | version = "0.4.11" |
908 | source = "registry+https://github.com/rust-lang/crates.io-index" | 657 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -945,16 +694,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
945 | checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" | 694 | checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" |
946 | 695 | ||
947 | [[package]] | 696 | [[package]] |
948 | name = "md-5" | ||
949 | version = "0.10.6" | ||
950 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
951 | checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" | ||
952 | dependencies = [ | ||
953 | "cfg-if", | ||
954 | "digest", | ||
955 | ] | ||
956 | |||
957 | [[package]] | ||
958 | name = "memchr" | 697 | name = "memchr" |
959 | version = "2.7.2" | 698 | version = "2.7.2" |
960 | source = "registry+https://github.com/rust-lang/crates.io-index" | 699 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1051,59 +790,12 @@ dependencies = [ | |||
1051 | ] | 790 | ] |
1052 | 791 | ||
1053 | [[package]] | 792 | [[package]] |
1054 | name = "num-bigint-dig" | ||
1055 | version = "0.8.4" | ||
1056 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1057 | checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" | ||
1058 | dependencies = [ | ||
1059 | "byteorder", | ||
1060 | "lazy_static", | ||
1061 | "libm", | ||
1062 | "num-integer", | ||
1063 | "num-iter", | ||
1064 | "num-traits", | ||
1065 | "rand", | ||
1066 | "smallvec", | ||
1067 | "zeroize", | ||
1068 | ] | ||
1069 | |||
1070 | [[package]] | ||
1071 | name = "num-conv" | 793 | name = "num-conv" |
1072 | version = "0.1.0" | 794 | version = "0.1.0" |
1073 | source = "registry+https://github.com/rust-lang/crates.io-index" | 795 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1074 | checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" | 796 | checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" |
1075 | 797 | ||
1076 | [[package]] | 798 | [[package]] |
1077 | name = "num-integer" | ||
1078 | version = "0.1.46" | ||
1079 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1080 | checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" | ||
1081 | dependencies = [ | ||
1082 | "num-traits", | ||
1083 | ] | ||
1084 | |||
1085 | [[package]] | ||
1086 | name = "num-iter" | ||
1087 | version = "0.1.44" | ||
1088 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1089 | checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" | ||
1090 | dependencies = [ | ||
1091 | "autocfg", | ||
1092 | "num-integer", | ||
1093 | "num-traits", | ||
1094 | ] | ||
1095 | |||
1096 | [[package]] | ||
1097 | name = "num-traits" | ||
1098 | version = "0.2.18" | ||
1099 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1100 | checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" | ||
1101 | dependencies = [ | ||
1102 | "autocfg", | ||
1103 | "libm", | ||
1104 | ] | ||
1105 | |||
1106 | [[package]] | ||
1107 | name = "num_cpus" | 799 | name = "num_cpus" |
1108 | version = "1.16.0" | 800 | version = "1.16.0" |
1109 | source = "registry+https://github.com/rust-lang/crates.io-index" | 801 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1183,27 +875,12 @@ dependencies = [ | |||
1183 | ] | 875 | ] |
1184 | 876 | ||
1185 | [[package]] | 877 | [[package]] |
1186 | name = "paste" | ||
1187 | version = "1.0.14" | ||
1188 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1189 | checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" | ||
1190 | |||
1191 | [[package]] | ||
1192 | name = "pathdiff" | 878 | name = "pathdiff" |
1193 | version = "0.2.1" | 879 | version = "0.2.1" |
1194 | source = "registry+https://github.com/rust-lang/crates.io-index" | 880 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1195 | checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" | 881 | checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" |
1196 | 882 | ||
1197 | [[package]] | 883 | [[package]] |
1198 | name = "pem-rfc7468" | ||
1199 | version = "0.7.0" | ||
1200 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1201 | checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" | ||
1202 | dependencies = [ | ||
1203 | "base64ct", | ||
1204 | ] | ||
1205 | |||
1206 | [[package]] | ||
1207 | name = "percent-encoding" | 884 | name = "percent-encoding" |
1208 | version = "2.3.1" | 885 | version = "2.3.1" |
1209 | source = "registry+https://github.com/rust-lang/crates.io-index" | 886 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1287,33 +964,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1287 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" | 964 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" |
1288 | 965 | ||
1289 | [[package]] | 966 | [[package]] |
1290 | name = "pkcs1" | ||
1291 | version = "0.7.5" | ||
1292 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1293 | checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" | ||
1294 | dependencies = [ | ||
1295 | "der", | ||
1296 | "pkcs8", | ||
1297 | "spki", | ||
1298 | ] | ||
1299 | |||
1300 | [[package]] | ||
1301 | name = "pkcs8" | ||
1302 | version = "0.10.2" | ||
1303 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1304 | checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" | ||
1305 | dependencies = [ | ||
1306 | "der", | ||
1307 | "spki", | ||
1308 | ] | ||
1309 | |||
1310 | [[package]] | ||
1311 | name = "pkg-config" | ||
1312 | version = "0.3.30" | ||
1313 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1314 | checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" | ||
1315 | |||
1316 | [[package]] | ||
1317 | name = "pnet_base" | 967 | name = "pnet_base" |
1318 | version = "0.34.0" | 968 | version = "0.34.0" |
1319 | source = "registry+https://github.com/rust-lang/crates.io-index" | 969 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1505,26 +1155,6 @@ dependencies = [ | |||
1505 | ] | 1155 | ] |
1506 | 1156 | ||
1507 | [[package]] | 1157 | [[package]] |
1508 | name = "rsa" | ||
1509 | version = "0.9.6" | ||
1510 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1511 | checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" | ||
1512 | dependencies = [ | ||
1513 | "const-oid", | ||
1514 | "digest", | ||
1515 | "num-bigint-dig", | ||
1516 | "num-integer", | ||
1517 | "num-traits", | ||
1518 | "pkcs1", | ||
1519 | "pkcs8", | ||
1520 | "rand_core", | ||
1521 | "signature", | ||
1522 | "spki", | ||
1523 | "subtle", | ||
1524 | "zeroize", | ||
1525 | ] | ||
1526 | |||
1527 | [[package]] | ||
1528 | name = "rust-embed" | 1158 | name = "rust-embed" |
1529 | version = "8.3.0" | 1159 | version = "8.3.0" |
1530 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1160 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1575,19 +1205,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1575 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" | 1205 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" |
1576 | 1206 | ||
1577 | [[package]] | 1207 | [[package]] |
1578 | name = "rustix" | ||
1579 | version = "0.38.32" | ||
1580 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1581 | checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" | ||
1582 | dependencies = [ | ||
1583 | "bitflags 2.5.0", | ||
1584 | "errno", | ||
1585 | "libc", | ||
1586 | "linux-raw-sys", | ||
1587 | "windows-sys 0.52.0", | ||
1588 | ] | ||
1589 | |||
1590 | [[package]] | ||
1591 | name = "rustversion" | 1208 | name = "rustversion" |
1592 | version = "1.0.15" | 1209 | version = "1.0.15" |
1593 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1210 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1708,16 +1325,6 @@ dependencies = [ | |||
1708 | ] | 1325 | ] |
1709 | 1326 | ||
1710 | [[package]] | 1327 | [[package]] |
1711 | name = "signature" | ||
1712 | version = "2.2.0" | ||
1713 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1714 | checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" | ||
1715 | dependencies = [ | ||
1716 | "digest", | ||
1717 | "rand_core", | ||
1718 | ] | ||
1719 | |||
1720 | [[package]] | ||
1721 | name = "slab" | 1328 | name = "slab" |
1722 | version = "0.4.9" | 1329 | version = "0.4.9" |
1723 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1330 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1743,257 +1350,6 @@ dependencies = [ | |||
1743 | ] | 1350 | ] |
1744 | 1351 | ||
1745 | [[package]] | 1352 | [[package]] |
1746 | name = "spin" | ||
1747 | version = "0.5.2" | ||
1748 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1749 | checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" | ||
1750 | |||
1751 | [[package]] | ||
1752 | name = "spin" | ||
1753 | version = "0.9.8" | ||
1754 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1755 | checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" | ||
1756 | dependencies = [ | ||
1757 | "lock_api", | ||
1758 | ] | ||
1759 | |||
1760 | [[package]] | ||
1761 | name = "spki" | ||
1762 | version = "0.7.3" | ||
1763 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1764 | checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" | ||
1765 | dependencies = [ | ||
1766 | "base64ct", | ||
1767 | "der", | ||
1768 | ] | ||
1769 | |||
1770 | [[package]] | ||
1771 | name = "sqlformat" | ||
1772 | version = "0.2.3" | ||
1773 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1774 | checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" | ||
1775 | dependencies = [ | ||
1776 | "itertools", | ||
1777 | "nom", | ||
1778 | "unicode_categories", | ||
1779 | ] | ||
1780 | |||
1781 | [[package]] | ||
1782 | name = "sqlx" | ||
1783 | version = "0.7.4" | ||
1784 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1785 | checksum = "c9a2ccff1a000a5a59cd33da541d9f2fdcd9e6e8229cc200565942bff36d0aaa" | ||
1786 | dependencies = [ | ||
1787 | "sqlx-core", | ||
1788 | "sqlx-macros", | ||
1789 | "sqlx-mysql", | ||
1790 | "sqlx-postgres", | ||
1791 | "sqlx-sqlite", | ||
1792 | ] | ||
1793 | |||
1794 | [[package]] | ||
1795 | name = "sqlx-core" | ||
1796 | version = "0.7.4" | ||
1797 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1798 | checksum = "24ba59a9342a3d9bab6c56c118be528b27c9b60e490080e9711a04dccac83ef6" | ||
1799 | dependencies = [ | ||
1800 | "ahash", | ||
1801 | "atoi", | ||
1802 | "byteorder", | ||
1803 | "bytes", | ||
1804 | "crc", | ||
1805 | "crossbeam-queue", | ||
1806 | "either", | ||
1807 | "event-listener", | ||
1808 | "futures-channel", | ||
1809 | "futures-core", | ||
1810 | "futures-intrusive", | ||
1811 | "futures-io", | ||
1812 | "futures-util", | ||
1813 | "hashlink", | ||
1814 | "hex", | ||
1815 | "indexmap", | ||
1816 | "ipnetwork", | ||
1817 | "log", | ||
1818 | "mac_address", | ||
1819 | "memchr", | ||
1820 | "once_cell", | ||
1821 | "paste", | ||
1822 | "percent-encoding", | ||
1823 | "serde", | ||
1824 | "serde_json", | ||
1825 | "sha2", | ||
1826 | "smallvec", | ||
1827 | "sqlformat", | ||
1828 | "thiserror", | ||
1829 | "tokio", | ||
1830 | "tokio-stream", | ||
1831 | "tracing", | ||
1832 | "url", | ||
1833 | ] | ||
1834 | |||
1835 | [[package]] | ||
1836 | name = "sqlx-macros" | ||
1837 | version = "0.7.4" | ||
1838 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1839 | checksum = "4ea40e2345eb2faa9e1e5e326db8c34711317d2b5e08d0d5741619048a803127" | ||
1840 | dependencies = [ | ||
1841 | "proc-macro2", | ||
1842 | "quote", | ||
1843 | "sqlx-core", | ||
1844 | "sqlx-macros-core", | ||
1845 | "syn 1.0.109", | ||
1846 | ] | ||
1847 | |||
1848 | [[package]] | ||
1849 | name = "sqlx-macros-core" | ||
1850 | version = "0.7.4" | ||
1851 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1852 | checksum = "5833ef53aaa16d860e92123292f1f6a3d53c34ba8b1969f152ef1a7bb803f3c8" | ||
1853 | dependencies = [ | ||
1854 | "dotenvy", | ||
1855 | "either", | ||
1856 | "heck", | ||
1857 | "hex", | ||
1858 | "once_cell", | ||
1859 | "proc-macro2", | ||
1860 | "quote", | ||
1861 | "serde", | ||
1862 | "serde_json", | ||
1863 | "sha2", | ||
1864 | "sqlx-core", | ||
1865 | "sqlx-mysql", | ||
1866 | "sqlx-postgres", | ||
1867 | "sqlx-sqlite", | ||
1868 | "syn 1.0.109", | ||
1869 | "tempfile", | ||
1870 | "tokio", | ||
1871 | "url", | ||
1872 | ] | ||
1873 | |||
1874 | [[package]] | ||
1875 | name = "sqlx-mysql" | ||
1876 | version = "0.7.4" | ||
1877 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1878 | checksum = "1ed31390216d20e538e447a7a9b959e06ed9fc51c37b514b46eb758016ecd418" | ||
1879 | dependencies = [ | ||
1880 | "atoi", | ||
1881 | "base64", | ||
1882 | "bitflags 2.5.0", | ||
1883 | "byteorder", | ||
1884 | "bytes", | ||
1885 | "crc", | ||
1886 | "digest", | ||
1887 | "dotenvy", | ||
1888 | "either", | ||
1889 | "futures-channel", | ||
1890 | "futures-core", | ||
1891 | "futures-io", | ||
1892 | "futures-util", | ||
1893 | "generic-array", | ||
1894 | "hex", | ||
1895 | "hkdf", | ||
1896 | "hmac", | ||
1897 | "itoa", | ||
1898 | "log", | ||
1899 | "md-5", | ||
1900 | "memchr", | ||
1901 | "once_cell", | ||
1902 | "percent-encoding", | ||
1903 | "rand", | ||
1904 | "rsa", | ||
1905 | "serde", | ||
1906 | "sha1", | ||
1907 | "sha2", | ||
1908 | "smallvec", | ||
1909 | "sqlx-core", | ||
1910 | "stringprep", | ||
1911 | "thiserror", | ||
1912 | "tracing", | ||
1913 | "whoami", | ||
1914 | ] | ||
1915 | |||
1916 | [[package]] | ||
1917 | name = "sqlx-postgres" | ||
1918 | version = "0.7.4" | ||
1919 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1920 | checksum = "7c824eb80b894f926f89a0b9da0c7f435d27cdd35b8c655b114e58223918577e" | ||
1921 | dependencies = [ | ||
1922 | "atoi", | ||
1923 | "base64", | ||
1924 | "bitflags 2.5.0", | ||
1925 | "byteorder", | ||
1926 | "crc", | ||
1927 | "dotenvy", | ||
1928 | "etcetera", | ||
1929 | "futures-channel", | ||
1930 | "futures-core", | ||
1931 | "futures-io", | ||
1932 | "futures-util", | ||
1933 | "hex", | ||
1934 | "hkdf", | ||
1935 | "hmac", | ||
1936 | "home", | ||
1937 | "ipnetwork", | ||
1938 | "itoa", | ||
1939 | "log", | ||
1940 | "mac_address", | ||
1941 | "md-5", | ||
1942 | "memchr", | ||
1943 | "once_cell", | ||
1944 | "rand", | ||
1945 | "serde", | ||
1946 | "serde_json", | ||
1947 | "sha2", | ||
1948 | "smallvec", | ||
1949 | "sqlx-core", | ||
1950 | "stringprep", | ||
1951 | "thiserror", | ||
1952 | "tracing", | ||
1953 | "whoami", | ||
1954 | ] | ||
1955 | |||
1956 | [[package]] | ||
1957 | name = "sqlx-sqlite" | ||
1958 | version = "0.7.4" | ||
1959 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1960 | checksum = "b244ef0a8414da0bed4bb1910426e890b19e5e9bccc27ada6b797d05c55ae0aa" | ||
1961 | dependencies = [ | ||
1962 | "atoi", | ||
1963 | "flume", | ||
1964 | "futures-channel", | ||
1965 | "futures-core", | ||
1966 | "futures-executor", | ||
1967 | "futures-intrusive", | ||
1968 | "futures-util", | ||
1969 | "libsqlite3-sys", | ||
1970 | "log", | ||
1971 | "percent-encoding", | ||
1972 | "serde", | ||
1973 | "sqlx-core", | ||
1974 | "tracing", | ||
1975 | "url", | ||
1976 | "urlencoding", | ||
1977 | ] | ||
1978 | |||
1979 | [[package]] | ||
1980 | name = "stringprep" | ||
1981 | version = "0.1.4" | ||
1982 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1983 | checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" | ||
1984 | dependencies = [ | ||
1985 | "finl_unicode", | ||
1986 | "unicode-bidi", | ||
1987 | "unicode-normalization", | ||
1988 | ] | ||
1989 | |||
1990 | [[package]] | ||
1991 | name = "subtle" | ||
1992 | version = "2.5.0" | ||
1993 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1994 | checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" | ||
1995 | |||
1996 | [[package]] | ||
1997 | name = "surge-ping" | 1353 | name = "surge-ping" |
1998 | version = "0.8.1" | 1354 | version = "0.8.1" |
1999 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1355 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2016,7 +1372,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2016 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" | 1372 | checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" |
2017 | dependencies = [ | 1373 | dependencies = [ |
2018 | "proc-macro2", | 1374 | "proc-macro2", |
2019 | "quote", | ||
2020 | "unicode-ident", | 1375 | "unicode-ident", |
2021 | ] | 1376 | ] |
2022 | 1377 | ||
@@ -2044,18 +1399,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2044 | checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" | 1399 | checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" |
2045 | 1400 | ||
2046 | [[package]] | 1401 | [[package]] |
2047 | name = "tempfile" | ||
2048 | version = "3.10.1" | ||
2049 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2050 | checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" | ||
2051 | dependencies = [ | ||
2052 | "cfg-if", | ||
2053 | "fastrand", | ||
2054 | "rustix", | ||
2055 | "windows-sys 0.52.0", | ||
2056 | ] | ||
2057 | |||
2058 | [[package]] | ||
2059 | name = "thiserror" | 1402 | name = "thiserror" |
2060 | version = "1.0.58" | 1403 | version = "1.0.58" |
2061 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1404 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2171,17 +1514,6 @@ dependencies = [ | |||
2171 | ] | 1514 | ] |
2172 | 1515 | ||
2173 | [[package]] | 1516 | [[package]] |
2174 | name = "tokio-stream" | ||
2175 | version = "0.1.15" | ||
2176 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2177 | checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" | ||
2178 | dependencies = [ | ||
2179 | "futures-core", | ||
2180 | "pin-project-lite", | ||
2181 | "tokio", | ||
2182 | ] | ||
2183 | |||
2184 | [[package]] | ||
2185 | name = "tokio-tungstenite" | 1517 | name = "tokio-tungstenite" |
2186 | version = "0.21.0" | 1518 | version = "0.21.0" |
2187 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1519 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2408,12 +1740,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2408 | checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" | 1740 | checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" |
2409 | 1741 | ||
2410 | [[package]] | 1742 | [[package]] |
2411 | name = "unicode_categories" | ||
2412 | version = "0.1.1" | ||
2413 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2414 | checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" | ||
2415 | |||
2416 | [[package]] | ||
2417 | name = "url" | 1743 | name = "url" |
2418 | version = "2.5.0" | 1744 | version = "2.5.0" |
2419 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1745 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2425,12 +1751,6 @@ dependencies = [ | |||
2425 | ] | 1751 | ] |
2426 | 1752 | ||
2427 | [[package]] | 1753 | [[package]] |
2428 | name = "urlencoding" | ||
2429 | version = "2.1.3" | ||
2430 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2431 | checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" | ||
2432 | |||
2433 | [[package]] | ||
2434 | name = "utf-8" | 1754 | name = "utf-8" |
2435 | version = "0.7.6" | 1755 | version = "0.7.6" |
2436 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1756 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2494,12 +1814,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2494 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" | 1814 | checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" |
2495 | 1815 | ||
2496 | [[package]] | 1816 | [[package]] |
2497 | name = "vcpkg" | ||
2498 | version = "0.2.15" | ||
2499 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2500 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" | ||
2501 | |||
2502 | [[package]] | ||
2503 | name = "version_check" | 1817 | name = "version_check" |
2504 | version = "0.9.4" | 1818 | version = "0.9.4" |
2505 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1819 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2522,14 +1836,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
2522 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" | 1836 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" |
2523 | 1837 | ||
2524 | [[package]] | 1838 | [[package]] |
2525 | name = "wasite" | ||
2526 | version = "0.1.0" | ||
2527 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2528 | checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" | ||
2529 | |||
2530 | [[package]] | ||
2531 | name = "webol" | 1839 | name = "webol" |
2532 | version = "0.3.4" | 1840 | version = "0.4.0" |
2533 | dependencies = [ | 1841 | dependencies = [ |
2534 | "axum", | 1842 | "axum", |
2535 | "axum-macros", | 1843 | "axum-macros", |
@@ -2540,7 +1848,6 @@ dependencies = [ | |||
2540 | "mac_address", | 1848 | "mac_address", |
2541 | "serde", | 1849 | "serde", |
2542 | "serde_json", | 1850 | "serde_json", |
2543 | "sqlx", | ||
2544 | "surge-ping", | 1851 | "surge-ping", |
2545 | "thiserror", | 1852 | "thiserror", |
2546 | "time", | 1853 | "time", |
@@ -2554,16 +1861,6 @@ dependencies = [ | |||
2554 | ] | 1861 | ] |
2555 | 1862 | ||
2556 | [[package]] | 1863 | [[package]] |
2557 | name = "whoami" | ||
2558 | version = "1.5.1" | ||
2559 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2560 | checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9" | ||
2561 | dependencies = [ | ||
2562 | "redox_syscall", | ||
2563 | "wasite", | ||
2564 | ] | ||
2565 | |||
2566 | [[package]] | ||
2567 | name = "winapi" | 1864 | name = "winapi" |
2568 | version = "0.3.9" | 1865 | version = "0.3.9" |
2569 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1866 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -2745,32 +2042,6 @@ dependencies = [ | |||
2745 | ] | 2042 | ] |
2746 | 2043 | ||
2747 | [[package]] | 2044 | [[package]] |
2748 | name = "zerocopy" | ||
2749 | version = "0.7.32" | ||
2750 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2751 | checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" | ||
2752 | dependencies = [ | ||
2753 | "zerocopy-derive", | ||
2754 | ] | ||
2755 | |||
2756 | [[package]] | ||
2757 | name = "zerocopy-derive" | ||
2758 | version = "0.7.32" | ||
2759 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2760 | checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" | ||
2761 | dependencies = [ | ||
2762 | "proc-macro2", | ||
2763 | "quote", | ||
2764 | "syn 2.0.58", | ||
2765 | ] | ||
2766 | |||
2767 | [[package]] | ||
2768 | name = "zeroize" | ||
2769 | version = "1.7.0" | ||
2770 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
2771 | checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" | ||
2772 | |||
2773 | [[package]] | ||
2774 | name = "zip" | 2045 | name = "zip" |
2775 | version = "0.6.6" | 2046 | version = "0.6.6" |
2776 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2047 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1,6 +1,6 @@ | |||
1 | [package] | 1 | [package] |
2 | name = "webol" | 2 | name = "webol" |
3 | version = "0.3.4" | 3 | version = "0.4.0" |
4 | edition = "2021" | 4 | edition = "2021" |
5 | 5 | ||
6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html |
@@ -14,7 +14,6 @@ time = { version = "0.3", features = ["macros"] } | |||
14 | serde = { version = "1.0", features = ["derive"] } | 14 | serde = { version = "1.0", features = ["derive"] } |
15 | serde_json = "1.0" | 15 | serde_json = "1.0" |
16 | config = "0.14" | 16 | config = "0.14" |
17 | sqlx = { version = "0.7", features = ["postgres", "runtime-tokio", "ipnetwork", "mac_address"]} | ||
18 | surge-ping = "0.8" | 17 | surge-ping = "0.8" |
19 | axum-macros = "0.4" | 18 | axum-macros = "0.4" |
20 | uuid = { version = "1.8", features = ["v4", "fast-rng"] } | 19 | uuid = { version = "1.8", features = ["v4", "fast-rng"] } |
@@ -5,7 +5,7 @@ RUN cd /tmp && \ | |||
5 | mkdir /dpkg && \ | 5 | mkdir /dpkg && \ |
6 | for deb in *.deb; do dpkg --extract $deb /dpkg || exit 10; done | 6 | for deb in *.deb; do dpkg --extract $deb /dpkg || exit 10; done |
7 | 7 | ||
8 | FROM rust:1.76 as builder | 8 | FROM rust:1.77 as builder |
9 | WORKDIR /app | 9 | WORKDIR /app |
10 | COPY . . | 10 | COPY . . |
11 | RUN cargo install --path . | 11 | RUN cargo install --path . |
@@ -1,9 +1,28 @@ | |||
1 | # webol | 1 | # webol |
2 | 2 | ||
3 | DATABASE_URL: `String` | 3 | ## Config |
4 | Default `config.toml`: | ||
5 | ```toml | ||
6 | serveraddr = "0.0.0.0:7229" # String | ||
7 | pingtimeout = 10 # i64 | ||
8 | pingthreshold = 1 # i64 | ||
9 | timeoffset = 0 # i8 | ||
4 | 10 | ||
5 | WEBOL_APIKEY: `String` | 11 | [auth] |
12 | method = "none" # "none"|"key" | ||
13 | secret = "" # String | ||
14 | ``` | ||
6 | 15 | ||
7 | WEBOL_SERVERADDR: `Option<String>` (0.0.0.0:7229) | 16 | ## Docker |
8 | 17 | ||
9 | WEBOL_PINGTIMEOUT: `Option<i64>` (10) | 18 | minimal `docker-compose.yaml`: |
19 | ```yaml | ||
20 | services: | ||
21 | webol: | ||
22 | image: ghcr.io/fxqnlr/webol:0.4.0 | ||
23 | container_name: webol | ||
24 | restart: unless-stopped | ||
25 | volumes: | ||
26 | - ./devices:/devices | ||
27 | network_mode: host | ||
28 | ``` | ||
diff --git a/build.rs b/build.rs deleted file mode 100644 index 7609593..0000000 --- a/build.rs +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | // generated by `sqlx migrate build-script` | ||
2 | fn main() { | ||
3 | // trigger recompilation when a new migration is added | ||
4 | println!("cargo:rerun-if-changed=migrations"); | ||
5 | } \ No newline at end of file | ||
diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index abac64e..0000000 --- a/docker-compose.yml +++ /dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | version: '3.1' | ||
2 | |||
3 | services: | ||
4 | db: | ||
5 | image: postgres | ||
6 | container_name: webol_dev_postgres | ||
7 | restart: no | ||
8 | environment: | ||
9 | - POSTGRES_PASSWORD=postgres | ||
10 | - POSTGRES_DB=webol | ||
11 | |||
12 | ports: | ||
13 | - "5432:5432" | ||
diff --git a/migrations/20231009123228_devices.sql b/migrations/20231009123228_devices.sql deleted file mode 100644 index 6983ada..0000000 --- a/migrations/20231009123228_devices.sql +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | -- Add migration script here | ||
2 | CREATE TABLE IF NOT EXISTS "devices" | ||
3 | ( | ||
4 | "id" VARCHAR(255) PRIMARY KEY NOT NULL, | ||
5 | "mac" MACADDR NOT NULL, | ||
6 | "broadcast_addr" VARCHAR(39) NOT NULL, | ||
7 | "ip" INET NOT NULL, | ||
8 | "times" BIGINT[] | ||
9 | ) | ||
diff --git a/src/auth.rs b/src/auth.rs index 74008b5..c662e36 100644 --- a/src/auth.rs +++ b/src/auth.rs | |||
@@ -6,6 +6,7 @@ use axum::{ | |||
6 | response::Response, | 6 | response::Response, |
7 | }; | 7 | }; |
8 | use serde::Deserialize; | 8 | use serde::Deserialize; |
9 | use tracing::trace; | ||
9 | 10 | ||
10 | #[derive(Debug, Clone, Deserialize)] | 11 | #[derive(Debug, Clone, Deserialize)] |
11 | pub enum Methods { | 12 | pub enum Methods { |
@@ -20,15 +21,19 @@ pub async fn auth( | |||
20 | next: Next, | 21 | next: Next, |
21 | ) -> Result<Response, StatusCode> { | 22 | ) -> Result<Response, StatusCode> { |
22 | let auth = state.config.auth; | 23 | let auth = state.config.auth; |
24 | trace!(?auth.method, "auth request"); | ||
23 | match auth.method { | 25 | match auth.method { |
24 | Methods::Key => { | 26 | Methods::Key => { |
25 | if let Some(secret) = headers.get("authorization") { | 27 | if let Some(secret) = headers.get("authorization") { |
26 | if auth.secret.as_str() != secret { | 28 | if auth.secret.as_str() != secret { |
29 | trace!("auth failed, unknown secret"); | ||
27 | return Err(StatusCode::UNAUTHORIZED); | 30 | return Err(StatusCode::UNAUTHORIZED); |
28 | }; | 31 | }; |
32 | trace!("auth successfull"); | ||
29 | let response = next.run(request).await; | 33 | let response = next.run(request).await; |
30 | Ok(response) | 34 | Ok(response) |
31 | } else { | 35 | } else { |
36 | trace!("auth failed, no secret"); | ||
32 | Err(StatusCode::UNAUTHORIZED) | 37 | Err(StatusCode::UNAUTHORIZED) |
33 | } | 38 | } |
34 | } | 39 | } |
diff --git a/src/config.rs b/src/config.rs index 9636af4..bfb28be 100644 --- a/src/config.rs +++ b/src/config.rs | |||
@@ -5,7 +5,6 @@ use crate::auth; | |||
5 | 5 | ||
6 | #[derive(Debug, Clone, Deserialize)] | 6 | #[derive(Debug, Clone, Deserialize)] |
7 | pub struct Config { | 7 | pub struct Config { |
8 | pub database_url: String, | ||
9 | pub serveraddr: String, | 8 | pub serveraddr: String, |
10 | pub pingtimeout: i64, | 9 | pub pingtimeout: i64, |
11 | pub pingthreshold: i64, | 10 | pub pingthreshold: i64, |
@@ -26,9 +25,11 @@ impl Config { | |||
26 | .set_default("pingtimeout", 10)? | 25 | .set_default("pingtimeout", 10)? |
27 | .set_default("pingthreshold", 1)? | 26 | .set_default("pingthreshold", 1)? |
28 | .set_default("timeoffset", 0)? | 27 | .set_default("timeoffset", 0)? |
28 | .set_default("auth.method", "none")? | ||
29 | .set_default("auth.secret", "")? | ||
29 | .add_source(File::with_name("config.toml").required(false)) | 30 | .add_source(File::with_name("config.toml").required(false)) |
30 | .add_source(File::with_name("config.dev.toml").required(false)) | 31 | .add_source(File::with_name("config.dev.toml").required(false)) |
31 | .add_source(config::Environment::with_prefix("WEBOL").prefix_separator("_")) | 32 | .add_source(config::Environment::with_prefix("WEBOL").separator("_")) |
32 | .build()?; | 33 | .build()?; |
33 | 34 | ||
34 | config.try_deserialize() | 35 | config.try_deserialize() |
diff --git a/src/db.rs b/src/db.rs deleted file mode 100644 index a2b2009..0000000 --- a/src/db.rs +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | use serde::Serialize; | ||
2 | use sqlx::{PgPool, postgres::PgPoolOptions, types::{ipnetwork::IpNetwork, mac_address::MacAddress}}; | ||
3 | use tracing::{debug, info}; | ||
4 | use utoipa::ToSchema; | ||
5 | |||
6 | #[derive(Serialize, Debug)] | ||
7 | pub struct Device { | ||
8 | pub id: String, | ||
9 | pub mac: MacAddress, | ||
10 | pub broadcast_addr: String, | ||
11 | pub ip: IpNetwork, | ||
12 | pub times: Option<Vec<i64>> | ||
13 | } | ||
14 | |||
15 | #[derive(ToSchema)] | ||
16 | #[schema(as = Device)] | ||
17 | pub struct DeviceSchema { | ||
18 | pub id: String, | ||
19 | pub mac: String, | ||
20 | pub broadcast_addr: String, | ||
21 | pub ip: String, | ||
22 | pub times: Option<Vec<i64>> | ||
23 | } | ||
24 | |||
25 | pub async fn init_db_pool(db_url: &str) -> PgPool { | ||
26 | debug!("attempt to connect dbPool to '{}'", db_url); | ||
27 | |||
28 | let pool = PgPoolOptions::new() | ||
29 | .max_connections(5) | ||
30 | .connect(db_url) | ||
31 | .await | ||
32 | .unwrap(); | ||
33 | |||
34 | info!("dbPool successfully connected to '{}'", db_url); | ||
35 | |||
36 | pool | ||
37 | } | ||
diff --git a/src/error.rs b/src/error.rs index 006fcdb..2d70592 100644 --- a/src/error.rs +++ b/src/error.rs | |||
@@ -7,14 +7,14 @@ use mac_address::MacParseError; | |||
7 | use serde_json::json; | 7 | use serde_json::json; |
8 | use utoipa::ToSchema; | 8 | use utoipa::ToSchema; |
9 | use std::io; | 9 | use std::io; |
10 | use tracing::error; | 10 | use tracing::{error, warn}; |
11 | 11 | ||
12 | #[derive(Debug, thiserror::Error, ToSchema)] | 12 | #[derive(Debug, thiserror::Error, ToSchema)] |
13 | pub enum Error { | 13 | pub enum Error { |
14 | #[error("db: {source}")] | 14 | #[error("json: {source}")] |
15 | Db { | 15 | Json { |
16 | #[from] | 16 | #[from] |
17 | source: sqlx::Error, | 17 | source: serde_json::Error, |
18 | }, | 18 | }, |
19 | 19 | ||
20 | #[error("buffer parse: {source}")] | 20 | #[error("buffer parse: {source}")] |
@@ -50,15 +50,20 @@ pub enum Error { | |||
50 | 50 | ||
51 | impl IntoResponse for Error { | 51 | impl IntoResponse for Error { |
52 | fn into_response(self) -> Response { | 52 | fn into_response(self) -> Response { |
53 | error!("{}", self.to_string()); | 53 | // error!("{}", self.to_string()); |
54 | let (status, error_message) = match self { | 54 | let (status, error_message) = match self { |
55 | Self::Db { source } => { | 55 | Self::Json { source } => { |
56 | error!("{source}"); | 56 | error!("{source}"); |
57 | (StatusCode::INTERNAL_SERVER_ERROR, "Server Error") | 57 | (StatusCode::INTERNAL_SERVER_ERROR, "Server Error") |
58 | } | 58 | } |
59 | Self::Io { source } => { | 59 | Self::Io { source } => { |
60 | error!("{source}"); | 60 | if source.kind() == io::ErrorKind::NotFound { |
61 | (StatusCode::INTERNAL_SERVER_ERROR, "Server Error") | 61 | warn!("unknown device requested"); |
62 | (StatusCode::NOT_FOUND, "Requested device not found") | ||
63 | } else { | ||
64 | error!("{source}"); | ||
65 | (StatusCode::INTERNAL_SERVER_ERROR, "Server Error") | ||
66 | } | ||
62 | } | 67 | } |
63 | Self::ParseHeader { source } => { | 68 | Self::ParseHeader { source } => { |
64 | error!("{source}"); | 69 | error!("{source}"); |
diff --git a/src/main.rs b/src/main.rs index 70c67cf..204c318 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -1,8 +1,5 @@ | |||
1 | use crate::{ | 1 | use crate::{ |
2 | config::Config, | 2 | config::Config, routes::{device, start, status}, services::ping::{BroadcastCommand, StatusMap}, storage::Device |
3 | db::init_db_pool, | ||
4 | routes::{device, start, status}, | ||
5 | services::ping::{BroadcastCommand, StatusMap}, | ||
6 | }; | 3 | }; |
7 | use axum::{ | 4 | use axum::{ |
8 | middleware::from_fn_with_state, | 5 | middleware::from_fn_with_state, |
@@ -10,11 +7,10 @@ use axum::{ | |||
10 | Router, | 7 | Router, |
11 | }; | 8 | }; |
12 | use dashmap::DashMap; | 9 | use dashmap::DashMap; |
13 | use sqlx::PgPool; | ||
14 | use std::{env, sync::Arc}; | 10 | use std::{env, sync::Arc}; |
15 | use time::UtcOffset; | 11 | use time::UtcOffset; |
16 | use tokio::sync::broadcast::{channel, Sender}; | 12 | use tokio::sync::broadcast::{channel, Sender}; |
17 | use tracing::{info, level_filters::LevelFilter}; | 13 | use tracing::{info, level_filters::LevelFilter, trace}; |
18 | use tracing_subscriber::{ | 14 | use tracing_subscriber::{ |
19 | fmt::{self, time::OffsetTime}, | 15 | fmt::{self, time::OffsetTime}, |
20 | prelude::*, | 16 | prelude::*, |
@@ -26,10 +22,10 @@ use utoipa::{ | |||
26 | }; | 22 | }; |
27 | use utoipa_swagger_ui::SwaggerUi; | 23 | use utoipa_swagger_ui::SwaggerUi; |
28 | 24 | ||
25 | mod auth; | ||
29 | mod config; | 26 | mod config; |
30 | mod db; | 27 | mod storage; |
31 | mod error; | 28 | mod error; |
32 | mod auth; | ||
33 | mod routes; | 29 | mod routes; |
34 | mod services; | 30 | mod services; |
35 | mod wol; | 31 | mod wol; |
@@ -39,20 +35,16 @@ mod wol; | |||
39 | paths( | 35 | paths( |
40 | start::post, | 36 | start::post, |
41 | start::get, | 37 | start::get, |
42 | start::start_payload, | ||
43 | device::get, | 38 | device::get, |
44 | device::get_payload, | ||
45 | device::post, | 39 | device::post, |
46 | device::put, | 40 | device::put, |
47 | ), | 41 | ), |
48 | components( | 42 | components( |
49 | schemas( | 43 | schemas( |
50 | start::PayloadOld, | 44 | start::SPayload, |
51 | start::Payload, | ||
52 | start::Response, | 45 | start::Response, |
53 | device::DevicePayload, | 46 | device::DPayload, |
54 | device::GetDevicePayload, | 47 | storage::DeviceSchema, |
55 | db::DeviceSchema, | ||
56 | ) | 48 | ) |
57 | ), | 49 | ), |
58 | modifiers(&SecurityAddon), | 50 | modifiers(&SecurityAddon), |
@@ -76,7 +68,6 @@ impl Modify for SecurityAddon { | |||
76 | } | 68 | } |
77 | 69 | ||
78 | #[tokio::main] | 70 | #[tokio::main] |
79 | #[allow(deprecated)] | ||
80 | async fn main() -> color_eyre::eyre::Result<()> { | 71 | async fn main() -> color_eyre::eyre::Result<()> { |
81 | color_eyre::install()?; | 72 | color_eyre::install()?; |
82 | 73 | ||
@@ -98,35 +89,28 @@ async fn main() -> color_eyre::eyre::Result<()> { | |||
98 | .from_env_lossy(), | 89 | .from_env_lossy(), |
99 | ) | 90 | ) |
100 | .init(); | 91 | .init(); |
92 | trace!("logging initialized"); | ||
101 | 93 | ||
102 | let version = env!("CARGO_PKG_VERSION"); | 94 | Device::setup()?; |
103 | |||
104 | info!("start webol v{}", version); | ||
105 | 95 | ||
106 | let db = init_db_pool(&config.database_url).await; | 96 | let version = env!("CARGO_PKG_VERSION"); |
107 | sqlx::migrate!().run(&db).await.unwrap(); | 97 | info!(?version, "start webol"); |
108 | 98 | ||
109 | let (tx, _) = channel(32); | 99 | let (tx, _) = channel(32); |
110 | 100 | ||
111 | let ping_map: StatusMap = DashMap::new(); | 101 | let ping_map: StatusMap = DashMap::new(); |
112 | 102 | ||
113 | let shared_state = AppState { | 103 | let shared_state = AppState { |
114 | db, | ||
115 | config: config.clone(), | 104 | config: config.clone(), |
116 | ping_send: tx, | 105 | ping_send: tx, |
117 | ping_map, | 106 | ping_map, |
118 | }; | 107 | }; |
119 | 108 | ||
120 | let app = Router::new() | 109 | let app = Router::new() |
121 | .route("/start", post(start::start_payload)) | ||
122 | .route("/start/:id", post(start::post).get(start::get)) | 110 | .route("/start/:id", post(start::post).get(start::get)) |
123 | .route( | 111 | .route("/device", post(device::post).put(device::put)) |
124 | "/device", | ||
125 | post(device::post).get(device::get_payload).put(device::put), | ||
126 | ) | ||
127 | .route("/device/:id", get(device::get)) | 112 | .route("/device/:id", get(device::get)) |
128 | .route("/status", get(status::status)) | 113 | .route("/status", get(status::status)) |
129 | // TODO: Don't load on `None` Auth | ||
130 | .route_layer(from_fn_with_state(shared_state.clone(), auth::auth)) | 114 | .route_layer(from_fn_with_state(shared_state.clone(), auth::auth)) |
131 | .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) | 115 | .merge(SwaggerUi::new("/swagger-ui").url("/api-docs/openapi.json", ApiDoc::openapi())) |
132 | .with_state(Arc::new(shared_state)); | 116 | .with_state(Arc::new(shared_state)); |
@@ -141,7 +125,6 @@ async fn main() -> color_eyre::eyre::Result<()> { | |||
141 | 125 | ||
142 | #[derive(Clone)] | 126 | #[derive(Clone)] |
143 | pub struct AppState { | 127 | pub struct AppState { |
144 | db: PgPool, | ||
145 | config: Config, | 128 | config: Config, |
146 | ping_send: Sender<BroadcastCommand>, | 129 | ping_send: Sender<BroadcastCommand>, |
147 | ping_map: StatusMap, | 130 | ping_map: StatusMap, |
diff --git a/src/routes/device.rs b/src/routes/device.rs index 40b5cd8..49361f2 100644 --- a/src/routes/device.rs +++ b/src/routes/device.rs | |||
@@ -1,49 +1,17 @@ | |||
1 | use crate::db::Device; | ||
2 | use crate::error::Error; | 1 | use crate::error::Error; |
3 | use axum::extract::{Path, State}; | 2 | use crate::storage::Device; |
3 | use axum::extract::Path; | ||
4 | use axum::Json; | 4 | use axum::Json; |
5 | use ipnetwork::IpNetwork; | ||
5 | use mac_address::MacAddress; | 6 | use mac_address::MacAddress; |
6 | use serde::Deserialize; | 7 | use serde::Deserialize; |
7 | use serde_json::{json, Value}; | 8 | use serde_json::{json, Value}; |
8 | use sqlx::types::ipnetwork::IpNetwork; | 9 | use std::str::FromStr; |
9 | use std::{str::FromStr, sync::Arc}; | ||
10 | use tracing::{debug, info}; | 10 | use tracing::{debug, info}; |
11 | use utoipa::ToSchema; | 11 | use utoipa::ToSchema; |
12 | 12 | ||
13 | #[utoipa::path( | 13 | #[utoipa::path( |
14 | get, | 14 | get, |
15 | path = "/device", | ||
16 | request_body = GetDevicePayload, | ||
17 | responses( | ||
18 | (status = 200, description = "Get `Device` information", body = [Device]) | ||
19 | ), | ||
20 | security(("api_key" = [])) | ||
21 | )] | ||
22 | #[deprecated] | ||
23 | pub async fn get_payload( | ||
24 | State(state): State<Arc<crate::AppState>>, | ||
25 | Json(payload): Json<GetDevicePayload>, | ||
26 | ) -> Result<Json<Value>, Error> { | ||
27 | info!("get device {}", payload.id); | ||
28 | let device = sqlx::query_as!( | ||
29 | Device, | ||
30 | r#" | ||
31 | SELECT id, mac, broadcast_addr, ip, times | ||
32 | FROM devices | ||
33 | WHERE id = $1; | ||
34 | "#, | ||
35 | payload.id | ||
36 | ) | ||
37 | .fetch_one(&state.db) | ||
38 | .await?; | ||
39 | |||
40 | debug!("got device {:?}", device); | ||
41 | |||
42 | Ok(Json(json!(device))) | ||
43 | } | ||
44 | |||
45 | #[utoipa::path( | ||
46 | get, | ||
47 | path = "/device/{id}", | 15 | path = "/device/{id}", |
48 | responses( | 16 | responses( |
49 | (status = 200, description = "Get `Device` information", body = [Device]) | 17 | (status = 200, description = "Get `Device` information", body = [Device]) |
@@ -53,22 +21,10 @@ pub async fn get_payload( | |||
53 | ), | 21 | ), |
54 | security((), ("api_key" = [])) | 22 | security((), ("api_key" = [])) |
55 | )] | 23 | )] |
56 | pub async fn get( | 24 | pub async fn get(Path(id): Path<String>) -> Result<Json<Value>, Error> { |
57 | State(state): State<Arc<crate::AppState>>, | 25 | info!("get device from path {}", id); |
58 | Path(path): Path<String>, | 26 | |
59 | ) -> Result<Json<Value>, Error> { | 27 | let device = Device::read(&id)?; |
60 | info!("get device from path {}", path); | ||
61 | let device = sqlx::query_as!( | ||
62 | Device, | ||
63 | r#" | ||
64 | SELECT id, mac, broadcast_addr, ip, times | ||
65 | FROM devices | ||
66 | WHERE id = $1; | ||
67 | "#, | ||
68 | path | ||
69 | ) | ||
70 | .fetch_one(&state.db) | ||
71 | .await?; | ||
72 | 28 | ||
73 | debug!("got device {:?}", device); | 29 | debug!("got device {:?}", device); |
74 | 30 | ||
@@ -76,13 +32,7 @@ pub async fn get( | |||
76 | } | 32 | } |
77 | 33 | ||
78 | #[derive(Deserialize, ToSchema)] | 34 | #[derive(Deserialize, ToSchema)] |
79 | #[deprecated] | 35 | pub struct DPayload { |
80 | pub struct GetDevicePayload { | ||
81 | id: String, | ||
82 | } | ||
83 | |||
84 | #[derive(Deserialize, ToSchema)] | ||
85 | pub struct DevicePayload { | ||
86 | id: String, | 36 | id: String, |
87 | mac: String, | 37 | mac: String, |
88 | broadcast_addr: String, | 38 | broadcast_addr: String, |
@@ -92,15 +42,14 @@ pub struct DevicePayload { | |||
92 | #[utoipa::path( | 42 | #[utoipa::path( |
93 | put, | 43 | put, |
94 | path = "/device", | 44 | path = "/device", |
95 | request_body = DevicePayload, | 45 | request_body = DPayload, |
96 | responses( | 46 | responses( |
97 | (status = 200, description = "add device to storage", body = [DeviceSchema]) | 47 | (status = 200, description = "add device to storage", body = [DeviceSchema]) |
98 | ), | 48 | ), |
99 | security((), ("api_key" = [])) | 49 | security((), ("api_key" = [])) |
100 | )] | 50 | )] |
101 | pub async fn put( | 51 | pub async fn put( |
102 | State(state): State<Arc<crate::AppState>>, | 52 | Json(payload): Json<DPayload>, |
103 | Json(payload): Json<DevicePayload>, | ||
104 | ) -> Result<Json<Value>, Error> { | 53 | ) -> Result<Json<Value>, Error> { |
105 | info!( | 54 | info!( |
106 | "add device {} ({}, {}, {})", | 55 | "add device {} ({}, {}, {})", |
@@ -109,20 +58,14 @@ pub async fn put( | |||
109 | 58 | ||
110 | let ip = IpNetwork::from_str(&payload.ip)?; | 59 | let ip = IpNetwork::from_str(&payload.ip)?; |
111 | let mac = MacAddress::from_str(&payload.mac)?; | 60 | let mac = MacAddress::from_str(&payload.mac)?; |
112 | let device = sqlx::query_as!( | 61 | let device = Device { |
113 | Device, | 62 | id: payload.id, |
114 | r#" | ||
115 | INSERT INTO devices (id, mac, broadcast_addr, ip) | ||
116 | VALUES ($1, $2, $3, $4) | ||
117 | RETURNING id, mac, broadcast_addr, ip, times; | ||
118 | "#, | ||
119 | payload.id, | ||
120 | mac, | 63 | mac, |
121 | payload.broadcast_addr, | 64 | broadcast_addr: payload.broadcast_addr, |
122 | ip | 65 | ip, |
123 | ) | 66 | times: None, |
124 | .fetch_one(&state.db) | 67 | }; |
125 | .await?; | 68 | device.write()?; |
126 | 69 | ||
127 | Ok(Json(json!(device))) | 70 | Ok(Json(json!(device))) |
128 | } | 71 | } |
@@ -130,15 +73,14 @@ pub async fn put( | |||
130 | #[utoipa::path( | 73 | #[utoipa::path( |
131 | post, | 74 | post, |
132 | path = "/device", | 75 | path = "/device", |
133 | request_body = DevicePayload, | 76 | request_body = DPayload, |
134 | responses( | 77 | responses( |
135 | (status = 200, description = "update device in storage", body = [DeviceSchema]) | 78 | (status = 200, description = "update device in storage", body = [DeviceSchema]) |
136 | ), | 79 | ), |
137 | security((), ("api_key" = [])) | 80 | security((), ("api_key" = [])) |
138 | )] | 81 | )] |
139 | pub async fn post( | 82 | pub async fn post( |
140 | State(state): State<Arc<crate::AppState>>, | 83 | Json(payload): Json<DPayload>, |
141 | Json(payload): Json<DevicePayload>, | ||
142 | ) -> Result<Json<Value>, Error> { | 84 | ) -> Result<Json<Value>, Error> { |
143 | info!( | 85 | info!( |
144 | "edit device {} ({}, {}, {})", | 86 | "edit device {} ({}, {}, {})", |
@@ -146,20 +88,16 @@ pub async fn post( | |||
146 | ); | 88 | ); |
147 | let ip = IpNetwork::from_str(&payload.ip)?; | 89 | let ip = IpNetwork::from_str(&payload.ip)?; |
148 | let mac = MacAddress::from_str(&payload.mac)?; | 90 | let mac = MacAddress::from_str(&payload.mac)?; |
149 | let device = sqlx::query_as!( | 91 | let times = Device::read(&payload.id)?.times; |
150 | Device, | 92 | |
151 | r#" | 93 | let device = Device { |
152 | UPDATE devices | 94 | id: payload.id, |
153 | SET mac = $1, broadcast_addr = $2, ip = $3 WHERE id = $4 | ||
154 | RETURNING id, mac, broadcast_addr, ip, times; | ||
155 | "#, | ||
156 | mac, | 95 | mac, |
157 | payload.broadcast_addr, | 96 | broadcast_addr: payload.broadcast_addr, |
158 | ip, | 97 | ip, |
159 | payload.id | 98 | times, |
160 | ) | 99 | }; |
161 | .fetch_one(&state.db) | 100 | device.write()?; |
162 | .await?; | ||
163 | 101 | ||
164 | Ok(Json(json!(device))) | 102 | Ok(Json(json!(device))) |
165 | } | 103 | } |
diff --git a/src/routes/start.rs b/src/routes/start.rs index ff3d1be..ae2b384 100644 --- a/src/routes/start.rs +++ b/src/routes/start.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use crate::db::Device; | 1 | use crate::storage::Device; |
2 | use crate::error::Error; | 2 | use crate::error::Error; |
3 | use crate::services::ping::Value as PingValue; | 3 | use crate::services::ping::Value as PingValue; |
4 | use crate::wol::{create_buffer, send_packet}; | 4 | use crate::wol::send_packet; |
5 | use axum::extract::{Path, State}; | 5 | use axum::extract::{Path, State}; |
6 | use axum::Json; | 6 | use axum::Json; |
7 | use serde::{Deserialize, Serialize}; | 7 | use serde::{Deserialize, Serialize}; |
@@ -13,57 +13,8 @@ use uuid::Uuid; | |||
13 | 13 | ||
14 | #[utoipa::path( | 14 | #[utoipa::path( |
15 | post, | 15 | post, |
16 | path = "/start", | ||
17 | request_body = PayloadOld, | ||
18 | responses( | ||
19 | (status = 200, description = "DEP", body = [Response]) | ||
20 | ), | ||
21 | security((), ("api_key" = [])) | ||
22 | )] | ||
23 | #[deprecated] | ||
24 | pub async fn start_payload( | ||
25 | State(state): State<Arc<crate::AppState>>, | ||
26 | Json(payload): Json<PayloadOld>, | ||
27 | ) -> Result<Json<Value>, Error> { | ||
28 | info!("POST request"); | ||
29 | let device = sqlx::query_as!( | ||
30 | Device, | ||
31 | r#" | ||
32 | SELECT id, mac, broadcast_addr, ip, times | ||
33 | FROM devices | ||
34 | WHERE id = $1; | ||
35 | "#, | ||
36 | payload.id | ||
37 | ) | ||
38 | .fetch_one(&state.db) | ||
39 | .await?; | ||
40 | |||
41 | info!("starting {}", device.id); | ||
42 | |||
43 | let bind_addr = "0.0.0.0:0"; | ||
44 | |||
45 | let _ = send_packet( | ||
46 | bind_addr, | ||
47 | &device.broadcast_addr, | ||
48 | &create_buffer(&device.mac.to_string())?, | ||
49 | )?; | ||
50 | let dev_id = device.id.clone(); | ||
51 | let uuid = if payload.ping.is_some_and(|ping| ping) { | ||
52 | Some(setup_ping(state, device)) | ||
53 | } else { | ||
54 | None | ||
55 | }; | ||
56 | Ok(Json(json!(Response { | ||
57 | id: dev_id, | ||
58 | boot: true, | ||
59 | uuid | ||
60 | }))) | ||
61 | } | ||
62 | |||
63 | #[utoipa::path( | ||
64 | post, | ||
65 | path = "/start/{id}", | 16 | path = "/start/{id}", |
66 | request_body = Option<Payload>, | 17 | request_body = Option<SPayload>, |
67 | responses( | 18 | responses( |
68 | (status = 200, description = "start the device with the given id", body = [Response]) | 19 | (status = 200, description = "start the device with the given id", body = [Response]) |
69 | ), | 20 | ), |
@@ -75,9 +26,9 @@ pub async fn start_payload( | |||
75 | pub async fn post( | 26 | pub async fn post( |
76 | State(state): State<Arc<crate::AppState>>, | 27 | State(state): State<Arc<crate::AppState>>, |
77 | Path(id): Path<String>, | 28 | Path(id): Path<String>, |
78 | payload: Option<Json<Payload>>, | 29 | payload: Option<Json<SPayload>>, |
79 | ) -> Result<Json<Value>, Error> { | 30 | ) -> Result<Json<Value>, Error> { |
80 | send_wol(state, &id, payload).await | 31 | send_wol(state, &id, payload) |
81 | } | 32 | } |
82 | 33 | ||
83 | #[utoipa::path( | 34 | #[utoipa::path( |
@@ -95,26 +46,16 @@ pub async fn get( | |||
95 | State(state): State<Arc<crate::AppState>>, | 46 | State(state): State<Arc<crate::AppState>>, |
96 | Path(id): Path<String>, | 47 | Path(id): Path<String>, |
97 | ) -> Result<Json<Value>, Error> { | 48 | ) -> Result<Json<Value>, Error> { |
98 | send_wol(state, &id, None).await | 49 | send_wol(state, &id, None) |
99 | } | 50 | } |
100 | 51 | ||
101 | async fn send_wol( | 52 | fn send_wol( |
102 | state: Arc<crate::AppState>, | 53 | state: Arc<crate::AppState>, |
103 | id: &str, | 54 | id: &str, |
104 | payload: Option<Json<Payload>>, | 55 | payload: Option<Json<SPayload>>, |
105 | ) -> Result<Json<Value>, Error> { | 56 | ) -> Result<Json<Value>, Error> { |
106 | info!("Start request for {id}"); | 57 | info!("start request for {id}"); |
107 | let device = sqlx::query_as!( | 58 | let device = Device::read(id)?; |
108 | Device, | ||
109 | r#" | ||
110 | SELECT id, mac, broadcast_addr, ip, times | ||
111 | FROM devices | ||
112 | WHERE id = $1; | ||
113 | "#, | ||
114 | id | ||
115 | ) | ||
116 | .fetch_one(&state.db) | ||
117 | .await?; | ||
118 | 59 | ||
119 | info!("starting {}", device.id); | 60 | info!("starting {}", device.id); |
120 | 61 | ||
@@ -122,8 +63,8 @@ async fn send_wol( | |||
122 | 63 | ||
123 | let _ = send_packet( | 64 | let _ = send_packet( |
124 | bind_addr, | 65 | bind_addr, |
125 | &device.broadcast_addr, | 66 | &device.broadcast_addr.to_string(), |
126 | &create_buffer(&device.mac.to_string())?, | 67 | &device.mac.bytes() |
127 | )?; | 68 | )?; |
128 | let dev_id = device.id.clone(); | 69 | let dev_id = device.id.clone(); |
129 | let uuid = if let Some(pl) = payload { | 70 | let uuid = if let Some(pl) = payload { |
@@ -163,6 +104,7 @@ fn setup_ping(state: Arc<crate::AppState>, device: Device) -> String { | |||
163 | uuid_gen.clone(), | 104 | uuid_gen.clone(), |
164 | PingValue { | 105 | PingValue { |
165 | ip: device.ip, | 106 | ip: device.ip, |
107 | eta: get_eta(device.clone().times), | ||
166 | online: false, | 108 | online: false, |
167 | }, | 109 | }, |
168 | ); | 110 | ); |
@@ -174,7 +116,6 @@ fn setup_ping(state: Arc<crate::AppState>, device: Device) -> String { | |||
174 | device, | 116 | device, |
175 | uuid_gen, | 117 | uuid_gen, |
176 | &state.ping_map, | 118 | &state.ping_map, |
177 | &state.db, | ||
178 | ) | 119 | ) |
179 | .await; | 120 | .await; |
180 | }); | 121 | }); |
@@ -182,15 +123,18 @@ fn setup_ping(state: Arc<crate::AppState>, device: Device) -> String { | |||
182 | uuid_ret | 123 | uuid_ret |
183 | } | 124 | } |
184 | 125 | ||
185 | #[derive(Deserialize, ToSchema)] | 126 | fn get_eta(times: Option<Vec<i64>>) -> i64 { |
186 | #[deprecated] | 127 | let times = if let Some(times) = times { |
187 | pub struct PayloadOld { | 128 | times |
188 | id: String, | 129 | } else { |
189 | ping: Option<bool>, | 130 | vec![0] |
131 | }; | ||
132 | |||
133 | times.iter().sum::<i64>() / i64::try_from(times.len()).unwrap() | ||
190 | } | 134 | } |
191 | 135 | ||
192 | #[derive(Deserialize, ToSchema)] | 136 | #[derive(Deserialize, ToSchema)] |
193 | pub struct Payload { | 137 | pub struct SPayload { |
194 | ping: Option<bool>, | 138 | ping: Option<bool>, |
195 | } | 139 | } |
196 | 140 | ||
diff --git a/src/routes/status.rs b/src/routes/status.rs index 0e25f7d..b38202b 100644 --- a/src/routes/status.rs +++ b/src/routes/status.rs | |||
@@ -3,7 +3,6 @@ use crate::AppState; | |||
3 | use axum::extract::ws::{Message, WebSocket}; | 3 | use axum::extract::ws::{Message, WebSocket}; |
4 | use axum::extract::{State, WebSocketUpgrade}; | 4 | use axum::extract::{State, WebSocketUpgrade}; |
5 | use axum::response::Response; | 5 | use axum::response::Response; |
6 | use sqlx::PgPool; | ||
7 | use std::sync::Arc; | 6 | use std::sync::Arc; |
8 | use tracing::{debug, trace}; | 7 | use tracing::{debug, trace}; |
9 | 8 | ||
@@ -18,13 +17,13 @@ pub async fn websocket(mut socket: WebSocket, state: Arc<AppState>) { | |||
18 | 17 | ||
19 | trace!("Search for uuid: {}", uuid); | 18 | trace!("Search for uuid: {}", uuid); |
20 | 19 | ||
21 | let eta = get_eta(&state.db).await; | ||
22 | let _ = socket | ||
23 | .send(Message::Text(format!("eta_{eta}_{uuid}"))) | ||
24 | .await; | ||
25 | 20 | ||
26 | let device_exists = state.ping_map.contains_key(&uuid); | 21 | let device_exists = state.ping_map.contains_key(&uuid); |
27 | if device_exists { | 22 | if device_exists { |
23 | let eta = state.ping_map.get(&uuid).unwrap().eta; | ||
24 | let _ = socket | ||
25 | .send(Message::Text(format!("eta_{eta}_{uuid}"))) | ||
26 | .await; | ||
28 | let _ = socket | 27 | let _ = socket |
29 | .send(receive_ping_broadcast(state.clone(), uuid).await) | 28 | .send(receive_ping_broadcast(state.clone(), uuid).await) |
30 | .await; | 29 | .await; |
@@ -62,18 +61,3 @@ async fn receive_ping_broadcast(state: Arc<AppState>, uuid: String) -> Message { | |||
62 | } | 61 | } |
63 | } | 62 | } |
64 | } | 63 | } |
65 | |||
66 | async fn get_eta(db: &PgPool) -> i64 { | ||
67 | let query = sqlx::query!(r#"SELECT times FROM devices;"#) | ||
68 | .fetch_one(db) | ||
69 | .await | ||
70 | .unwrap(); | ||
71 | |||
72 | let times = if let Some(times) = query.times { | ||
73 | times | ||
74 | } else { | ||
75 | vec![0] | ||
76 | }; | ||
77 | |||
78 | times.iter().sum::<i64>() / i64::try_from(times.len()).unwrap() | ||
79 | } | ||
diff --git a/src/services/ping.rs b/src/services/ping.rs index 8cf6072..1bf022d 100644 --- a/src/services/ping.rs +++ b/src/services/ping.rs | |||
@@ -1,8 +1,7 @@ | |||
1 | use crate::config::Config; | 1 | use crate::config::Config; |
2 | use crate::db::Device; | 2 | use crate::storage::Device; |
3 | use dashmap::DashMap; | 3 | use dashmap::DashMap; |
4 | use ipnetwork::IpNetwork; | 4 | use ipnetwork::IpNetwork; |
5 | use sqlx::PgPool; | ||
6 | use std::fmt::Display; | 5 | use std::fmt::Display; |
7 | use time::{Duration, Instant}; | 6 | use time::{Duration, Instant}; |
8 | use tokio::sync::broadcast::Sender; | 7 | use tokio::sync::broadcast::Sender; |
@@ -13,6 +12,7 @@ pub type StatusMap = DashMap<String, Value>; | |||
13 | #[derive(Debug, Clone)] | 12 | #[derive(Debug, Clone)] |
14 | pub struct Value { | 13 | pub struct Value { |
15 | pub ip: IpNetwork, | 14 | pub ip: IpNetwork, |
15 | pub eta: i64, | ||
16 | pub online: bool, | 16 | pub online: bool, |
17 | } | 17 | } |
18 | 18 | ||
@@ -22,7 +22,6 @@ pub async fn spawn( | |||
22 | device: Device, | 22 | device: Device, |
23 | uuid: String, | 23 | uuid: String, |
24 | ping_map: &StatusMap, | 24 | ping_map: &StatusMap, |
25 | db: &PgPool, | ||
26 | ) { | 25 | ) { |
27 | let timer = Instant::now(); | 26 | let timer = Instant::now(); |
28 | let payload = [0; 8]; | 27 | let payload = [0; 8]; |
@@ -56,27 +55,29 @@ pub async fn spawn( | |||
56 | let _ = tx.send(msg.clone()); | 55 | let _ = tx.send(msg.clone()); |
57 | if msg.command == BroadcastCommands::Success { | 56 | if msg.command == BroadcastCommands::Success { |
58 | if timer.elapsed().whole_seconds() > config.pingthreshold { | 57 | if timer.elapsed().whole_seconds() > config.pingthreshold { |
59 | sqlx::query!( | 58 | let newtimes = if let Some(mut oldtimes) = device.times { |
60 | r#" | 59 | oldtimes.push(timer.elapsed().whole_seconds()); |
61 | UPDATE devices | 60 | oldtimes |
62 | SET times = array_append(times, $1) | 61 | } else { |
63 | WHERE id = $2; | 62 | vec![timer.elapsed().whole_seconds()] |
64 | "#, | 63 | }; |
65 | timer.elapsed().whole_seconds(), | 64 | |
66 | device.id | 65 | let updatedev = Device { |
67 | ) | 66 | id: device.id, |
68 | .execute(db) | 67 | mac: device.mac, |
69 | .await | 68 | broadcast_addr: device.broadcast_addr, |
70 | .unwrap(); | 69 | ip: device.ip, |
70 | times: Some(newtimes), | ||
71 | }; | ||
72 | updatedev.write().unwrap(); | ||
71 | } | 73 | } |
72 | 74 | ||
73 | ping_map.insert( | 75 | ping_map.alter(&uuid, |_, v| Value { |
74 | uuid.clone(), | 76 | ip: v.ip, |
75 | Value { | 77 | eta: v.eta, |
76 | ip: device.ip, | 78 | online: true, |
77 | online: true, | 79 | }); |
78 | }, | 80 | |
79 | ); | ||
80 | tokio::time::sleep(tokio::time::Duration::from_secs(60)).await; | 81 | tokio::time::sleep(tokio::time::Duration::from_secs(60)).await; |
81 | } | 82 | } |
82 | trace!("remove {} from ping_map", uuid); | 83 | trace!("remove {} from ping_map", uuid); |
diff --git a/src/storage.rs b/src/storage.rs new file mode 100644 index 0000000..0da245b --- /dev/null +++ b/src/storage.rs | |||
@@ -0,0 +1,70 @@ | |||
1 | use std::{ | ||
2 | fs::{create_dir_all, File}, | ||
3 | io::{Read, Write}, | ||
4 | path::Path, | ||
5 | }; | ||
6 | |||
7 | use ipnetwork::IpNetwork; | ||
8 | use mac_address::MacAddress; | ||
9 | use serde::{Deserialize, Serialize}; | ||
10 | use serde_json::json; | ||
11 | use tracing::{debug, trace, warn}; | ||
12 | use utoipa::ToSchema; | ||
13 | |||
14 | use crate::error::Error; | ||
15 | |||
16 | #[derive(Serialize, Deserialize, Clone, Debug)] | ||
17 | pub struct Device { | ||
18 | pub id: String, | ||
19 | pub mac: MacAddress, | ||
20 | pub broadcast_addr: String, | ||
21 | pub ip: IpNetwork, | ||
22 | pub times: Option<Vec<i64>>, | ||
23 | } | ||
24 | |||
25 | impl Device { | ||
26 | const STORAGE_PATH: &'static str = "devices"; | ||
27 | |||
28 | pub fn setup() -> Result<String, Error> { | ||
29 | trace!("check for storage at {}", Self::STORAGE_PATH); | ||
30 | let sp = Path::new(Self::STORAGE_PATH); | ||
31 | if !sp.exists() { | ||
32 | warn!("device storage path doesn't exist, creating it"); | ||
33 | create_dir_all(Self::STORAGE_PATH)?; | ||
34 | }; | ||
35 | |||
36 | debug!("device storage at '{}'", Self::STORAGE_PATH); | ||
37 | |||
38 | Ok(Self::STORAGE_PATH.to_string()) | ||
39 | } | ||
40 | |||
41 | pub fn read(id: &str) -> Result<Self, Error> { | ||
42 | trace!(?id, "attempt to read file"); | ||
43 | let mut file = File::open(format!("{}/{id}.json", Self::STORAGE_PATH))?; | ||
44 | let mut buf = String::new(); | ||
45 | file.read_to_string(&mut buf)?; | ||
46 | trace!(?id, ?buf, "read successfully from file"); | ||
47 | |||
48 | let dev = serde_json::from_str(&buf)?; | ||
49 | Ok(dev) | ||
50 | } | ||
51 | |||
52 | pub fn write(&self) -> Result<(), Error> { | ||
53 | trace!(?self.id, ?self, "attempt to write to file"); | ||
54 | let mut file = File::create(format!("{}/{}.json", Self::STORAGE_PATH, self.id))?; | ||
55 | file.write_all(json!(self).to_string().as_bytes())?; | ||
56 | trace!(?self.id, "wrote successfully to file"); | ||
57 | |||
58 | Ok(()) | ||
59 | } | ||
60 | } | ||
61 | |||
62 | #[derive(ToSchema)] | ||
63 | #[schema(as = Device)] | ||
64 | pub struct DeviceSchema { | ||
65 | pub id: String, | ||
66 | pub mac: String, | ||
67 | pub broadcast_addr: String, | ||
68 | pub ip: String, | ||
69 | pub times: Option<Vec<i64>>, | ||
70 | } | ||
@@ -2,26 +2,6 @@ use std::net::{ToSocketAddrs, UdpSocket}; | |||
2 | 2 | ||
3 | use crate::error::Error; | 3 | use crate::error::Error; |
4 | 4 | ||
5 | /// Creates the magic packet from a mac address | ||
6 | /// | ||
7 | /// # Panics | ||
8 | /// | ||
9 | /// Panics if `mac_addr` is an invalid mac | ||
10 | pub fn create_buffer(mac_addr: &str) -> Result<Vec<u8>, Error> { | ||
11 | let mut mac = Vec::new(); | ||
12 | let sp = mac_addr.split(':'); | ||
13 | for f in sp { | ||
14 | mac.push(u8::from_str_radix(f, 16)?); | ||
15 | } | ||
16 | let mut buf = vec![255; 6]; | ||
17 | for _ in 0..16 { | ||
18 | for i in &mac { | ||
19 | buf.push(*i); | ||
20 | } | ||
21 | } | ||
22 | Ok(buf) | ||
23 | } | ||
24 | |||
25 | /// Sends a buffer on UDP broadcast | 5 | /// Sends a buffer on UDP broadcast |
26 | pub fn send_packet<A: ToSocketAddrs>( | 6 | pub fn send_packet<A: ToSocketAddrs>( |
27 | bind_addr: A, | 7 | bind_addr: A, |