dsnet/report.go

24 lines
428 B
Go
Raw Permalink Normal View History

2020-03-04 23:23:32 +01:00
package dsnet
import (
"golang.zx2c4.com/wireguard/wgctrl"
)
2020-03-04 23:49:27 +01:00
func Report() {
2020-03-04 23:23:32 +01:00
conf := MustLoadDsnetConfig()
2020-03-04 23:49:27 +01:00
wg, err := wgctrl.New()
2020-03-04 23:23:32 +01:00
check(err)
2020-03-04 23:49:27 +01:00
defer wg.Close()
dev, err := wg.Device(conf.InterfaceName)
if err != nil {
ExitFail("Could not retrieve device '%s' (%v)", conf.InterfaceName, err)
}
2020-03-04 23:23:32 +01:00
2020-03-06 00:56:24 +01:00
oldReport := MustLoadDsnetReport()
report := GenerateReport(dev, conf, oldReport)
2020-03-04 23:49:27 +01:00
report.MustSave(conf.ReportFile)
2020-03-04 23:23:32 +01:00
}