chore: clippy
This commit is contained in:
parent
2370204546
commit
91cf173058
@ -1,5 +1,4 @@
|
||||
use anyhow::Error;
|
||||
use chrono::Utc;
|
||||
use clap::Parser;
|
||||
use config::{Config, File};
|
||||
use fedimint_tonic_lnd::connect;
|
||||
|
@ -69,6 +69,12 @@ struct MempoolRates {
|
||||
pub eur: Option<f32>,
|
||||
}
|
||||
|
||||
impl Default for ExchangeRateCache {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl ExchangeRateCache {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use anyhow::{anyhow, bail, Result};
|
||||
use log::{debug, error, info};
|
||||
use log::debug;
|
||||
use reqwest::{ClientBuilder, Method, Url};
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -5,8 +5,8 @@ pub mod host;
|
||||
pub mod invoice;
|
||||
pub mod nip98;
|
||||
pub mod provisioner;
|
||||
pub mod router;
|
||||
pub mod settings;
|
||||
pub mod ssh_client;
|
||||
pub mod status;
|
||||
pub mod worker;
|
||||
pub mod router;
|
||||
pub mod ssh_client;
|
||||
|
@ -1,8 +1,8 @@
|
||||
use crate::exchange::{ExchangeRateCache, Ticker};
|
||||
use crate::host::get_host_client;
|
||||
use crate::host::proxmox::{
|
||||
ConfigureVm, CreateVm, DownloadUrlRequest, ProxmoxClient, ResizeDiskRequest, StorageContent,
|
||||
TaskState, VmBios, VmConfig,
|
||||
CreateVm, DownloadUrlRequest, ProxmoxClient, ResizeDiskRequest, StorageContent, VmBios,
|
||||
VmConfig,
|
||||
};
|
||||
use crate::provisioner::Provisioner;
|
||||
use crate::settings::{QemuConfig, SshConfig};
|
||||
@ -14,11 +14,8 @@ use fedimint_tonic_lnd::tonic::async_trait;
|
||||
use fedimint_tonic_lnd::Client;
|
||||
use ipnetwork::IpNetwork;
|
||||
use lnvps_db::hydrate::Hydrate;
|
||||
use lnvps_db::{
|
||||
IpRange, LNVpsDb, Vm, VmCostPlanIntervalType, VmHost, VmHostKind, VmIpAssignment, VmOsImage,
|
||||
VmPayment,
|
||||
};
|
||||
use log::{error, info, warn};
|
||||
use lnvps_db::{IpRange, LNVpsDb, Vm, VmCostPlanIntervalType, VmIpAssignment, VmPayment};
|
||||
use log::info;
|
||||
use nostr::util::hex;
|
||||
use rand::random;
|
||||
use rand::seq::IteratorRandom;
|
||||
@ -26,9 +23,7 @@ use reqwest::Url;
|
||||
use std::collections::HashSet;
|
||||
use std::net::IpAddr;
|
||||
use std::ops::Add;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
use tokio::time::sleep;
|
||||
|
||||
pub struct LNVpsProvisioner {
|
||||
db: Box<dyn LNVpsDb>,
|
||||
@ -146,9 +141,9 @@ impl Provisioner for LNVpsProvisioner {
|
||||
disk_id: pick_disk.id,
|
||||
mac_address: format!(
|
||||
"bc:24:11:{}:{}:{}",
|
||||
hex::encode(&[random::<u8>()]),
|
||||
hex::encode(&[random::<u8>()]),
|
||||
hex::encode(&[random::<u8>()])
|
||||
hex::encode([random::<u8>()]),
|
||||
hex::encode([random::<u8>()]),
|
||||
hex::encode([random::<u8>()])
|
||||
),
|
||||
..Default::default()
|
||||
};
|
||||
|
@ -1,7 +1,6 @@
|
||||
use std::net::IpAddr;
|
||||
use lnvps_db::VmIpAssignment;
|
||||
use rocket::async_trait;
|
||||
use crate::router::Router;
|
||||
use rocket::async_trait;
|
||||
use std::net::IpAddr;
|
||||
|
||||
pub struct MikrotikRouter {
|
||||
url: String,
|
||||
@ -19,7 +18,12 @@ impl MikrotikRouter {
|
||||
|
||||
#[async_trait]
|
||||
impl Router for MikrotikRouter {
|
||||
async fn add_arp_entry(&self, ip: IpAddr, mac: &[u8; 6], comment: Option<&str>) -> anyhow::Result<()> {
|
||||
async fn add_arp_entry(
|
||||
&self,
|
||||
ip: IpAddr,
|
||||
mac: &[u8; 6],
|
||||
comment: Option<&str>,
|
||||
) -> anyhow::Result<()> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,12 @@ pub struct VmStateCache {
|
||||
state: Arc<RwLock<HashMap<u64, VmState>>>,
|
||||
}
|
||||
|
||||
impl Default for VmStateCache {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl VmStateCache {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
|
@ -1,11 +1,11 @@
|
||||
use crate::host::get_host_client;
|
||||
use crate::host::proxmox::{ProxmoxClient, VmInfo, VmStatus};
|
||||
use crate::host::proxmox::{VmInfo, VmStatus};
|
||||
use crate::provisioner::Provisioner;
|
||||
use crate::status::{VmRunningState, VmState, VmStateCache};
|
||||
use anyhow::Result;
|
||||
use chrono::{Days, Utc};
|
||||
use lnvps_db::LNVpsDb;
|
||||
use log::{debug, error, info, warn};
|
||||
use log::{debug, error, info};
|
||||
use std::ops::Add;
|
||||
use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user