Moved newJar to auth

This commit is contained in:
Ash Leece 2021-12-28 10:24:34 +00:00
parent f54bb612a9
commit d4e7f8adb5
2 changed files with 10 additions and 10 deletions

10
auth.go
View File

@ -8,6 +8,7 @@ import (
"net/http"
"net/http/cookiejar"
"net/url"
"strings"
)
type Auth struct {
@ -20,6 +21,15 @@ type Instance struct {
Jar *cookiejar.Jar
}
func newJar(hosts *Instance) bool {
for _, e := range hosts.Jar.Cookies(hosts.Url) {
if strings.Contains(e.Name, "AIROS_") {
return false
}
}
return true
}
func auth(e *Instance) {
var auth Auth
auth.Username = cfg.Username

10
main.go
View File

@ -7,7 +7,6 @@ import (
"io/ioutil"
"log"
"net/http"
"strings"
"time"
"github.com/prometheus/client_golang/prometheus"
@ -75,15 +74,6 @@ func genProm(stats []Stats) {
}
}
func newJar(hosts *Instance) bool {
for _, e := range hosts.Jar.Cookies(hosts.Url) {
if strings.Contains(e.Name, "AIROS_") {
return false
}
}
return true
}
func getStats(hosts *[]Instance) (stats []Stats) {
for _, e := range *hosts {
var stat Stats