default IP to 0.0.0.0

This commit is contained in:
Francesco Cogno 2019-09-27 11:01:27 +02:00
parent 1bd6a74e3c
commit 9e5e306899
3 changed files with 12 additions and 8 deletions

View File

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

View File

@ -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 | <switch> | | 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 | <switch> | off | Enable the allowed ip + subnet split mode for the labels.

View File

@ -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::<Ipv4Addr>().unwrap();
let ip = matches
.value_of("addr")
.unwrap()
.parse::<Ipv4Addr>()
.unwrap();
let addr = (ip, bind).into();
info!("starting exporter on http://{}/metrics", addr);