Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Close #96
ping @erikschul @fmierlo
This adds an argument
--info/-i
which specifies an address and port (e.g.localhost:9080
), which exposes a HTTP server that provides health status metric of the server.Currently two endpoints are implemented:
/metrics
: Exposes information of the wireguard daemon, this provides the same information you would get withwg show
. This shows an example of what the response would look like./readyz
: This responds with a json which shows the last time a pong is received from an IP specified withCheckAlive
. WhenCheckAlive
is set, a ping is sent out to addresses inCheckAlive
perCheckAliveInterval
seconds (defaults to 5) via wireguard. If a pong has not been received from one of the addresses within the lastCheckAliveInterval
seconds (+2 seconds for some leeway to account for latency), then it would respond with a 503, otherwise a 200.For example:
/readyz
would respond withAnd for:
/readyz
would respond withIf nothing is set for
CheckAlive
, an empty JSON object with 200 will be the response.The peer which the ICMP ping packet is routed to depends on the
AllowedIPs
set for each peers.