surreal_brain_app #3
6
build.rs
6
build.rs
@ -7,11 +7,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
".vm_proto.MappedPort",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
".app_proto.MappedPort",
|
||||
".common_proto.MappedPort",
|
||||
"#[derive(serde::Serialize, serde::Deserialize)]",
|
||||
)
|
||||
.type_attribute(
|
||||
|
@ -11,7 +11,7 @@ message AppContract {
|
||||
string node_pubkey = 4;
|
||||
string public_ipv4 = 5;
|
||||
AppResource resource = 6;
|
||||
repeated MappedPort mapped_ports = 7;
|
||||
repeated common_proto.MappedPort mapped_ports = 7;
|
||||
string created_at = 8;
|
||||
string updated_at = 9;
|
||||
uint64 nano_per_minute = 10;
|
||||
@ -46,14 +46,10 @@ message NewAppRes {
|
||||
string uuid = 1;
|
||||
string status = 2;
|
||||
string ip_address = 3;
|
||||
repeated MappedPort mapped_ports = 4;
|
||||
repeated common_proto.MappedPort mapped_ports = 4;
|
||||
string error = 5;
|
||||
}
|
||||
|
||||
message MappedPort {
|
||||
uint32 host_port = 1;
|
||||
uint32 app_port = 2;
|
||||
}
|
||||
|
||||
message DelAppReq {
|
||||
string uuid= 1;
|
||||
|
@ -7,3 +7,8 @@ message Empty {
|
||||
message Pubkey {
|
||||
string pubkey = 1;
|
||||
}
|
||||
|
||||
message MappedPort {
|
||||
uint32 host_port = 1;
|
||||
uint32 guest_port = 2;
|
||||
}
|
||||
|
@ -3,11 +3,6 @@ package vm_proto;
|
||||
|
||||
import "shared/common.proto";
|
||||
|
||||
message MappedPort {
|
||||
uint32 host_port = 1;
|
||||
uint32 guest_port = 2;
|
||||
}
|
||||
|
||||
message VmContract {
|
||||
string uuid = 1;
|
||||
string hostname = 2;
|
||||
@ -15,7 +10,7 @@ message VmContract {
|
||||
string node_pubkey = 4;
|
||||
string node_ip = 5;
|
||||
string location = 6;
|
||||
repeated MappedPort mapped_ports = 7;
|
||||
repeated common_proto.MappedPort mapped_ports = 7;
|
||||
string vm_public_ipv4 = 8;
|
||||
string vm_public_ipv6 = 9;
|
||||
uint32 disk_size_gb = 10;
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::app_proto::{daemon_message_app, AppNodeResources, DaemonMessageApp};
|
||||
use crate::app_proto::{AppResource, DaemonAuth, MappedPort, NewAppReq, NewAppRes};
|
||||
use crate::app_proto::{AppResource, DaemonAuth, NewAppReq, NewAppRes};
|
||||
use crate::common_proto::MappedPort;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
|
||||
@ -93,14 +94,14 @@ impl From<(u16, u16)> for MappedPort {
|
||||
fn from(val: (u16, u16)) -> Self {
|
||||
Self {
|
||||
host_port: val.0 as u32,
|
||||
app_port: val.1 as u32,
|
||||
guest_port: val.1 as u32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<MappedPort> for (u16, u16) {
|
||||
fn from(val: MappedPort) -> Self {
|
||||
(val.host_port as u16, val.app_port as u16)
|
||||
(val.host_port as u16, val.guest_port as u16)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user