func (c *collector) Describe(ch chan<- *prometheus.Desc) {
	ds := []*prometheus.Desc{
		c.DeviceInfo,
		c.PeerInfo,
		c.PeerAllowedIPsInfo,
		c.PeerReceiveBytes,
		c.PeerTransmitBytes,
		c.PeerLastHandshake,
	}
	for _, d := range ds {
		ch <- d
	}
}
Describe implements prometheus.Collector.
package wireguardexporter
import (
	"fmt"
	"log"
	"net"
	"github.com/prometheus/client_golang/prometheus"
	"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)
var _ prometheus.Collector = &collector{}
type collector struct {
	DeviceInfo *prometheus.Desc
	PeerInfo           *prometheus.Desc
	PeerAllowedIPsInfo *prometheus.Desc
	PeerReceiveBytes   *prometheus.Desc
	PeerTransmitBytes  *prometheus.Desc
	PeerLastHandshake  *prometheus.Desc
	devices   func() ([]*wgtypes.Device, error)
	peerNames map[string]string
}
func New(devices func() ([]*wgtypes.Device, error), peerNames map[string]string) prometheus.Collector {
	if peerNames == nil {
		peerNames = make(map[string]string)
	}
	labels := []string{"device", "public_key"}
	return &collector{
		DeviceInfo: prometheus.NewDesc(
			"wireguard_device_info",
			"Metadata about a device.",
			labels,
			nil,
		),
		PeerInfo: prometheus.NewDesc(
			"wireguard_peer_info",
			"Metadata about a peer. The public_key label on peer metrics refers to the peer's public key; not the device's public key.",
			append(labels, []string{"endpoint", "name"}...),
			nil,
		),
		PeerAllowedIPsInfo: prometheus.NewDesc(
			"wireguard_peer_allowed_ips_info",
			"Metadata about each of a peer's allowed IP subnets for a given device.",
			append(labels, []string{"allowed_ips", "family"}...),
			nil,
		),
		PeerReceiveBytes: prometheus.NewDesc(
			"wireguard_peer_receive_bytes_total",
			"Number of bytes received from a given peer.",
			labels,
			nil,
		),
		PeerTransmitBytes: prometheus.NewDesc(
			"wireguard_peer_transmit_bytes_total",
			"Number of bytes transmitted to a given peer.",
			labels,
			nil,
		),
		PeerLastHandshake: prometheus.NewDesc(
			"wireguard_peer_last_handshake_seconds",
			"UNIX timestamp for the last handshake with a given peer.",
			labels,
			nil,
		),
		devices:   devices,
		peerNames: peerNames,
	}
}