Compare commits
4 Commits
detee-api-
...
main
Author | SHA1 | Date | |
---|---|---|---|
34b3922d47 | |||
6893e8185e | |||
d753358795 | |||
6b6c7b2356 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
/target
|
/target
|
||||||
tmp
|
tmp
|
||||||
|
8
Cargo.lock
generated
8
Cargo.lock
generated
@ -1,6 +1,6 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -1110,7 +1110,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "detee-cli"
|
name = "detee-cli"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bs58",
|
"bs58",
|
||||||
"chrono",
|
"chrono",
|
||||||
@ -1184,7 +1184,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "detee-shared"
|
name = "detee-shared"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+ssh://git@gitea.detee.cloud/testnet/proto.git?branch=remove_uuid#8b38d9a2b3406173fc7de2241c0e316c3e19e2b4"
|
source = "git+ssh://git@gitea.detee.cloud/testnet/proto.git?branch=remove_uuid#6765cafd68664dcfa269dd776039532eb4253e8a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"prost",
|
"prost",
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "detee-cli"
|
name = "detee-cli"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
218
LICENSE
218
LICENSE
@ -1,202 +1,24 @@
|
|||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
Apache License
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
Version 2.0, January 2004
|
distribute this software, either in source code form or as a compiled
|
||||||
http://www.apache.org/licenses/
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
1. Definitions.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
For more information, please refer to <https://unlicense.org/>
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<!--
|
<!--
|
||||||
SPDX-License-Identifier: Apache-2.0
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
SPDX-License-Identifier: Unlicense
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# DeTEE CLI
|
# DeTEE CLI
|
||||||
|
1
build.rs
1
build.rs
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use shadow_rs::ShadowBuilder;
|
use shadow_rs::ShadowBuilder;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
from archlinux:latest
|
from archlinux:latest
|
||||||
copy tmp/.detee /root/.detee
|
copy tmp/.detee /root/.detee
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
||||||
scriptdir="$(pwd)"
|
scriptdir="$(pwd)"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
reorder_impl_items = true
|
reorder_impl_items = true
|
||||||
use_small_heuristics = "Max"
|
use_small_heuristics = "Max"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
dtrfs_url: http://registry.detee.ltd/dtrfs-payments2025-01-23.cpio.gz
|
dtrfs_url: http://registry.detee.ltd/dtrfs-payments2025-01-23.cpio.gz
|
||||||
dtrfs_sha: 2e95d7969a0f2ae2ee6f37acd2789a032be1653e76ba93e607477c8b1cde42ed
|
dtrfs_sha: 2e95d7969a0f2ae2ee6f37acd2789a032be1653e76ba93e607477c8b1cde42ed
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
node_pubkey: 3mWjE6FnKQ8f9WRjGHdj1Jtyewsri87GXQpqLWpwtjhr
|
node_pubkey: 3mWjE6FnKQ8f9WRjGHdj1Jtyewsri87GXQpqLWpwtjhr
|
||||||
package_url: https://registry.detee.ltd/sgx/packages/actix-app-info_package_2025-03-19_13-49-56.tar.gz
|
package_url: https://registry.detee.ltd/sgx/packages/actix-app-info_package_2025-03-19_13-49-56.tar.gz
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
environments:
|
environments:
|
||||||
- name: APP_NAME
|
- name: APP_NAME
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
hostname: my-specific-vm-01
|
hostname: my-specific-vm-01
|
||||||
price: 20000
|
price: 20000
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
hostname: my-vm-01
|
hostname: my-vm-01
|
||||||
hours: 5
|
hours: 5
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
hostname: my-public-vm-01
|
hostname: my-public-vm-01
|
||||||
hours: 5
|
hours: 5
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
hostname: my-bucharest-vm-01
|
hostname: my-bucharest-vm-01
|
||||||
hours: 5
|
hours: 5
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
# SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
|
||||||
scriptdir="$(pwd)"
|
scriptdir="$(pwd)"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use clap::builder::PossibleValue;
|
use clap::builder::PossibleValue;
|
||||||
use clap::{Arg, Command};
|
use clap::{Arg, Command};
|
||||||
@ -148,7 +149,7 @@ fn clap_cmd() -> Command {
|
|||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("port")
|
Arg::new("port")
|
||||||
.long("port")
|
.long("expose-port")
|
||||||
.value_parser(clap::value_parser!(u32).range(0..65535))
|
.value_parser(clap::value_parser!(u32).range(0..65535))
|
||||||
.action(clap::ArgAction::Append)
|
.action(clap::ArgAction::Append)
|
||||||
.help("Application exposing port")
|
.help("Application exposing port")
|
||||||
@ -394,6 +395,16 @@ fn clap_cmd() -> Command {
|
|||||||
.long("public-ip")
|
.long("public-ip")
|
||||||
.help("get a public IPv4 address for this VM")
|
.help("get a public IPv4 address for this VM")
|
||||||
.action(clap::ArgAction::SetTrue)
|
.action(clap::ArgAction::SetTrue)
|
||||||
|
.conflicts_with("port")
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("port")
|
||||||
|
.long("expose-port")
|
||||||
|
.value_parser(clap::value_parser!(u32).range(0..65535))
|
||||||
|
.action(clap::ArgAction::Append)
|
||||||
|
.help("vm exposing port")
|
||||||
|
.long_help("Port to expose on the vm which mapped into the host's public IP's port")
|
||||||
|
.conflicts_with("public-ip")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.subcommand(Command::new("inspect").about("list all available information about a VM")
|
.subcommand(Command::new("inspect").about("list all available information about a VM")
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use clap::{Arg, ArgMatches, Command};
|
use clap::{Arg, ArgMatches, Command};
|
||||||
use clap_complete::{generate, Shell};
|
use clap_complete::{generate, Shell};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::constants::{BRAIN_STAGING, BRAIN_TESTING};
|
use crate::constants::{BRAIN_STAGING, BRAIN_TESTING, CONFIG_OVERRIDE_PATH_ENV};
|
||||||
use crate::general;
|
use crate::general;
|
||||||
use crate::utils::block_on;
|
use crate::utils::block_on;
|
||||||
use ed25519_dalek::SigningKey;
|
use ed25519_dalek::SigningKey;
|
||||||
@ -187,7 +188,9 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn cli_dir_path() -> Result<String, Error> {
|
pub fn cli_dir_path() -> Result<String, Error> {
|
||||||
let dir = Self::home_dir() + ("/.detee/cli");
|
let dir = std::env::var(CONFIG_OVERRIDE_PATH_ENV)
|
||||||
|
.unwrap_or_else(|_| Self::home_dir() + ("/.detee/cli"));
|
||||||
|
|
||||||
if !Path::new(&dir).exists() {
|
if !Path::new(&dir).exists() {
|
||||||
warn!("Could not config dir. Creating {dir}");
|
warn!("Could not config dir. Creating {dir}");
|
||||||
std::fs::create_dir_all(dir.clone())?;
|
std::fs::create_dir_all(dir.clone())?;
|
||||||
@ -196,29 +199,13 @@ impl Config {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn config_path() -> Result<String, Error> {
|
fn config_path() -> Result<String, Error> {
|
||||||
match std::env::var("DETEE_API_USER_PATH") {
|
let config_path = Self::cli_dir_path()? + ("/cli-config.yaml");
|
||||||
Ok(user_path) => {
|
Ok(config_path)
|
||||||
let config_path = format!("{user_path}/cli-config.yaml");
|
|
||||||
Ok(config_path)
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
let config_path = Self::cli_dir_path()? + ("/cli-config.yaml");
|
|
||||||
Ok(config_path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn detee_wallet_key_path() -> Result<String, Error> {
|
fn detee_wallet_key_path() -> Result<String, Error> {
|
||||||
match std::env::var("DETEE_API_USER_PATH") {
|
let config_path = Self::cli_dir_path()? + ("/secret_detee_wallet_key");
|
||||||
Ok(user_path) => {
|
Ok(config_path)
|
||||||
let config_path = format!("{user_path}/secret_detee_wallet_key");
|
|
||||||
Ok(config_path)
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
let config_path = Self::cli_dir_path()? + ("/secret_detee_wallet_key");
|
|
||||||
Ok(config_path)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_config_from_file() -> Result<Self, Error> {
|
fn load_config_from_file() -> Result<Self, Error> {
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use std::sync::LazyLock;
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
pub const HRATLS_APP_PORT: u32 = 34500;
|
pub const HRATLS_APP_PORT: u32 = 34500;
|
||||||
pub const MAX_REDIRECTS: u16 = 3;
|
pub const MAX_REDIRECTS: u16 = 3;
|
||||||
|
pub const CONFIG_OVERRIDE_PATH_ENV: &str = "DETEE_API_USER_PATH";
|
||||||
|
pub const CLI_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
pub const STAGING_BRAIN_URLS: [&str; 3] = [
|
pub const STAGING_BRAIN_URLS: [&str; 3] = [
|
||||||
"https://156.146.63.216:31337", // staging brain 1
|
"https://156.146.63.216:31337", // staging brain 1
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use super::{operators, packagers};
|
use super::{operators, packagers};
|
||||||
use crate::{cli_print, config};
|
use crate::{cli_print, config};
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::snp::grpc::proto::VmContract;
|
use crate::snp::grpc::proto::VmContract;
|
||||||
use crate::utils::sign_request;
|
use crate::utils::sign_request;
|
||||||
use detee_shared::general_proto::ReportNodeReq;
|
use detee_shared::general_proto::{RecommendedVersions, ReportNodeReq};
|
||||||
use log::{debug, info, warn};
|
use log::{debug, info, warn};
|
||||||
use tokio_stream::StreamExt;
|
use tokio_stream::StreamExt;
|
||||||
use tonic::transport::Channel;
|
use tonic::transport::Channel;
|
||||||
@ -86,7 +87,9 @@ pub async fn list_operators() -> Result<Vec<ListOperatorsResp>, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn kick_contract(contract_id: String, reason: String) -> Result<u64, Error> {
|
pub async fn kick_contract(contract_id: String, reason: String) -> Result<u64, Error> {
|
||||||
debug!("gRPC module: connecting to brain and kicking contract {contract_id} for reason: {reason}");
|
debug!(
|
||||||
|
"gRPC module: connecting to brain and kicking contract {contract_id} for reason: {reason}"
|
||||||
|
);
|
||||||
Ok(client()
|
Ok(client()
|
||||||
.await?
|
.await?
|
||||||
.kick_contract(sign_request(KickReq {
|
.kick_contract(sign_request(KickReq {
|
||||||
@ -180,3 +183,7 @@ pub async fn admin_slash(pubkey: String, tokens: u64) -> Result<(), Error> {
|
|||||||
let _ = client().await?.slash(req).await?;
|
let _ = client().await?.slash(req).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn get_versions() -> Result<RecommendedVersions, Error> {
|
||||||
|
Ok(client().await?.get_recommended_versions(Empty {}).await?.into_inner())
|
||||||
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
pub mod cli_handler;
|
pub mod cli_handler;
|
||||||
pub mod grpc;
|
pub mod grpc;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::general::grpc;
|
use crate::general::grpc;
|
||||||
use crate::utils::block_on;
|
use crate::utils::block_on;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use tabled::Tabled;
|
use tabled::Tabled;
|
||||||
|
18
src/lib.rs
18
src/lib.rs
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod constants;
|
pub mod constants;
|
||||||
@ -10,6 +11,10 @@ pub mod utils;
|
|||||||
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
|
use crate::constants::CLI_VERSION;
|
||||||
|
use crate::general::grpc::get_versions;
|
||||||
|
use crate::utils::block_on;
|
||||||
|
|
||||||
pub trait HumanOutput {
|
pub trait HumanOutput {
|
||||||
fn human_cli_print(&self);
|
fn human_cli_print(&self);
|
||||||
}
|
}
|
||||||
@ -36,6 +41,19 @@ pub fn cli_print<T: HumanOutput + serde::Serialize>(output: Result<T, Box<dyn st
|
|||||||
Ok(output) => output,
|
Ok(output) => output,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Error: {e}");
|
println!("Error: {e}");
|
||||||
|
match block_on(get_versions()) {
|
||||||
|
Ok(versions) => {
|
||||||
|
if CLI_VERSION != versions.cli {
|
||||||
|
log::error!(
|
||||||
|
"The brain recommends the CLI version {}, but the local version is {}",
|
||||||
|
versions.cli,
|
||||||
|
CLI_VERSION
|
||||||
|
);
|
||||||
|
println!("Please upgrade the CLI to the latest docker image: detee/detee-cli:latest")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => log::warn!("Could not get recommended CLI version from the brain: {e}"),
|
||||||
|
};
|
||||||
std::process::exit(1);
|
std::process::exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::name_generator::random_app_name;
|
use crate::name_generator::random_app_name;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use detee_shared::sgx::types::brain::AppDeployConfig;
|
use detee_shared::sgx::types::brain::AppDeployConfig;
|
||||||
use detee_shared::sgx::types::dtpm::DtpmConfig;
|
use detee_shared::sgx::types::dtpm::DtpmConfig;
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::name_generator::random_app_name;
|
use crate::name_generator::random_app_name;
|
||||||
use crate::sgx::grpc_brain::{get_app_node_list, new_app};
|
use crate::sgx::grpc_brain::{get_app_node_list, new_app};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use detee_shared::app_proto::brain_app_cli_client::BrainAppCliClient;
|
use detee_shared::app_proto::brain_app_cli_client::BrainAppCliClient;
|
||||||
use detee_shared::app_proto::{
|
use detee_shared::app_proto::{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use detee_sgx::prelude::*;
|
use detee_sgx::prelude::*;
|
||||||
use detee_sgx::HRaTlsConfigBuilder;
|
use detee_sgx::HRaTlsConfigBuilder;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
pub mod cli_handler;
|
pub mod cli_handler;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::constants::HRATLS_APP_PORT;
|
use crate::constants::HRATLS_APP_PORT;
|
||||||
use crate::sgx::{get_one_contract, Error};
|
use crate::sgx::{get_one_contract, Error};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::{cli_print, general, name_generator, snp, SimpleOutput};
|
use crate::{cli_print, general, name_generator, snp, SimpleOutput};
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
@ -63,8 +64,13 @@ fn handle_vm_deploy(matches: &ArgMatches) -> Result<snp::VmSshArgs, Box<dyn Erro
|
|||||||
let location = matches.get_one::<String>("location").unwrap().as_str();
|
let location = matches.get_one::<String>("location").unwrap().as_str();
|
||||||
let ipv4: crate::snp::deploy::IPv4Config = match matches.get_one::<bool>("public-ip").unwrap() {
|
let ipv4: crate::snp::deploy::IPv4Config = match matches.get_one::<bool>("public-ip").unwrap() {
|
||||||
true => crate::snp::deploy::IPv4Config::PublicIPv4,
|
true => crate::snp::deploy::IPv4Config::PublicIPv4,
|
||||||
false => crate::snp::deploy::IPv4Config::PublishPorts(Vec::new()),
|
false => {
|
||||||
|
let exposing_port =
|
||||||
|
matches.get_many::<u32>("port").unwrap_or_default().cloned().collect::<Vec<_>>();
|
||||||
|
crate::snp::deploy::IPv4Config::PublishPorts(exposing_port)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let distro =
|
let distro =
|
||||||
crate::snp::Distro::from_string(matches.get_one::<String>("distribution").unwrap());
|
crate::snp::Distro::from_string(matches.get_one::<String>("distribution").unwrap());
|
||||||
let vm_config = snp::deploy::Request {
|
let vm_config = snp::deploy::Request {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use std::u64::MAX;
|
use std::u64::MAX;
|
||||||
|
|
||||||
@ -168,7 +169,7 @@ impl Request {
|
|||||||
node_pubkey: &str,
|
node_pubkey: &str,
|
||||||
offer: &proto::VmNodeOffer,
|
offer: &proto::VmNodeOffer,
|
||||||
) -> Option<proto::NewVmReq> {
|
) -> Option<proto::NewVmReq> {
|
||||||
if offer.vcpus == 0 {
|
if offer.vcpus == 0 || offer.memory_mib == 0 || offer.disk_mib == 0 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let memory_per_cpu = offer.memory_mib / offer.vcpus;
|
let memory_per_cpu = offer.memory_mib / offer.vcpus;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
pub mod proto {
|
pub mod proto {
|
||||||
pub use detee_shared::general_proto::*;
|
pub use detee_shared::general_proto::*;
|
||||||
@ -8,7 +9,6 @@ pub mod proto {
|
|||||||
use crate::call_with_follow_redirect;
|
use crate::call_with_follow_redirect;
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::utils::{self, sign_request};
|
use crate::utils::{self, sign_request};
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use log::{debug, info, warn};
|
use log::{debug, info, warn};
|
||||||
use proto::brain_vm_cli_client::BrainVmCliClient;
|
use proto::brain_vm_cli_client::BrainVmCliClient;
|
||||||
use proto::{
|
use proto::{
|
||||||
@ -19,14 +19,6 @@ use tokio_stream::StreamExt;
|
|||||||
use tonic::metadata::errors::InvalidMetadataValue;
|
use tonic::metadata::errors::InvalidMetadataValue;
|
||||||
use tonic::transport::Channel;
|
use tonic::transport::Channel;
|
||||||
|
|
||||||
lazy_static! {
|
|
||||||
static ref SECURE_PUBLIC_KEY: String = use_default_string();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn use_default_string() -> String {
|
|
||||||
"ThisIsMyEternalClient".to_string()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug)]
|
#[derive(thiserror::Error, Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("Failed to connect to the brain: {0}")]
|
#[error("Failed to connect to the brain: {0}")]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::snp::grpc::proto;
|
use crate::snp::grpc::proto;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
pub mod cli_handler;
|
pub mod cli_handler;
|
||||||
pub mod deploy;
|
pub mod deploy;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use super::grpc::{self, proto};
|
use super::grpc::{self, proto};
|
||||||
use super::{injector, Dtrfs, Error};
|
use super::{injector, Dtrfs, Error};
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
// SPDX-License-Identifier: Unlicense
|
||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use tonic::metadata::errors::InvalidMetadataValue;
|
use tonic::metadata::errors::InvalidMetadataValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user