fix bad format

This commit is contained in:
Kaan Barmore-Genç 2022-08-22 22:15:28 -04:00
parent f47b3f09e7
commit 0e643bc9c2
Signed by: kaan
GPG key ID: B2E280771CD62FCF
5 changed files with 15 additions and 14 deletions

View file

@ -13,7 +13,9 @@ pub struct Entry {
ttl: Option<u32>,
}
fn default_ttl() -> u32 { return 300; }
fn default_ttl() -> u32 {
return 300;
}
#[derive(Deserialize, Debug)]
pub struct Config {

View file

@ -3,6 +3,6 @@ use async_trait::async_trait;
#[async_trait]
pub trait IPSource {
async fn get_ipv4() -> anyhow::Result<String>;
async fn get_ipv6() -> anyhow::Result<String>;
async fn get_ipv4() -> anyhow::Result<String>;
async fn get_ipv6() -> anyhow::Result<String>;
}

View file

@ -6,17 +6,17 @@ use super::ip_source::IPSource;
pub(crate) struct IPSourceIpify {}
async fn get_ip(api_url: &str) -> anyhow::Result<String> {
let response = reqwest::get(api_url).await?;
let text = response.text().await?;
Ok(text)
let response = reqwest::get(api_url).await?;
let text = response.text().await?;
Ok(text)
}
#[async_trait]
impl IPSource for IPSourceIpify {
async fn get_ipv4() -> anyhow::Result<String> {
get_ip("https://api.ipify.org").await
}
async fn get_ipv6() -> anyhow::Result<String> {
get_ip("https://api6.ipify.org").await
}
async fn get_ipv4() -> anyhow::Result<String> {
get_ip("https://api.ipify.org").await
}
async fn get_ipv6() -> anyhow::Result<String> {
get_ip("https://api6.ipify.org").await
}
}

View file

@ -1,2 +1,2 @@
pub(crate) mod ip_source;
pub(crate) mod ipify;
pub(crate) mod ipify;

View file

@ -7,5 +7,4 @@ pub struct Opts {
/// The path to the configuration file.
#[clap(long)]
pub config: Option<String>,
}