mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
wip: Starting down the bind for the effects
todo: complete a ip todo chore: Fix the result type on something todo: Address returning chore: JS with callbacks chore: Add in the chown and permissions chore: Add in the binds and unbinds in
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use color_eyre::eyre::eyre;
|
||||
use models::Error;
|
||||
use color_eyre::Report;
|
||||
use models::PackageId;
|
||||
use models::{Error, InterfaceId};
|
||||
use serde_json::Value;
|
||||
|
||||
pub struct RuntimeDropped;
|
||||
@@ -13,6 +14,28 @@ fn method_not_available() -> Error {
|
||||
models::ErrorKind::InvalidRequest,
|
||||
)
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AddressSchemaOnion {
|
||||
pub id: InterfaceId,
|
||||
pub external_port: u16,
|
||||
}
|
||||
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct AddressSchemaLocal {
|
||||
pub id: InterfaceId,
|
||||
pub external_port: u16,
|
||||
}
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Address(pub String);
|
||||
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Domain;
|
||||
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Name;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
#[allow(unused_variables)]
|
||||
@@ -22,7 +45,47 @@ pub trait OsApi: Send + Sync + 'static {
|
||||
id: PackageId,
|
||||
path: &str,
|
||||
callback: Callback,
|
||||
) -> Result<Value, Error> {
|
||||
Err(method_not_available())
|
||||
) -> Result<Value, Report>;
|
||||
|
||||
async fn bind_local(
|
||||
&self,
|
||||
internal_port: u16,
|
||||
address_schema: AddressSchemaLocal,
|
||||
) -> Result<Address, Report>;
|
||||
async fn bind_onion(
|
||||
&self,
|
||||
internal_port: u16,
|
||||
address_schema: AddressSchemaOnion,
|
||||
) -> Result<Address, Report>;
|
||||
|
||||
async fn unbind_local(&self, id: InterfaceId, external: u16) -> Result<(), Report> {
|
||||
todo!()
|
||||
}
|
||||
async fn unbind_onion(&self, id: InterfaceId, external: u16) -> Result<(), Report> {
|
||||
todo!()
|
||||
}
|
||||
async fn list_address(&self) -> Result<Vec<Address>, Report> {
|
||||
todo!()
|
||||
}
|
||||
async fn list_domains(&self) -> Result<Vec<Domain>, Report> {
|
||||
todo!()
|
||||
}
|
||||
async fn alloc_onion(&self, id: String) -> Result<Name, Report> {
|
||||
todo!()
|
||||
}
|
||||
async fn dealloc_onion(&self, id: String) -> Result<(), Report> {
|
||||
todo!()
|
||||
}
|
||||
async fn alloc_local(&self, id: String) -> Result<Name, Report> {
|
||||
todo!()
|
||||
}
|
||||
async fn dealloc_local(&self, id: String) -> Result<(), Report> {
|
||||
todo!()
|
||||
}
|
||||
async fn alloc_forward(&self, id: String) -> Result<u16, Report> {
|
||||
todo!()
|
||||
}
|
||||
async fn dealloc_forward(&self, id: String) -> Result<(), Report> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,6 +70,9 @@ impl Rsync {
|
||||
for exclude in options.exclude {
|
||||
cmd.arg(format!("--exclude={}", exclude));
|
||||
}
|
||||
if options.no_permissions {
|
||||
cmd.arg("--no-perms");
|
||||
}
|
||||
let mut command = cmd
|
||||
.arg("-acAXH")
|
||||
.arg("--info=progress2")
|
||||
|
||||
Reference in New Issue
Block a user