From 9e5e306899a4e2a5c335690869522516027d27b8 Mon Sep 17 00:00:00 2001 From: Francesco Cogno Date: Fri, 27 Sep 2019 11:01:27 +0200 Subject: [PATCH] default IP to 0.0.0.0 --- Cargo.toml | 2 +- README.md | 8 ++++---- src/main.rs | 10 +++++++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 06ba6cf..bd35a49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prometheus_wireguard_exporter" -version = "3.1.0" +version = "3.1.1" authors = ["Francesco Cogno "] description = "Prometheus WireGuard Exporter" edition = "2018" diff --git a/README.md b/README.md index c52838a..887acb6 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ [![Crate](https://img.shields.io/crates/v/prometheus_wireguard_exporter.svg)](https://crates.io/crates/prometheus_wireguard_exporter) [![cratedown](https://img.shields.io/crates/d/prometheus_wireguard_exporter.svg)](https://crates.io/crates/prometheus_wireguard_exporter) [![cratelastdown](https://img.shields.io/crates/dv/prometheus_wireguard_exporter.svg)](https://crates.io/crates/prometheus_wireguard_exporter) -[![release](https://img.shields.io/github/release/MindFlavor/prometheus_wireguard_exporter.svg)](https://github.com/MindFlavor/prometheus_wireguard_exporter/tree/3.1.0) -[![tag](https://img.shields.io/github/tag/mindflavor/prometheus_wireguard_exporter.svg)](https://github.com/MindFlavor/prometheus_wireguard_exporter/tree/3.1.0) +[![release](https://img.shields.io/github/release/MindFlavor/prometheus_wireguard_exporter.svg)](https://github.com/MindFlavor/prometheus_wireguard_exporter/tree/3.1.1) +[![tag](https://img.shields.io/github/tag/mindflavor/prometheus_wireguard_exporter.svg)](https://github.com/MindFlavor/prometheus_wireguard_exporter/tree/3.1.1) [![Build Status](https://travis-ci.org/MindFlavor/prometheus_wireguard_exporter.svg?branch=master)](https://travis-ci.org/MindFlavor/prometheus_wireguard_exporter) -[![commitssince](https://img.shields.io/github/commits-since/mindflavor/prometheus_wireguard_exporter/3.1.0.svg)](https://img.shields.io/github/commits-since/mindflavor/prometheus_wireguard_exporter/3.1.0.svg) +[![commitssince](https://img.shields.io/github/commits-since/mindflavor/prometheus_wireguard_exporter/3.1.1.svg)](https://img.shields.io/github/commits-since/mindflavor/prometheus_wireguard_exporter/3.1.1.svg) ## Intro @@ -47,7 +47,7 @@ Start the binary with `-h` to get the complete syntax. The parameters are: | Parameter | Mandatory | Valid values | Default | Description | | -- | -- | -- | -- | -- | | `-v` | no | | | Enable verbose mode. -| `-p` | no | any valid ip address | 127.0.0.1 | Specify the service address. This is the address your Prometheus instance should point to. +| `-p` | no | any valid ip address | 0.0.0.0 | Specify the service address. This is the address your Prometheus instance should point to. | `-p` | no | any valid port number | 9586 | Specify the service port. This is the port your Prometheus instance should point to. | `-n` | no | path to the wireguard configuration file | | This flag adds the *friendly_name* attribute to the exported entries. See [Friendly names](#friendly-names) for more details. | `-s` | no | | off | Enable the allowed ip + subnet split mode for the labels. diff --git a/src/main.rs b/src/main.rs index 4dae566..d060a60 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,8 +20,8 @@ use wireguard_config::peer_entry_hashmap_try_from; extern crate prometheus_exporter_base; use crate::exporter_error::ExporterError; use prometheus_exporter_base::render_prometheus; -use std::sync::Arc; use std::net::Ipv4Addr; +use std::sync::Arc; fn wg_with_text( wg_config_str: &str, @@ -94,7 +94,7 @@ fn main() { Arg::with_name("addr") .short("l") .help("exporter address") - .default_value("127.0.0.1") + .default_value("0.0.0.0") .takes_value(true), ) .arg( @@ -148,7 +148,11 @@ 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::().unwrap(); + let ip = matches + .value_of("addr") + .unwrap() + .parse::() + .unwrap(); let addr = (ip, bind).into(); info!("starting exporter on http://{}/metrics", addr);