Merge remote-tracking branch 'origin/feat-tfclient' into feat-tfclient

# Conflicts:
#	tfclient/src/apiworker.rs
This commit is contained in:
c0repwn3r 2023-03-29 09:38:41 -04:00
commit b6940ba0f3
Signed by: core
GPG Key ID: FDBF740DADDCEECF
6 changed files with 13 additions and 11 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
target target
pg_data

View File

@ -3,6 +3,7 @@ use base64::Engine;
use chrono::Local; use chrono::Local;
use log::{error, info, warn}; use log::{error, info, warn};
use url::Url; use url::Url;
use trifid_pki::ca::NebulaCAPool;
use trifid_pki::cert::{serialize_ed25519_public, serialize_x25519_public}; use trifid_pki::cert::{serialize_ed25519_public, serialize_x25519_public};
use trifid_pki::ed25519_dalek::{SecretKey, SigningKey}; use trifid_pki::ed25519_dalek::{SecretKey, SigningKey};
use trifid_pki::rand_core::OsRng; use trifid_pki::rand_core::OsRng;

View File

@ -1,12 +1,12 @@
use std::collections::HashMap;
use std::error::Error; use std::error::Error;
use std::fs; use std::fs;
use std::net::{Ipv4Addr, SocketAddrV4};
use ipnet::Ipv4Net;
use log::{debug, info}; use log::{debug, info};
use serde::{Deserialize, Serialize}; 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; pub const DEFAULT_PORT: u16 = 8157;
fn default_port() -> u16 { DEFAULT_PORT } fn default_port() -> u16 { DEFAULT_PORT }

View File

@ -5,7 +5,7 @@ use log::{error, info};
use crate::apiworker::{apiworker_main, APIWorkerMessage}; use crate::apiworker::{apiworker_main, APIWorkerMessage};
use crate::config::load_config; use crate::config::load_config;
use crate::main;
use crate::nebulaworker::{nebulaworker_main, NebulaWorkerMessage}; use crate::nebulaworker::{nebulaworker_main, NebulaWorkerMessage};
use crate::socketworker::{socketworker_main, SocketWorkerMessage}; use crate::socketworker::{socketworker_main, SocketWorkerMessage};
use crate::timerworker::{timer_main, TimerWorkerMessage}; use crate::timerworker::{timer_main, TimerWorkerMessage};

View File

@ -1,5 +1,5 @@
use std::error::Error; use std::error::Error;
use std::io::{BufRead, BufReader, BufWriter, Write}; use std::io::{BufRead, BufReader, Write};
use std::net::{IpAddr, SocketAddr, TcpStream}; use std::net::{IpAddr, SocketAddr, TcpStream};
use log::{error, info}; use log::{error, info};
use crate::config::TFClientConfig; 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<dyn Error>> { pub fn enroll(code: &str, config: &TFClientConfig) -> Result<(), Box<dyn Error>> {
info!("Connecting to local command socket..."); info!("Connecting to local command socket...");
let mut stream = TcpStream::connect(SocketAddr::new(IpAddr::from([127, 0, 0, 1]), config.listen_port))?; 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); let mut reader = BufReader::new(&stream2);
info!("Sending Hello..."); info!("Sending Hello...");

View File

@ -2,10 +2,10 @@
use std::error::Error; use std::error::Error;
use std::{io, thread}; 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::net::{IpAddr, Shutdown, SocketAddr, TcpListener, TcpStream};
use std::sync::mpsc::{Receiver, TryRecvError}; use std::sync::mpsc::{Receiver, TryRecvError};
use clap::builder::Str;
use log::{debug, error, info, trace, warn}; use log::{debug, error, info, trace, warn};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::apiworker::APIWorkerMessage; use crate::apiworker::APIWorkerMessage;