mirror of
https://github.com/whyvl/wireproxy.git
synced 2025-04-29 19:01:42 +02:00
Add health status endpoint (#107)
* implement metric endpoint * implement ICMP ping * fix linting * fix IPv6 pings * Add documentation for --info
This commit is contained in:
parent
54cedea2e4
commit
eccf83a0cf
5 changed files with 276 additions and 14 deletions
33
config.go
33
config.go
|
@ -22,12 +22,14 @@ type PeerConfig struct {
|
|||
|
||||
// DeviceConfig contains the information to initiate a wireguard connection
|
||||
type DeviceConfig struct {
|
||||
SecretKey string
|
||||
Endpoint []netip.Addr
|
||||
Peers []PeerConfig
|
||||
DNS []netip.Addr
|
||||
MTU int
|
||||
ListenPort *int
|
||||
SecretKey string
|
||||
Endpoint []netip.Addr
|
||||
Peers []PeerConfig
|
||||
DNS []netip.Addr
|
||||
MTU int
|
||||
ListenPort *int
|
||||
CheckAlive []netip.Addr
|
||||
CheckAliveInterval int
|
||||
}
|
||||
|
||||
type TCPClientTunnelConfig struct {
|
||||
|
@ -237,6 +239,25 @@ func ParseInterface(cfg *ini.File, device *DeviceConfig) error {
|
|||
device.ListenPort = &value
|
||||
}
|
||||
|
||||
checkAlive, err := parseNetIP(section, "CheckAlive")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
device.CheckAlive = checkAlive
|
||||
|
||||
device.CheckAliveInterval = 5
|
||||
if sectionKey, err := section.GetKey("CheckAliveInterval"); err == nil {
|
||||
value, err := sectionKey.Int()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if len(checkAlive) == 0 {
|
||||
return errors.New("CheckAliveInterval is only valid when CheckAlive is set")
|
||||
}
|
||||
|
||||
device.CheckAliveInterval = value
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue