Moved newJar to auth
This commit is contained in:
parent
f54bb612a9
commit
d4e7f8adb5
10
auth.go
10
auth.go
@ -8,6 +8,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/http/cookiejar"
|
"net/http/cookiejar"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Auth struct {
|
type Auth struct {
|
||||||
@ -20,6 +21,15 @@ type Instance struct {
|
|||||||
Jar *cookiejar.Jar
|
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) {
|
func auth(e *Instance) {
|
||||||
var auth Auth
|
var auth Auth
|
||||||
auth.Username = cfg.Username
|
auth.Username = cfg.Username
|
||||||
|
10
main.go
10
main.go
@ -7,7 +7,6 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"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) {
|
func getStats(hosts *[]Instance) (stats []Stats) {
|
||||||
for _, e := range *hosts {
|
for _, e := range *hosts {
|
||||||
var stat Stats
|
var stat Stats
|
||||||
|
Loading…
Reference in New Issue
Block a user