Refactor proto package + bin names
This commit is contained in:
parent
e46fe9db87
commit
2b028c694f
9 changed files with 15 additions and 15 deletions
|
@ -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"] }
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
2
build.rs
2
build.rs
|
@ -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(())
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
syntax = "proto3";
|
||||
package internal;
|
||||
package interpreter;
|
||||
|
||||
service Unix {
|
||||
// Message send by the command gateway to the daemon
|
|
@ -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]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use tonic::{Request, Response, Status};
|
||||
|
||||
use libcommand::internal::{
|
||||
use libcommand::interpreter::{
|
||||
unix_server::Unix,
|
||||
AuthorizeRequest, AuthorizeResponse, AuthorizationStatus,
|
||||
TerminateRequest, TerminateResponse, TerminateStatus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use libcommand::internal::unix_client::UnixClient;
|
||||
use libcommand::interpreter::unix_client::UnixClient;
|
||||
|
||||
#[cfg(unix)]
|
||||
use tokio::net::UnixStream;
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
pub mod client;
|
||||
|
||||
use libcommand::internal::{AuthorizationStatus, AuthorizeRequest, AuthorizeResponse};
|
||||
use libcommand::interpreter::{AuthorizationStatus, AuthorizeRequest, AuthorizeResponse};
|
||||
use tonic::Response;
|
||||
|
||||
#[cfg(unix)]
|
|
@ -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)]
|
||||
|
|
Reference in a new issue