Moving to kube, refactoring code, using env variables only, adding metrics exporter
This commit is contained in:
parent
b64d359c27
commit
7ffefb1159
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,2 +1,8 @@
|
|||||||
|
.idea/*
|
||||||
*.swp
|
*.swp
|
||||||
*.log
|
*.log
|
||||||
|
varnish_list
|
||||||
|
helm/charts/*
|
||||||
|
Chart.lock
|
||||||
|
app/*.log
|
||||||
|
app/http-broadcaster
|
||||||
|
|||||||
@ -2,31 +2,104 @@
|
|||||||
package http
|
package http
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
prometheus "http-broadcaster/Prometheus"
|
||||||
|
tools "http-broadcaster/Tools"
|
||||||
varnish "http-broadcaster/Varnish"
|
varnish "http-broadcaster/Varnish"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/netip"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// logRequest print the requests and wanted informations in log file
|
||||||
|
func logRequest(t time.Time, r *http.Request, s int, h map[string]string) {
|
||||||
|
// Test if X-Cache-Tags header is empty
|
||||||
|
if len(h) == 0 {
|
||||||
|
log.Printf("%s %s - - %s \"%s %s %s\" %d 0 \"-\" \"%s\" %d\n",
|
||||||
|
r.Host,
|
||||||
|
r.Header["X-Real-Ip"][0],
|
||||||
|
t.Format("[02/Jan/2006:15:04:05 -0700]"),
|
||||||
|
r.Method,
|
||||||
|
r.URL.Path,
|
||||||
|
r.Proto,
|
||||||
|
s,
|
||||||
|
r.UserAgent(),
|
||||||
|
time.Since(t).Milliseconds(),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
var header string
|
||||||
|
if h["X-Cache-Tags"] != "" {
|
||||||
|
header = h["X-Cache-Tags"]
|
||||||
|
} else {
|
||||||
|
header = h["ApiPlatform-Ban-Regex"]
|
||||||
|
}
|
||||||
|
log.Printf("%s %s - - %s \"%s %s %s\" %d 0 \"-\" \"%s\" %d %s\n",
|
||||||
|
r.Host,
|
||||||
|
r.Header["X-Real-Ip"][0],
|
||||||
|
t.Format("[02/Jan/2006:15:04:05 -0700]"),
|
||||||
|
r.Method,
|
||||||
|
r.URL.Path,
|
||||||
|
r.Proto,
|
||||||
|
s,
|
||||||
|
r.UserAgent(),
|
||||||
|
time.Since(t).Milliseconds(),
|
||||||
|
header,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// checkAllowedIP verify if the IPs is authorized to do BAN/PURGE request.
|
||||||
|
func checkAllowedIP(ip netip.Addr) bool {
|
||||||
|
return tools.IPAllowed(ip)
|
||||||
|
}
|
||||||
|
|
||||||
// RequestHandler handles requests to broadcast to all varnish instances.
|
// RequestHandler handles requests to broadcast to all varnish instances.
|
||||||
func RequestHandler(w http.ResponseWriter, r *http.Request) {
|
func RequestHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var tag = make(map[string]string)
|
||||||
|
// check x-real-ip instead of RemoteAddr header because kube
|
||||||
|
ip, err := netip.ParseAddr(r.Header["X-Real-Ip"][0])
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
// If IP is not authorized to do purge/ban requests, respond with 401.
|
||||||
|
if !checkAllowedIP(ip) {
|
||||||
|
log.Printf("Client ip not authorized : %v", ip)
|
||||||
|
w.WriteHeader(401)
|
||||||
|
_, _ = io.WriteString(w, strconv.Itoa(401))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// If metrics are not enabled, return 404 on /metrics path.
|
||||||
|
if r.URL.Path == "/metrics" && !prometheus.MetricsEnabled {
|
||||||
|
w.WriteHeader(404)
|
||||||
|
_, _ = io.WriteString(w, strconv.Itoa(404))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t := time.Now()
|
||||||
url := r.URL.String()
|
url := r.URL.String()
|
||||||
method := r.Method
|
method := r.Method
|
||||||
tag := r.Header.Get("X-Cache-Tags")
|
h := r.Header.Get("X-Cache-Tags")
|
||||||
remoteAddr := r.RemoteAddr
|
if h != "" {
|
||||||
|
tag["X-Cache-Tags"] = h
|
||||||
|
}
|
||||||
|
h = r.Header.Get("ApiPlatform-Ban-Regex")
|
||||||
|
if h != "" {
|
||||||
|
tag["ApiPlatform-Ban-Regex"] = h
|
||||||
|
}
|
||||||
status := varnish.SendToVarnish(method, url, tag)
|
status := varnish.SendToVarnish(method, url, tag)
|
||||||
if status != "200 Purged" {
|
if prometheus.MetricsEnabled {
|
||||||
|
prometheus.IncrementClientCounterVec(method)
|
||||||
|
}
|
||||||
|
// Return HTTP code 405 if not all varnish servers returned 200.
|
||||||
|
if status != 200 {
|
||||||
w.WriteHeader(405)
|
w.WriteHeader(405)
|
||||||
}
|
}
|
||||||
if tag != "" {
|
logRequest(t, r, status, tag)
|
||||||
log.Println(remoteAddr + " Requested ban on X-Cache-Tags : " + tag + " , status: " + status)
|
_, _ = io.WriteString(w, strconv.Itoa(status))
|
||||||
} else {
|
|
||||||
log.Println(remoteAddr + " Requested purge on URI :" + url + " , status: " + status)
|
|
||||||
}
|
|
||||||
io.WriteString(w, status)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// HealthHandler handles healthcheck requests and return 200.
|
// HealthHandler handles healthcheck requests and return 200.
|
||||||
func HealthHandler(w http.ResponseWriter, _ *http.Request) {
|
func HealthHandler(w http.ResponseWriter, _ *http.Request) {
|
||||||
io.WriteString(w, "OK")
|
_, _ = io.WriteString(w, "OK")
|
||||||
}
|
}
|
||||||
|
|||||||
77
app/Prometheus/utils.go
Normal file
77
app/Prometheus/utils.go
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
// Package prometheus provides useful functions to initialize and populate metrics
|
||||||
|
package prometheus
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/collectors"
|
||||||
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Metrics structure for storing counter
|
||||||
|
type Metrics struct {
|
||||||
|
ClientHTTPReqs *prometheus.CounterVec
|
||||||
|
BackendHTTPReqs *prometheus.CounterVec
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
// HTTPCounter Metrics
|
||||||
|
HTTPCounter = initializeHTTPReqCounter()
|
||||||
|
// Reg is a custom registry to have more control on metrics exported.
|
||||||
|
Reg = prometheus.NewRegistry()
|
||||||
|
// MetricsEnabled is the flag used to enable the prometheus metrics backend.
|
||||||
|
MetricsEnabled = false
|
||||||
|
)
|
||||||
|
|
||||||
|
// InitMetrics enable the metrics functionality if the flags is passed as an argument
|
||||||
|
func InitMetrics(m bool) {
|
||||||
|
if m {
|
||||||
|
MetricsEnabled = true
|
||||||
|
initPrometheusRegistry()
|
||||||
|
// Define custom promhttp handler that expose just our custom registry.
|
||||||
|
http.Handle("/metrics", promhttp.HandlerFor(Reg, promhttp.HandlerOpts{
|
||||||
|
EnableOpenMetrics: true,
|
||||||
|
Registry: Reg,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitPrometheusRegistry initialize registry and counters if metrics flag pass as argument.
|
||||||
|
func initPrometheusRegistry() {
|
||||||
|
// We use a custom registry to better now what metrics are exposed.
|
||||||
|
Reg = prometheus.NewRegistry()
|
||||||
|
Reg.MustRegister(HTTPCounter.ClientHTTPReqs)
|
||||||
|
Reg.MustRegister(HTTPCounter.BackendHTTPReqs)
|
||||||
|
Reg.MustRegister(collectors.NewBuildInfoCollector())
|
||||||
|
}
|
||||||
|
|
||||||
|
// IncrementClientCounterVec increments the counter with method label provided.
|
||||||
|
func IncrementClientCounterVec(m string) {
|
||||||
|
HTTPCounter.ClientHTTPReqs.WithLabelValues(m).Inc()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// IncrementBackendCounterVec increments the counter with method label provided.
|
||||||
|
func IncrementBackendCounterVec(m string) {
|
||||||
|
HTTPCounter.BackendHTTPReqs.WithLabelValues(m).Inc()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitializeHTTPReqCounter inits the httpReqs counter that will be exported.
|
||||||
|
func initializeHTTPReqCounter() *Metrics {
|
||||||
|
HTTPCounters := &Metrics{
|
||||||
|
ClientHTTPReqs: prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||||
|
Name: "client_http_requests_total",
|
||||||
|
Help: "How many HTTP requests processed, partitioned by HTTP method.",
|
||||||
|
},
|
||||||
|
[]string{"method"},
|
||||||
|
),
|
||||||
|
BackendHTTPReqs: prometheus.NewCounterVec(prometheus.CounterOpts{
|
||||||
|
Name: "backend_http_requests_total",
|
||||||
|
Help: "How many HTTP requests sent to backend, partitioned by HTTP method.",
|
||||||
|
},
|
||||||
|
[]string{"method"},
|
||||||
|
),
|
||||||
|
}
|
||||||
|
return HTTPCounters
|
||||||
|
}
|
||||||
60
app/Tools/utils.go
Normal file
60
app/Tools/utils.go
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package Tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"net/netip"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/joho/godotenv"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
// ClientList contains IPs/networks authorized to do purge/ban
|
||||||
|
ClientList []netip.Prefix
|
||||||
|
)
|
||||||
|
|
||||||
|
// ReadDotEnvFile reads environment variables from .env file
|
||||||
|
func ReadDotEnvFile(f string) {
|
||||||
|
err := godotenv.Load(f)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("Error loading .env file")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitLog ensure log file exists and set appropriate flags (remove timestamp at start of line).
|
||||||
|
func InitLog(p string) {
|
||||||
|
logFile, err := os.OpenFile(p, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
log.SetOutput(logFile)
|
||||||
|
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
|
||||||
|
}
|
||||||
|
|
||||||
|
// InitAllowedIPList initialize the list of client authorized to do purge/ban requests
|
||||||
|
func InitAllowedIPList(l string) []netip.Prefix {
|
||||||
|
list := []netip.Prefix{}
|
||||||
|
if l != "" {
|
||||||
|
sliceData := strings.Split(l, ",")
|
||||||
|
for i := 0; i < len(sliceData); i++ {
|
||||||
|
t, err := netip.ParsePrefix(sliceData[i])
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
list = append(list, t)
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
}
|
||||||
|
|
||||||
|
// IPAllowed check if the IP is authorized to do BAN/PURGE requests
|
||||||
|
func IPAllowed(ip netip.Addr) bool {
|
||||||
|
for i := 0; i < len(ClientList); i++ {
|
||||||
|
if ClientList[i].Contains(ip) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
@ -2,87 +2,63 @@
|
|||||||
package varnish
|
package varnish
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
prometheus2 "http-broadcaster/Prometheus"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
vault "http-broadcaster/Vault"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
varnishList = InitializeVarnishList()
|
// VarnishList contains the list of varnish servers.
|
||||||
status = "200 Purged"
|
VarnishList []string
|
||||||
|
status = 200
|
||||||
)
|
)
|
||||||
|
|
||||||
// InitializeVarnishList sets varnishList variable according to the LIST_METHOD env var
|
// InitializeVarnishList sets varnishList variable according to the LIST_METHOD env var
|
||||||
func InitializeVarnishList() []string {
|
func InitializeVarnishList(l string) []string {
|
||||||
switch method := os.Getenv("LIST_METHOD"); method {
|
data := os.Getenv("VARNISH_SERVERS")
|
||||||
case "vault":
|
sliceData := strings.Split(string(data), ",")
|
||||||
return GetVarnishListFromVault()
|
|
||||||
case "file":
|
|
||||||
return GetVarnishListFromFile()
|
|
||||||
default:
|
|
||||||
panic("LIST_METHOD empty, no provided method to retrieve varnish list")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVarnishListFromVault builds a list of varnish servers from Vault.
|
|
||||||
func GetVarnishListFromVault() []string {
|
|
||||||
var value []string
|
|
||||||
client := vault.InitVaultConnection()
|
|
||||||
secret, err := client.KVv2("app").Get(context.Background(), "http-broadcaster/stg/envVars")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal("unable to read secret: %w", err)
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
// selecting list key from retrieved secret
|
|
||||||
list, ok := secret.Data["varnish_list"].(string)
|
|
||||||
if !ok {
|
|
||||||
log.Fatal("value type assertion failed: %T %#v", secret.Data["varnish_list"], secret.Data["varnish_list"])
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
value = strings.Split(string(list), ",")
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetVarnishListFromFile reads the list of varnish servers from a file on disk.
|
|
||||||
func GetVarnishListFromFile() []string {
|
|
||||||
Data, err := os.ReadFile("./varnish")
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
sliceData := strings.Split(string(Data), ",")
|
|
||||||
return sliceData
|
return sliceData
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendToVarnish send to all varnish servers define in varnishList the request with the PURGE or BAN method
|
// SendToVarnish send to all varnish servers define in varnishList the request with the PURGE or BAN method
|
||||||
// and the X-Cache-Tags header if necessary.
|
// and the X-Cache-Tags header if necessary.
|
||||||
func SendToVarnish(method string, url string, tag string) string {
|
func SendToVarnish(method string, url string, tag map[string]string) int {
|
||||||
status = "200 Purged"
|
status = 200
|
||||||
|
|
||||||
// Take url to ban as argument.
|
// Take url to ban as argument.
|
||||||
// Loop over the list of Varnish servers and send PURGE request to each.
|
// Loop over the list of Varnish servers and send PURGE request to each.
|
||||||
// Update status variable to check if servers have successfully purge url.
|
// Update status variable to check if servers have successfully purge url.
|
||||||
for i := 0; i < len(varnishList); i++ {
|
for i := 0; i < len(VarnishList); i++ {
|
||||||
client := &http.Client{}
|
client := &http.Client{
|
||||||
domain := strings.Trim(varnishList[i], "\r\n")
|
Timeout: 10 * time.Second,
|
||||||
|
}
|
||||||
|
// sanitize varnish server host.
|
||||||
|
domain := strings.Trim(VarnishList[i], "\r\n")
|
||||||
req, err := http.NewRequest(method, domain+url, nil)
|
req, err := http.NewRequest(method, domain+url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Create new request : %s", err)
|
log.Fatal("Create new request : %s", err)
|
||||||
}
|
}
|
||||||
if tag != "" {
|
// If X-Cache-Tags header is not empty with pass it to varnish.
|
||||||
req.Header.Add("X-Cache-Tags", tag)
|
if tag["X-Cache-Tags"] != "" {
|
||||||
|
req.Header.Add("X-Cache-Tags", tag["X-Cache-Tags"])
|
||||||
|
}
|
||||||
|
if tag["ApiPlatform-Ban-Regex"] != "" {
|
||||||
|
req.Header.Add("ApiPlatform-Ban-Regex", tag["ApiPlatform-Ban-Regex"])
|
||||||
}
|
}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Send new request : ", err)
|
log.Println("Send new request : ", err)
|
||||||
|
}
|
||||||
|
if prometheus2.MetricsEnabled {
|
||||||
|
prometheus2.IncrementBackendCounterVec(method)
|
||||||
}
|
}
|
||||||
if resp.StatusCode != 200 {
|
if resp.StatusCode != 200 {
|
||||||
status = "405 Not Allowed"
|
status = 405
|
||||||
}
|
}
|
||||||
|
resp.Body.Close()
|
||||||
}
|
}
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
|
|||||||
33
app/go.mod
33
app/go.mod
@ -3,27 +3,20 @@ module http-broadcaster
|
|||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/hashicorp/vault/api v1.9.1
|
github.com/alexflint/go-arg v1.4.3
|
||||||
github.com/hashicorp/vault/api/auth/approle v0.4.0
|
github.com/joho/godotenv v1.5.1
|
||||||
|
github.com/prometheus/client_golang v1.15.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/cenkalti/backoff/v3 v3.0.0 // indirect
|
github.com/alexflint/go-scalar v1.1.0 // indirect
|
||||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/golang/protobuf v1.5.3 // indirect
|
||||||
github.com/hashicorp/go-retryablehttp v0.6.6 // indirect
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
github.com/prometheus/client_model v0.3.0 // indirect
|
||||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 // indirect
|
github.com/prometheus/common v0.42.0 // indirect
|
||||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
|
github.com/prometheus/procfs v0.9.0 // indirect
|
||||||
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
|
golang.org/x/sys v0.6.0 // indirect
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
google.golang.org/protobuf v1.30.0 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
|
||||||
github.com/ryanuber/go-glob v1.0.0 // indirect
|
|
||||||
golang.org/x/crypto v0.6.0 // indirect
|
|
||||||
golang.org/x/net v0.7.0 // indirect
|
|
||||||
golang.org/x/text v0.7.0 // indirect
|
|
||||||
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 // indirect
|
|
||||||
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
|
|
||||||
)
|
)
|
||||||
|
|||||||
159
app/go.sum
159
app/go.sum
@ -1,117 +1,68 @@
|
|||||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
github.com/alecthomas/kingpin/v2 v2.3.1 h1:ANLJcKmQm4nIaog7xdr/id6FM6zm5hHnfZrvtKPxqGg=
|
||||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc=
|
||||||
github.com/cenkalti/backoff/v3 v3.0.0 h1:ske+9nBpD9qZsTBoF41nW5L+AIuFBKMeze18XQ3eG1c=
|
github.com/alexflint/go-arg v1.4.3 h1:9rwwEBpMXfKQKceuZfYcwuc/7YY7tWJbFsgG5cAU/uo=
|
||||||
github.com/cenkalti/backoff/v3 v3.0.0/go.mod h1:cIeZDE3IrqwwJl6VUwCN6trj1oXrTS4rc0ij+ULvLYs=
|
github.com/alexflint/go-arg v1.4.3/go.mod h1:3PZ/wp/8HuqRZMUUgu7I+e1qcpUbvmS258mRXkFH4IA=
|
||||||
|
github.com/alexflint/go-scalar v1.1.0 h1:aaAouLLzI9TChcPXotr6gUhq+Scr8rl0P9P4PnltbhM=
|
||||||
|
github.com/alexflint/go-scalar v1.1.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
|
||||||
|
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||||
|
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||||
|
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||||
|
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
|
||||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
|
||||||
github.com/go-test/deep v1.0.2 h1:onZX1rnHT3Wv6cqNgYyFOOlgVKJrksuCMCRvJStbMYw=
|
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||||
github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
|
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||||
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
|
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
|
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
|
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
|
||||||
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs=
|
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
|
||||||
github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
|
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
||||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||||
github.com/hashicorp/go-retryablehttp v0.6.6 h1:HJunrbHTDDbBb/ay4kxa1n+dLmttUlnP3V9oNE4hmsM=
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY=
|
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
|
||||||
github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
|
|
||||||
github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
|
|
||||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6 h1:om4Al8Oy7kCm/B86rLCLah4Dt5Aa0Fr5rYBG60OzwHQ=
|
|
||||||
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.6/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
|
|
||||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.1/go.mod h1:gKOamz3EwoIoJq7mlMIRBpVTAUn8qPCrEclOKKWhD3U=
|
|
||||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts=
|
|
||||||
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4=
|
|
||||||
github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
|
|
||||||
github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
|
|
||||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
|
||||||
github.com/hashicorp/vault/api v1.9.0/go.mod h1:lloELQP4EyhjnCQhF8agKvWIVTmxbpEJj70b98959sM=
|
|
||||||
github.com/hashicorp/vault/api v1.9.1 h1:LtY/I16+5jVGU8rufyyAkwopgq/HpUnxFBg+QLOAV38=
|
|
||||||
github.com/hashicorp/vault/api v1.9.1/go.mod h1:78kktNcQYbBGSrOjQfHjXN32OhhxXnbYl3zxpd2uPUs=
|
|
||||||
github.com/hashicorp/vault/api/auth/approle v0.4.0 h1:tjJHoUkPx8zRoFlFy86uvgg/1gpTnDPp0t0BYWTKjjw=
|
|
||||||
github.com/hashicorp/vault/api/auth/approle v0.4.0/go.mod h1:D2gEpR0aS/F/MEcSjmhUlOsuK1RMVZojsnIQAEf0EV0=
|
|
||||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
|
||||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
|
||||||
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
|
|
||||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
|
||||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
|
||||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
|
||||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
|
||||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
|
||||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
|
||||||
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
|
||||||
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
|
||||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
|
||||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
|
||||||
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
|
||||||
github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk=
|
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
|
||||||
github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc=
|
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
|
||||||
|
github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM=
|
||||||
|
github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc=
|
||||||
|
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
|
||||||
|
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
|
||||||
|
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
github.com/xhit/go-str2duration v1.2.0 h1:BcV5u025cITWxEQKGWr1URRzrcXtu7uk8+luz3Yuhwc=
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
|
||||||
golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU=
|
|
||||||
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
|
|
||||||
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
|
||||||
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
|
|
||||||
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
||||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s=
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
|
||||||
golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
|
||||||
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
|
||||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1 h1:NusfzzA6yGQ+ua51ck7E3omNUX/JuqbFSaRGqU8CcLI=
|
|
||||||
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
||||||
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
|
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
|
||||||
|
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w=
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|||||||
25
app/main.go
25
app/main.go
@ -3,17 +3,32 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
h "http-broadcaster/Http"
|
h "http-broadcaster/Http"
|
||||||
|
prometheus2 "http-broadcaster/Prometheus"
|
||||||
|
tools "http-broadcaster/Tools"
|
||||||
|
varnish "http-broadcaster/Varnish"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/alexflint/go-arg"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
args struct {
|
||||||
|
Log string `arg:"-l,--logfile" help:"location of output logfile." default:"/app/http-broadcaster.log"`
|
||||||
|
EnvFile string `arg:"-e,--envfile" help:"location of file containing environment variables." default:"/vault/secrets/.env"`
|
||||||
|
Metrics bool `arg:"--metrics" help:"enable prometheus exporter on /metrics." default:"false"`
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
logFile, err := os.OpenFile("./log/purge.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
arg.MustParse(&args)
|
||||||
if err != nil {
|
tools.InitLog(args.Log)
|
||||||
panic(err)
|
tools.ReadDotEnvFile(args.EnvFile)
|
||||||
}
|
tools.ClientList = tools.InitAllowedIPList(os.Getenv("CLIENT_LIST"))
|
||||||
log.SetOutput(logFile)
|
varnish.VarnishList = varnish.InitializeVarnishList(os.Getenv("VARNISH_SERVERS"))
|
||||||
|
prometheus2.InitMetrics(args.Metrics)
|
||||||
|
|
||||||
http.HandleFunc("/", h.RequestHandler)
|
http.HandleFunc("/", h.RequestHandler)
|
||||||
http.HandleFunc("/healthcheck", h.HealthHandler)
|
http.HandleFunc("/healthcheck", h.HealthHandler)
|
||||||
log.Fatal(http.ListenAndServe(":6081", nil))
|
log.Fatal(http.ListenAndServe(":6081", nil))
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
http://10.13.20.16:80
|
|
||||||
Loading…
x
Reference in New Issue
Block a user