1
0
Fork 0

Refactor proto package + bin names

This commit is contained in:
Florian RICHER 2023-01-31 19:38:48 +01:00
parent e46fe9db87
commit 2b028c694f
9 changed files with 15 additions and 15 deletions

View file

@ -11,12 +11,12 @@ name = "libcommand"
path = "src/lib.rs"
[[bin]]
name = "daemon"
name = "gtwyd"
path = "src/daemon/main.rs"
[[bin]]
name = "client"
path = "src/client/main.rs"
name = "gtwy_interpreter"
path = "src/interpreter/main.rs"
[dependencies]
serde = { version = "1.0", features = ["derive"] }

View file

@ -5,21 +5,21 @@ RUN apt update && apt install openssh-server curl build-essential protobuf-compi
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN useradd -rm -d /home/test -s /opt/gateway/target/release/client test
RUN useradd -rm -d /home/test -s /opt/gateway/target/release/gtwy_interpreter test
RUN echo 'test:test' | chpasswd
# Build project binaries
COPY . /opt/gateway
WORKDIR /opt/gateway
RUN cargo build --release --bin daemon
RUN cargo build --release --bin client
RUN cargo build --release --bin gtwyd
RUN cargo build --release --bin gtwy_interpreter
RUN mkdir -p /var/run
RUN chmod ugo+rx /var
RUN chmod ugo+rwx /var/run
RUN echo '#!/bin/sh\n\
/usr/sbin/sshd -D&\n\
su - test -s /bin/sh -c "/opt/gateway/target/release/daemon"' > /opt/startup.sh
su - test -s /bin/sh -c "/opt/gateway/target/release/gtwyd"' > /opt/startup.sh
RUN chmod +x /opt/startup.sh

View file

@ -1,4 +1,4 @@
fn main() -> Result<(), Box<dyn std::error::Error>> {
tonic_build::compile_protos("proto/internal.proto")?;
tonic_build::compile_protos("proto/interpreter.proto")?;
Ok(())
}

View file

@ -1,5 +1,5 @@
syntax = "proto3";
package internal;
package interpreter;
service Unix {
// Message send by the command gateway to the daemon

View file

@ -9,7 +9,7 @@ use tokio::net::UnixListener;
use tokio_stream::wrappers::UnixListenerStream;
use tonic::transport::Server;
use libcommand::internal::unix_server::UnixServer;
use libcommand::interpreter::unix_server::UnixServer;
#[cfg(unix)]
#[tokio::main]

View file

@ -2,7 +2,7 @@
use tonic::{Request, Response, Status};
use libcommand::internal::{
use libcommand::interpreter::{
unix_server::Unix,
AuthorizeRequest, AuthorizeResponse, AuthorizationStatus,
TerminateRequest, TerminateResponse, TerminateStatus

View file

@ -1,4 +1,4 @@
use libcommand::internal::unix_client::UnixClient;
use libcommand::interpreter::unix_client::UnixClient;
#[cfg(unix)]
use tokio::net::UnixStream;

View file

@ -2,7 +2,7 @@
pub mod client;
use libcommand::internal::{AuthorizationStatus, AuthorizeRequest, AuthorizeResponse};
use libcommand::interpreter::{AuthorizationStatus, AuthorizeRequest, AuthorizeResponse};
use tonic::Response;
#[cfg(unix)]

View file

@ -3,8 +3,8 @@ use serde::{Serialize, Deserialize};
pub const SOCK_FILE : &'static str = "/var/run/command_gateway.sock";
pub mod internal {
tonic::include_proto!("internal");
pub mod interpreter {
tonic::include_proto!("interpreter");
}
#[derive(Serialize, Deserialize, Debug)]