wip modernize code base

This commit is contained in:
Stefan Schwarz 2020-06-04 11:58:44 +02:00
parent c562a21e8c
commit 2579999de0
37 changed files with 11104 additions and 190 deletions

24
yaml.go Normal file
View file

@ -0,0 +1,24 @@
package main
import (
"net/url"
)
func (t *Targets) UnmarshalYAML(unmarshal func(interface{}) error) error {
targets := []string{}
err := unmarshal(&targets)
if err != nil {
return err
}
*t = Targets{
targets: make([]*url.URL, len(targets)),
}
for i, u := range targets {
u, err := url.Parse(u)
if err != nil {
return err
}
t.targets[i] = u
}
return nil
}