Skip to content
This repository has been archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
go mod
Browse files Browse the repository at this point in the history
  • Loading branch information
chavers committed Feb 22, 2020
1 parent f7fd86c commit c47d68c
Show file tree
Hide file tree
Showing 13 changed files with 209 additions and 73 deletions.
66 changes: 38 additions & 28 deletions ctrl/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/ezbastion/ezb_srv/models"
"github.com/gin-contrib/location"
"github.com/gin-gonic/gin"
"github.com/go-resty/resty"
"github.com/go-resty/resty/v2"
log "github.com/sirupsen/logrus"
)

Expand All @@ -52,6 +52,7 @@ func GetTask(c *gin.Context) {
c.JSON(500, err)
return
}

cert, err := tls.LoadX509KeyPair(path.Join(exPath, conf.PublicCert), path.Join(exPath, conf.PrivateKey))
if err != nil {
logg.Error(err)
Expand Down Expand Up @@ -86,10 +87,11 @@ func getTaskResult(c *gin.Context, cert tls.Certificate, url, pemFilePath, xtrac
"controller": "internal",
"xtrack": xtrack,
})
client := resty.New()

resty.SetRootCertificate(pemFilePath)
resty.SetCertificates(cert)
resp, err := resty.R().
client.SetRootCertificate(pemFilePath)
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", xtrack).
SetHeader("x-ezb-tokenid", tokenID).
Expand All @@ -112,9 +114,10 @@ func getTaskStatus(c *gin.Context, cert tls.Certificate, url, pemFilePath, xtrac
"xtrack": xtrack,
})
var respStruct models.EzbTasks
resty.SetRootCertificate(pemFilePath)
resty.SetCertificates(cert)
resp, err := resty.R().
client := resty.New()
client.SetRootCertificate(pemFilePath)
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", xtrack).
SetHeader("x-ezb-tokenid", tokenID).
Expand Down Expand Up @@ -142,9 +145,10 @@ func getTaskLog(c *gin.Context, cert tls.Certificate, url, pemFilePath, xtrack,
"controller": "internal",
"xtrack": xtrack,
})
resty.SetRootCertificate(pemFilePath)
resty.SetCertificates(cert)
resp, err := resty.R().
client := resty.New()
client.SetRootCertificate(pemFilePath)
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("X-Track", xtrack).
SetHeader("x-ezb-tokenid", tokenID).
Get(url)
Expand Down Expand Up @@ -188,9 +192,10 @@ func GetXtrack(c *gin.Context) {
c.JSON(500, err.Error())
return
}
resty.SetRootCertificate(path.Join(exPath, conf.CaCert))
resty.SetCertificates(cert)
resp, err := resty.R().
client := resty.New()
client.SetRootCertificate(path.Join(exPath, conf.CaCert))
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", trace.Xtrack).
SetResult(&respStruct).
Expand Down Expand Up @@ -234,9 +239,10 @@ func GetLog(c *gin.Context) {
c.JSON(500, err.Error())
return
}
resty.SetRootCertificate(path.Join(exPath, conf.CaCert))
resty.SetCertificates(cert)
resp, err := resty.R().
client := resty.New()
client.SetRootCertificate(path.Join(exPath, conf.CaCert))
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", trace.Xtrack).
SetResult(&respStruct).
Expand Down Expand Up @@ -279,9 +285,10 @@ func GetLoad(c *gin.Context) {
c.JSON(500, err.Error())
return
}
resty.SetRootCertificate(path.Join(exPath, conf.CaCert))
resty.SetCertificates(cert)
resp, err := resty.R().
client := resty.New()
client.SetRootCertificate(path.Join(exPath, conf.CaCert))
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", trace.Xtrack).
SetResult(&respStruct).
Expand Down Expand Up @@ -323,9 +330,10 @@ func GetJobs(c *gin.Context) {
c.JSON(500, err.Error())
return
}
resty.SetRootCertificate(path.Join(exPath, conf.CaCert))
resty.SetCertificates(cert)
resp, err := resty.R().
client := resty.New()
client.SetRootCertificate(path.Join(exPath, conf.CaCert))
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", trace.Xtrack).
SetResult(&respStruct).
Expand Down Expand Up @@ -374,9 +382,10 @@ func GetScripts(c *gin.Context) {
c.JSON(500, err.Error())
return
}
resty.SetRootCertificate(path.Join(exPath, conf.CaCert))
resty.SetCertificates(cert)
resp, err := resty.R().
client := resty.New()
client.SetRootCertificate(path.Join(exPath, conf.CaCert))
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", trace.Xtrack).
SetResult(&respStruct).
Expand Down Expand Up @@ -419,9 +428,10 @@ func GetConf(c *gin.Context) {
c.JSON(500, err.Error())
return
}
resty.SetRootCertificate(path.Join(exPath, conf.CaCert))
resty.SetCertificates(cert)
resp, err := resty.R().
client := resty.New()
client.SetRootCertificate(path.Join(exPath, conf.CaCert))
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", trace.Xtrack).
SetResult(&respStruct).
Expand Down
9 changes: 5 additions & 4 deletions ctrl/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
"github.com/gin-contrib/location"

