This commit is contained in:
parent
e7cca80808
commit
f707380387
|
@ -0,0 +1,6 @@
|
||||||
|
IDE:
|
||||||
|
tables:
|
||||||
|
- ide
|
||||||
|
hosts:
|
||||||
|
- 172.17.4.20
|
||||||
|
- 172.17.4.21
|
4
go.mod
4
go.mod
|
@ -1,3 +1,7 @@
|
||||||
module passke.org/hostchecker
|
module passke.org/hostchecker
|
||||||
|
|
||||||
go 1.19
|
go 1.19
|
||||||
|
|
||||||
|
require (
|
||||||
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
|
)
|
||||||
|
|
18
main.go
18
main.go
|
@ -3,10 +3,28 @@ package main
|
||||||
import "fmt"
|
import "fmt"
|
||||||
import "net/http"
|
import "net/http"
|
||||||
import "io"
|
import "io"
|
||||||
|
import "io/ioutil"
|
||||||
|
import "log"
|
||||||
|
import "gopkg.in/yaml.v3"
|
||||||
|
|
||||||
|
type Group struct {
|
||||||
|
Name string `yaml:"group"`
|
||||||
|
Tables []string `yaml:"tables"`
|
||||||
|
Hosts []string `yaml:"hosts"`
|
||||||
|
}
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("staring")
|
fmt.Println("staring")
|
||||||
|
|
||||||
|
var conf map[string]Group
|
||||||
|
yamlFile, err := ioutil.ReadFile("conf.yaml")
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Configuration open error #%v ", err)
|
||||||
|
}
|
||||||
|
err = yaml.Unmarshal(yamlFile, &conf)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("Configuration read error #%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
resp, err := http.Head("http://example.com")
|
resp, err := http.Head("http://example.com")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Failed")
|
fmt.Println("Failed")
|
||||||
|
|
Loading…
Reference in New Issue