Compare commits
No commits in common. "787f74e3eca7bec680ef25be6fe6b7ec0e3a15b5" and "e5c9cb6024a16fdd59733b127805b75c3fc28493" have entirely different histories.
787f74e3ec
...
e5c9cb6024
@ -3,14 +3,40 @@
|
|||||||
use anyhow::{Context, Result};
|
use anyhow::{Context, Result};
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
|
use serde::{self, Deserialize, Serialize};
|
||||||
use std::{
|
use std::{
|
||||||
|
collections::HashMap,
|
||||||
fmt,
|
fmt,
|
||||||
net::{IpAddr, Ipv4Addr},
|
net::{IpAddr, Ipv4Addr},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::cloudflare_responses::{CloudflareResponse, DnsRecord};
|
|
||||||
use crate::get_current_public_ipv4;
|
use crate::get_current_public_ipv4;
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
|
struct DnsRecord {
|
||||||
|
id: String,
|
||||||
|
#[serde(rename = "type")]
|
||||||
|
record_type: Box<str>,
|
||||||
|
name: Box<str>,
|
||||||
|
content: Box<str>,
|
||||||
|
ttl: u32,
|
||||||
|
proxied: bool,
|
||||||
|
locked: bool,
|
||||||
|
zone_id: Box<str>,
|
||||||
|
zone_name: Box<str>,
|
||||||
|
modified_on: Box<str>,
|
||||||
|
created_on: Box<str>,
|
||||||
|
meta: HashMap<Box<str>, serde_json::Value>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
|
struct CloudflareResponse {
|
||||||
|
success: bool,
|
||||||
|
errors: Vec<HashMap<String, serde_json::Value>>,
|
||||||
|
messages: Vec<HashMap<String, serde_json::Value>>,
|
||||||
|
result: Option<Vec<DnsRecord>>,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct CloudflareClient<A, Z>
|
pub struct CloudflareClient<A, Z>
|
||||||
where
|
where
|
||||||
A: fmt::Display,
|
A: fmt::Display,
|
@ -1,27 +0,0 @@
|
|||||||
use std::collections::HashMap;
|
|
||||||
|
|
||||||
use serde;
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)]
|
|
||||||
pub struct DnsRecord {
|
|
||||||
pub id: Box<str>,
|
|
||||||
#[serde(rename = "type")]
|
|
||||||
pub record_type: Box<str>,
|
|
||||||
pub name: Box<str>,
|
|
||||||
pub content: Box<str>,
|
|
||||||
pub ttl: u32,
|
|
||||||
pub proxied: bool,
|
|
||||||
pub locked: bool,
|
|
||||||
pub zone_id: Box<str>,
|
|
||||||
pub zone_name: Box<str>,
|
|
||||||
pub modified_on: Box<str>,
|
|
||||||
pub created_on: Box<str>,
|
|
||||||
pub meta: HashMap<Box<str>, serde_json::Value>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize, Debug)]
|
|
||||||
pub struct CloudflareResponse {
|
|
||||||
pub success: bool,
|
|
||||||
pub errors: Box<[HashMap<Box<str>, serde_json::Value>]>,
|
|
||||||
pub messages: Box<[HashMap<Box<str>, serde_json::Value>]>,
|
|
||||||
pub result: Option<Vec<DnsRecord>>,
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
mod cloudflare;
|
|
||||||
pub mod cloudflare_responses;
|
|
||||||
pub use cloudflare::CloudflareClient;
|
|
@ -1,17 +1,16 @@
|
|||||||
// SPDX: BSD-2-Clause
|
// SPDX: BSD-2-Clause
|
||||||
|
|
||||||
|
mod cloudflare;
|
||||||
mod config;
|
mod config;
|
||||||
mod exit_listener;
|
mod exit_listener;
|
||||||
mod logging;
|
mod logging;
|
||||||
mod message_handler;
|
mod message_handler;
|
||||||
mod network_change_listener;
|
mod network_change_listener;
|
||||||
mod public_ip;
|
mod public_ip;
|
||||||
|
mod tests;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
mod tests;
|
pub use cloudflare::CloudflareClient;
|
||||||
mod internet;
|
|
||||||
|
|
||||||
pub use internet::CloudflareClient;
|
|
||||||
pub use config::{get_config_path, read_config, Config};
|
pub use config::{get_config_path, read_config, Config};
|
||||||
pub use exit_listener::ExitListener;
|
pub use exit_listener::ExitListener;
|
||||||
pub use logging::init_logger;
|
pub use logging::init_logger;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user