"github.com/gin-gonic/gin"
"github.com/go-resty/resty"
"github.com/go-resty/resty/v2"
log "github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -92,9 +92,10 @@ func SendAction(c *gin.Context, storage cache.Storage) {
c.JSON(500, err.Error())
return
}
resty.SetRootCertificate(path.Join(exPath, conf.CaCert))
resty.SetCertificates(cert)
resp, err := resty.R().
client := resty.New()
client.SetRootCertificate(path.Join(exPath, conf.CaCert))
client.SetCertificates(cert)
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", trace.Xtrack).
SetHeader("X-Polling", strconv.FormatBool(action.Polling)).
Expand Down
17 changes: 17 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module github.com/ezbastion/ezb_srv

go 1.13

require (
github.com/ShowMax/go-fqdn v0.0.0-20180501083314-6f60894d629f
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/ezbastion/ezb_lib v0.1.0
github.com/gin-contrib/location v0.0.1
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607
github.com/gin-gonic/gin v1.5.0
github.com/go-resty/resty/v2 v2.1.0
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.4.2
github.com/urfave/cli v1.22.2
golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c
)
98 changes: 98 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/ShowMax/go-fqdn v0.0.0-20180501083314-6f60894d629f h1:JXCLW7P0nQ6aNQkgqkSo5wMAPbkMRF9aetYchJyCTjw=
github.com/ShowMax/go-fqdn v0.0.0-20180501083314-6f60894d629f/go.mod h1:Wbphg/zwBzq1nUotnHP8day9iRhcMOwh7JFW1vkzq6w=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
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/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/ezbastion/ezb_lib v0.0.0-20200222105408-548e481d950a h1:ZhkBBtW7LpqUNYCXRFTpoTfEIMenM5urBiLQNJxcLjk=
github.com/ezbastion/ezb_lib v0.0.0-20200222105408-548e481d950a/go.mod h1:ybKk609w7Gi4IRqUx9hDcNKIe/+DtfYuSHLgjYk2td8=
github.com/ezbastion/ezb_lib v0.1.0 h1:eK0XuOXnAXOPXN/Xjn+HX4mKLgjJxY84Rf6w+5KaCkA=
github.com/ezbastion/ezb_lib v0.1.0/go.mod h1:F6U708XN/ROG+xnFvOw6KcBR1RR5Ggvyr9YQGosdA9M=
github.com/gin-contrib/location v0.0.1 h1:5ZtqDL5WA6YXNuT5nGp55K3QSqJMYIl+2d7Lnwh9SGA=
github.com/gin-contrib/location v0.0.1/go.mod h1:9C1YVXyynELHLp926mcsDIndz4Qi+epKkE++ap5il3U=
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607 h1:MrIm8EEPue08JS4eh+b08IOG+wd0WRWEHWnewNfWFX0=
github.com/gin-gonic/contrib v0.0.0-20191209060500-d6e26eeaa607/go.mod h1:iqneQ2Df3omzIVTkIfn7c1acsVnMGiSLn4XF5Blh3Yg=
github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
github.com/gin-gonic/gin v1.5.0 h1:fi+bqFAx/oLK54somfCtEZs9HeH1LHVoEPUgARpTqyc=
github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do=
github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc=
github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM=
github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM=
github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY=
github.com/go-resty/resty/v2 v2.1.0 h1:Z6IefCpUMfnvItVJaJXWv/pMiiD11So35QgwEELsldE=
github.com/go-resty/resty/v2 v2.1.0/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8=
github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw=
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
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/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo=
github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c h1:jceGD5YNJGgGMkJz79agzOln1K9TaZUjv5ird16qniQ=
golang.org/x/sys v0.0.0-20200219091948-cb0a6d8edb6c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM=
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc=
gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
3 changes: 0 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
//go:generate goversioninfo

