Merge pull request #24 from MindFlavor/issue/23/dev

support for ipv6 address in command line
This commit is contained in:
Francesco Cogno 2020-03-24 11:42:33 +01:00 committed by GitHub
commit fd13be8806
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 275 additions and 513 deletions

778
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
[package]
name = "prometheus_wireguard_exporter"
version = "3.2.2"
version = "3.2.3"
authors = ["Francesco Cogno <francesco.cogno@outlook.com>"]
description = "Prometheus WireGuard Exporter"
edition = "2018"

View file

@ -18,7 +18,7 @@ mod wireguard_config;
use wireguard_config::peer_entry_hashmap_try_from;
extern crate prometheus_exporter_base;
use prometheus_exporter_base::render_prometheus;
use std::net::Ipv4Addr;
use std::net::IpAddr;
use std::sync::Arc;
fn wg_with_text(
@ -156,11 +156,7 @@ async fn main() {
let bind = matches.value_of("port").unwrap();
let bind = u16::from_str_radix(&bind, 10).expect("port must be a valid number");
let ip = matches
.value_of("addr")
.unwrap()
.parse::<Ipv4Addr>()
.unwrap();
let ip = matches.value_of("addr").unwrap().parse::<IpAddr>().unwrap();
let addr = (ip, bind).into();
info!("starting exporter on http://{}/metrics", addr);