diff --git a/.gitignore b/.gitignore index 1de5659..3208d77 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -target \ No newline at end of file +target +pg_data \ No newline at end of file diff --git a/tfclient/src/apiworker.rs b/tfclient/src/apiworker.rs index 3eacefe..1a9035a 100644 --- a/tfclient/src/apiworker.rs +++ b/tfclient/src/apiworker.rs @@ -3,7 +3,7 @@ use base64::Engine; use chrono::Local; use log::{error, info, warn}; use url::Url; -use trifid_pki::ca::NebulaCAPool; + use trifid_pki::cert::{serialize_ed25519_public, serialize_x25519_public}; use trifid_pki::ed25519_dalek::{SecretKey, SigningKey}; use trifid_pki::rand_core::OsRng; @@ -17,7 +17,7 @@ pub enum APIWorkerMessage { Enroll { code: String } } -pub fn apiworker_main(config: TFClientConfig, instance: String, url: String, _transmitters: ThreadMessageSender, rx: Receiver) { +pub fn apiworker_main(_config: TFClientConfig, instance: String, url: String, _transmitters: ThreadMessageSender, rx: Receiver) { let server = Url::parse(&url).unwrap(); // Generate dhPubkey and edPubkey if it doesn't exist diff --git a/tfclient/src/config.rs b/tfclient/src/config.rs index f65831e..9d86a0b 100644 --- a/tfclient/src/config.rs +++ b/tfclient/src/config.rs @@ -1,12 +1,12 @@ -use std::collections::HashMap; + use std::error::Error; use std::fs; -use std::net::{Ipv4Addr, SocketAddrV4}; -use ipnet::Ipv4Net; + + use log::{debug, info}; use serde::{Deserialize, Serialize}; -use trifid_pki::ca::NebulaCAPool; -use crate::dirs::{get_cdata_dir, get_cdata_file, get_config_dir, get_config_file, get_data_dir}; + +use crate::dirs::{get_cdata_dir, get_cdata_file, get_config_dir, get_config_file}; pub const DEFAULT_PORT: u16 = 8157; fn default_port() -> u16 { DEFAULT_PORT } diff --git a/tfclient/src/daemon.rs b/tfclient/src/daemon.rs index 052efc8..06019f6 100644 --- a/tfclient/src/daemon.rs +++ b/tfclient/src/daemon.rs @@ -5,7 +5,7 @@ use log::{error, info}; use crate::apiworker::{apiworker_main, APIWorkerMessage}; use crate::config::load_config; -use crate::main; + use crate::nebulaworker::{nebulaworker_main, NebulaWorkerMessage}; use crate::socketworker::{socketworker_main, SocketWorkerMessage}; use crate::util::check_server_url; diff --git a/tfclient/src/socketclient.rs b/tfclient/src/socketclient.rs index 5ce1337..62e0449 100644 --- a/tfclient/src/socketclient.rs +++ b/tfclient/src/socketclient.rs @@ -1,5 +1,5 @@ use std::error::Error; -use std::io::{BufRead, BufReader, BufWriter, Write}; +use std::io::{BufRead, BufReader, Write}; use std::net::{IpAddr, SocketAddr, TcpStream}; use log::{error, info}; use crate::config::TFClientConfig; @@ -8,7 +8,7 @@ use crate::socketworker::{ctob, DisconnectReason, JSON_API_VERSION, JsonMessage} pub fn enroll(code: &str, config: &TFClientConfig) -> Result<(), Box> { info!("Connecting to local command socket..."); let mut stream = TcpStream::connect(SocketAddr::new(IpAddr::from([127, 0, 0, 1]), config.listen_port))?; - let mut stream2 = stream.try_clone()?; + let stream2 = stream.try_clone()?; let mut reader = BufReader::new(&stream2); info!("Sending Hello..."); diff --git a/tfclient/src/socketworker.rs b/tfclient/src/socketworker.rs index 389edb8..7a7e831 100644 --- a/tfclient/src/socketworker.rs +++ b/tfclient/src/socketworker.rs @@ -2,10 +2,10 @@ use std::error::Error; use std::{io, thread}; -use std::io::{BufRead, BufReader, BufWriter, Read, Write}; +use std::io::{BufRead, BufReader, BufWriter, Write}; use std::net::{IpAddr, Shutdown, SocketAddr, TcpListener, TcpStream}; use std::sync::mpsc::{Receiver, TryRecvError}; -use clap::builder::Str; + use log::{debug, error, info, trace, warn}; use serde::{Deserialize, Serialize}; use crate::apiworker::APIWorkerMessage; diff --git a/trifid-api/docker-compose.yml b/trifid-api/docker-compose.yml new file mode 100644 index 0000000..9f37e27 --- /dev/null +++ b/trifid-api/docker-compose.yml @@ -0,0 +1,9 @@ +# This is a docker-compose file to fire up a dev database with some persistence. +version: '3' +services: + postgres: + image: postgres + ports: + - "5432:5432" + volumes: + - "../pg_data:/var/lib/postgresql/data" \ No newline at end of file