// This file is part of ezBastion.

// ezBastion is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// ezBastion is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.

// You should have received a copy of the GNU Affero General Public License
// along with ezBastion. If not, see <https://www.gnu.org/licenses/>.

Expand Down
5 changes: 3 additions & 2 deletions middleware/internalWork.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"github.com/ezbastion/ezb_srv/models"

"github.com/gin-gonic/gin"
"github.com/go-resty/resty"
"github.com/go-resty/resty/v2"
log "github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -127,7 +127,8 @@ func authorize(c *gin.Context, storage cache.Storage, conf *models.Configuration
return "", err
}
var respStruct map[string]interface{}
resp, err := resty.R().
client := resty.New()
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("X-Track", trace.Xtrack).
SetBody(&formauth).
Expand Down
5 changes: 3 additions & 2 deletions middleware/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (

jwt "github.com/dgrijalva/jwt-go"
"github.com/gin-gonic/gin"
"github.com/go-resty/resty"
"github.com/go-resty/resty/v2"
log "github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -126,7 +126,8 @@ func Introspection(c *gin.Context, sub string, Account models.EzbAccounts) (err
Url, _ = url.Parse(Account.STA.EndPoint)
Url.Path = "/access"
var introspec Introspec
resp, err := resty.R().
client := resty.New()
resp, err := client.R().
SetHeader("Accept", "application/json").
SetHeader("Authorization", c.GetHeader("Authorization")).
SetResult(&introspec).
Expand Down
5 changes: 5 additions & 0 deletions middleware/routeParser.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func RouteParser(c *gin.Context) {
c.AbortWithError(http.StatusForbidden, errors.New("#P0004"))
return
}
logg.Debug("found ", len(CurrentAction), " api matching ver, ctrl, act")
// fmt.Println(CurrentAction)
// c.Set("CurrentAction", CurrentAction)
apiPath, _ := c.Get("apiPath")
Expand All @@ -123,6 +124,10 @@ func RouteParser(c *gin.Context) {
}
}
c.Set("apiPath", nil)
if len(mapping) == 0 {
logg.Error("NO API MATCH ", escapedPath)
// TODO: test it
}
// var matchApiID []int
matchApiID := make(map[int]string)
for i, rx := range mapping {
Expand Down
2 changes: 1 addition & 1 deletion middleware/startTrace.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
func StartTrace(c *gin.Context) {
var l models.EzbLogs
l.Date = time.Now().UTC()
x, _ := uuid.NewV4()
x := uuid.NewV4()
l.Xtrack = x.String()
l.Status = "init"
l.URL = c.Request.RequestURI
Expand Down
Loading

0 comments on commit c47d68c

Please sign in to comment.