release v3.2.1

This commit is contained in:
Francesco Cogno 2019-11-08 09:34:17 +01:00
parent 90a1585dab
commit 4612afe684
4 changed files with 18 additions and 9 deletions

2
Cargo.lock generated
View File

@ -514,7 +514,7 @@ dependencies = [
[[package]]
name = "prometheus_wireguard_exporter"
version = "3.2.0"
version = "3.2.1"
dependencies = [
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",

View File

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

View File

@ -1,14 +1,14 @@
# Prometheus WireGuard Exporter
[![legal](https://img.shields.io/github/license/mindflavor/prometheus_wireguard_exporter.svg)](LICENSE)
[![legal](https://img.shields.io/github/license/mindflavor/prometheus_wireguard_exporter.svg)](LICENSE) ![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)
[![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.2.0)
[![tag](https://img.shields.io/github/tag/mindflavor/prometheus_wireguard_exporter.svg)](https://github.com/MindFlavor/prometheus_wireguard_exporter/tree/3.2.0)
[![release](https://img.shields.io/github/release/MindFlavor/prometheus_wireguard_exporter.svg)](https://github.com/MindFlavor/prometheus_wireguard_exporter/tree/3.2.1)
[![tag](https://img.shields.io/github/tag/mindflavor/prometheus_wireguard_exporter.svg)](https://github.com/MindFlavor/prometheus_wireguard_exporter/tree/3.2.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.2.0.svg)](https://img.shields.io/github/commits-since/mindflavor/prometheus_wireguard_exporter/3.2.0.svg)
[![commitssince](https://img.shields.io/github/commits-since/mindflavor/prometheus_wireguard_exporter/3.2.1.svg)](https://img.shields.io/github/commits-since/mindflavor/prometheus_wireguard_exporter/3.2.1.svg)
## Intro

View File

@ -2,10 +2,10 @@ use crate::exporter_error::ExporterError;
use crate::wireguard_config::PeerEntryHashMap;
use log::{debug, trace};
use prometheus_exporter_base::PrometheusCounter;
use regex::Regex;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::net::SocketAddr;
use regex::Regex;
const EMPTY: &str = "(none)";
@ -78,8 +78,17 @@ impl TryFrom<&str> for WireGuard {
let public_key = v[1].to_owned();
let (remote_ip, remote_port) = if let Some(ip_and_port) = to_option_string(v[3]) {
let re = Regex::new(r"^\[(?P<ip>[A-Fa-f0-9:]+)%(.*)\]:(?P<port>[0-9]+)$").unwrap();
let addr: SocketAddr = re.replace_all(&ip_and_port, "[$ip]:$port").parse::<SocketAddr>().unwrap();
// this workaround fixes issue #10 (see
// https://github.com/MindFlavor/prometheus_wireguard_exporter/issues/10).
// Whenever it will be fixed upstream this code will be replaced with a
// simple
// let addr: SocketAddr = ip_and_port.parse::<SocketAddr>().unwrap();
let re =
Regex::new(r"^\[(?P<ip>[A-Fa-f0-9:]+)%(.*)\]:(?P<port>[0-9]+)$").unwrap();
let addr: SocketAddr = re
.replace_all(&ip_and_port, "[$ip]:$port")
.parse::<SocketAddr>()
.unwrap();
(Some(addr.ip().to_string()), Some(addr.port()))
} else {