cargo-fix p1

This commit is contained in:
core 2023-03-28 20:42:36 -04:00
parent 05d452bc50
commit 8858fbb9cf
Signed by: core
GPG Key ID: FDBF740DADDCEECF
7 changed files with 23 additions and 13 deletions

3
.gitignore vendored
View File

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

View File

@ -3,7 +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;
@ -17,7 +17,7 @@ pub enum APIWorkerMessage {
Enroll { code: String } Enroll { code: String }
} }
pub fn apiworker_main(config: TFClientConfig, instance: String, url: String, _transmitters: ThreadMessageSender, rx: Receiver<APIWorkerMessage>) { pub fn apiworker_main(_config: TFClientConfig, instance: String, url: String, _transmitters: ThreadMessageSender, rx: Receiver<APIWorkerMessage>) {
let server = Url::parse(&url).unwrap(); let server = Url::parse(&url).unwrap();
// Generate dhPubkey and edPubkey if it doesn't exist // Generate dhPubkey and edPubkey if it doesn't exist

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::util::check_server_url; use crate::util::check_server_url;

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;

View File

@ -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"