diff --git a/.gitignore b/.gitignore index faac172..7e43eda 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ cmd/http-check/http-check -cmd/http-check-server/http-check-server \ No newline at end of file +cmd/http-check-server/http-check-server +artifacts/ diff --git a/cmd/http-check-server/main.go b/cmd/http-check-server/main.go index 1eba9ef..c658d32 100644 --- a/cmd/http-check-server/main.go +++ b/cmd/http-check-server/main.go @@ -9,8 +9,8 @@ import ( "github.com/pkg/errors" - "github.com/MauveSoftware/http-check/pb" - "github.com/MauveSoftware/http-check/pkg/server" + "github.com/MauveSoftware/http-check/internal/api" + "github.com/MauveSoftware/http-check/internal/server" "github.com/sirupsen/logrus" "google.golang.org/grpc" @@ -18,7 +18,7 @@ import ( ) const ( - version = "0.3.2" + version = "0.3.3" ) var ( @@ -46,7 +46,7 @@ func main() { srv := grpc.NewServer() logrus.Infof("Starting %d workers", *workerCount) s := server.New(*workerCount, *timeout, *tlsTimeout) - pb.RegisterHttpCheckServiceServer(srv, s) + api.RegisterHttpCheckServiceServer(srv, s) logrus.Infof("Listen for connections on socket %s", *socketPath) go logrus.Error(srv.Serve(lis)) diff --git a/cmd/http-check/main.go b/cmd/http-check/main.go index 20c7d1f..9b364f1 100644 --- a/cmd/http-check/main.go +++ b/cmd/http-check/main.go @@ -7,14 +7,14 @@ import ( "os" "time" - "github.com/MauveSoftware/http-check/pb" + "github.com/MauveSoftware/http-check/internal/api" "github.com/sirupsen/logrus" "google.golang.org/grpc" "gopkg.in/alecthomas/kingpin.v2" ) const ( - version = "0.3.1" + version = "0.3.2" ) var ( @@ -56,9 +56,9 @@ func runCheck() { } defer conn.Close() - c := pb.NewHttpCheckServiceClient(conn) + c := api.NewHttpCheckServiceClient(conn) - req := &pb.Request{ + req := &api.Request{ Protocol: *protocol, Host: *host, Path: *path, diff --git a/go.mod b/go.mod index dca233a..c3676ef 100644 --- a/go.mod +++ b/go.mod @@ -1,25 +1,25 @@ module github.com/MauveSoftware/http-check -go 1.17 +go 1.18 require ( github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect - github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect + github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect github.com/golang/protobuf v1.5.2 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.8.1 - github.com/stretchr/testify v1.7.0 - google.golang.org/grpc v1.41.0 + github.com/stretchr/testify v1.8.0 + google.golang.org/grpc v1.47.0 gopkg.in/alecthomas/kingpin.v2 v2.2.6 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/net v0.0.0-20200822124328-c89045814202 // indirect - golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd // indirect - golang.org/x/text v0.3.0 // indirect - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect - google.golang.org/protobuf v1.26.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect + golang.org/x/net v0.0.0-20220708220712-1185a9018129 // indirect + golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d // indirect + golang.org/x/text v0.3.7 // indirect + google.golang.org/genproto v0.0.0-20220711132622-b6f31b0ceb50 // indirect + google.golang.org/protobuf v1.28.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index cbad31a..fc27439 100644 --- a/go.sum +++ b/go.sum @@ -3,15 +3,18 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a h1:E/8AP5dFtMhl5KPJz66Kt9G0n+7Sn41Fy1wv9/jHOrc= -github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= 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= @@ -19,7 +22,7 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -43,8 +46,9 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -56,11 +60,14 @@ github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6L github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -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.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -74,8 +81,11 @@ golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73r golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20220708220712-1185a9018129 h1:vucSRfWwTsoXro7P+3Cjlr6flUMtzCwzlvkxEQtHHB0= +golang.org/x/net v0.0.0-20220708220712-1185a9018129/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -86,10 +96,21 @@ golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d h1:/m5NbqQelATgoSPVC2Z23sR4kVNokFwDDyWh/3rGY+I= +golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 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.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -102,16 +123,17 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20220711132622-b6f31b0ceb50 h1:gyHXMCq6jOxTS4ywai4Ht8kjJcDRxkmtCJERlZ3nGms= +google.golang.org/genproto v0.0.0-20220711132622-b6f31b0ceb50/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.41.0 h1:f+PlOh7QV4iIJkPrx5NQ7qaNGFQ3OTse67yaDHfju4E= -google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= +google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -122,15 +144,18 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= 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/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pb/build.sh b/internal/api/build.sh similarity index 100% rename from pb/build.sh rename to internal/api/build.sh diff --git a/pb/service.pb.go b/internal/api/service.pb.go similarity index 78% rename from pb/service.pb.go rename to internal/api/service.pb.go index 7e22575..64f52d3 100644 --- a/pb/service.pb.go +++ b/internal/api/service.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: service.proto -package pb +package api import ( context "context" @@ -199,36 +199,36 @@ func (m *Response) GetDebugMessage() string { } func init() { - proto.RegisterType((*Request)(nil), "pb.Request") - proto.RegisterType((*Response)(nil), "pb.Response") + proto.RegisterType((*Request)(nil), "api.Request") + proto.RegisterType((*Response)(nil), "api.Response") } func init() { proto.RegisterFile("service.proto", fileDescriptor_a0b84a42fa06f626) } var fileDescriptor_a0b84a42fa06f626 = []byte{ - // 341 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0xbf, 0x4e, 0xc3, 0x30, - 0x10, 0xc6, 0x49, 0xff, 0xa6, 0x6e, 0x83, 0x8a, 0xe9, 0x60, 0x75, 0x8a, 0x0a, 0x43, 0xa6, 0x08, - 0xc1, 0xc2, 0x4c, 0x41, 0x62, 0x61, 0x71, 0x1f, 0x20, 0x4a, 0xec, 0x53, 0x5b, 0x41, 0x6b, 0xe3, - 0x73, 0xa0, 0x79, 0x63, 0x1e, 0x03, 0xd9, 0x4e, 0x2a, 0xd8, 0xee, 0xf7, 0x7d, 0x97, 0x2f, 0xbe, - 0x3b, 0x92, 0x20, 0x98, 0xaf, 0xbd, 0x80, 0x5c, 0x1b, 0x65, 0x15, 0xed, 0xe9, 0x6a, 0xf5, 0xd3, - 0x23, 0x63, 0x0e, 0x9f, 0x35, 0xa0, 0xa5, 0x4b, 0x12, 0x7b, 0x43, 0xa8, 0x0f, 0x16, 0xa5, 0x51, - 0x36, 0xe1, 0x67, 0xa6, 0x94, 0x0c, 0x76, 0x0a, 0x2d, 0xeb, 0x79, 0xdd, 0xd7, 0x4e, 0xd3, 0xa5, - 0xdd, 0xb1, 0x7e, 0xd0, 0x5c, 0xed, 0x32, 0x6a, 0x04, 0x73, 0x2c, 0x0f, 0xc0, 0x06, 0x21, 0xa3, - 0x63, 0x9f, 0x5f, 0x22, 0x7e, 0x2b, 0x23, 0xd9, 0xb0, 0xcd, 0x6f, 0x99, 0xde, 0x91, 0x05, 0x9c, - 0x34, 0x08, 0x0b, 0xb2, 0x40, 0x5b, 0xda, 0x1a, 0x0b, 0xa1, 0x24, 0xb0, 0x51, 0xda, 0xcf, 0x12, - 0x4e, 0x3b, 0x6f, 0xe3, 0xad, 0xb5, 0x92, 0x40, 0x6f, 0x48, 0x72, 0xfe, 0xa2, 0x52, 0xb2, 0x61, - 0x63, 0x1f, 0x39, 0xeb, 0xc4, 0x27, 0x25, 0x1b, 0x9a, 0x93, 0xeb, 0x7f, 0x4d, 0x85, 0x81, 0x2d, - 0x9c, 0x58, 0xec, 0x5b, 0xaf, 0xfe, 0xb6, 0x72, 0x67, 0xd0, 0x8c, 0xcc, 0x05, 0x18, 0x5b, 0xc0, - 0x49, 0xef, 0x0d, 0x14, 0xb2, 0x6c, 0x90, 0x4d, 0xd2, 0x28, 0x4b, 0xf8, 0xa5, 0xd3, 0x5f, 0xbc, - 0xfc, 0x5c, 0x36, 0x48, 0x17, 0x64, 0x28, 0xa1, 0xaa, 0xb7, 0x8c, 0xa4, 0x51, 0x16, 0xf3, 0x00, - 0x6e, 0xc4, 0xfd, 0x11, 0x41, 0xd4, 0x06, 0xd8, 0xd4, 0x1b, 0x67, 0x5e, 0x09, 0x12, 0x73, 0x40, - 0xad, 0x8e, 0x08, 0x94, 0x91, 0x31, 0xd6, 0x42, 0x00, 0xa2, 0xdf, 0x74, 0xcc, 0x3b, 0x74, 0xce, - 0x01, 0x10, 0xcb, 0x2d, 0xb4, 0xbb, 0xee, 0xd0, 0x0d, 0xec, 0x7f, 0x52, 0x74, 0x7e, 0xd8, 0xfb, - 0xcc, 0x8b, 0x6f, 0x41, 0xbb, 0x7f, 0x24, 0xf3, 0x57, 0x6b, 0xf5, 0x7a, 0x07, 0xe2, 0x7d, 0x13, - 0xae, 0x4d, 0x6f, 0xc9, 0xd0, 0x33, 0x9d, 0xe6, 0xba, 0xca, 0xdb, 0x6b, 0x2f, 0x67, 0x01, 0xc2, - 0x83, 0x56, 0x17, 0xd5, 0xc8, 0xdf, 0xfa, 0xe1, 0x37, 0x00, 0x00, 0xff, 0xff, 0x5a, 0xf5, 0xc0, - 0xb0, 0x25, 0x02, 0x00, 0x00, + // 345 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x91, 0xcf, 0x4e, 0xe3, 0x30, + 0x10, 0xc6, 0x37, 0xfd, 0x9b, 0x7a, 0x9b, 0x55, 0xd7, 0xdb, 0x83, 0xd5, 0x53, 0xd4, 0x95, 0x50, + 0x4e, 0x11, 0x82, 0x1b, 0x47, 0x0a, 0x12, 0x17, 0x2e, 0xee, 0x03, 0x44, 0xae, 0x3d, 0x6a, 0x23, + 0x68, 0x6d, 0x3c, 0x0e, 0x34, 0x6f, 0xcc, 0x63, 0x20, 0xdb, 0x49, 0x05, 0xb7, 0xf9, 0x7d, 0xdf, + 0xe4, 0x8b, 0x67, 0x86, 0x64, 0x08, 0xf6, 0xbd, 0x96, 0x50, 0x1a, 0xab, 0x9d, 0xa6, 0x43, 0x61, + 0xea, 0xf5, 0xe7, 0x80, 0x4c, 0x39, 0xbc, 0x35, 0x80, 0x8e, 0xae, 0x48, 0x1a, 0x1c, 0xa9, 0x5f, + 0x59, 0x92, 0x27, 0xc5, 0x8c, 0x5f, 0x98, 0x52, 0x32, 0x3a, 0x68, 0x74, 0x6c, 0x10, 0xf4, 0x50, + 0x7b, 0xcd, 0x08, 0x77, 0x60, 0xc3, 0xa8, 0xf9, 0xda, 0x67, 0x34, 0x08, 0xf6, 0x24, 0x8e, 0xc0, + 0x46, 0x31, 0xa3, 0xe7, 0x90, 0x2f, 0x10, 0x3f, 0xb4, 0x55, 0x6c, 0xdc, 0xe5, 0x77, 0x4c, 0xaf, + 0xc9, 0x12, 0xce, 0x06, 0xa4, 0x03, 0x55, 0xa1, 0x13, 0xae, 0xc1, 0x4a, 0x6a, 0x05, 0x6c, 0x92, + 0x0f, 0x8b, 0x8c, 0xd3, 0xde, 0xdb, 0x06, 0x6b, 0xa3, 0x15, 0xd0, 0xff, 0x24, 0xbb, 0x7c, 0xb1, + 0xd3, 0xaa, 0x65, 0xd3, 0x10, 0x39, 0xef, 0xc5, 0x7b, 0xad, 0x5a, 0x5a, 0x92, 0x7f, 0x3f, 0x9a, + 0x2a, 0x0b, 0x7b, 0x38, 0xb3, 0x34, 0xb4, 0xfe, 0xfd, 0xde, 0xca, 0xbd, 0x41, 0x0b, 0xb2, 0x90, + 0x60, 0x5d, 0x05, 0x67, 0x53, 0x5b, 0xa8, 0x94, 0x68, 0x91, 0xcd, 0xf2, 0xa4, 0xc8, 0xf8, 0x1f, + 0xaf, 0x3f, 0x06, 0xf9, 0x41, 0xb4, 0x48, 0x97, 0x64, 0xac, 0x60, 0xd7, 0xec, 0x19, 0xc9, 0x93, + 0x22, 0xe5, 0x11, 0xfc, 0x88, 0xf5, 0x09, 0x41, 0x36, 0x16, 0xd8, 0xef, 0x60, 0x5c, 0x78, 0x2d, + 0x49, 0xca, 0x01, 0x8d, 0x3e, 0x21, 0x50, 0x46, 0xa6, 0xd8, 0x48, 0x09, 0x88, 0x61, 0xd3, 0x29, + 0xef, 0xd1, 0x3b, 0x47, 0x40, 0x14, 0x7b, 0xe8, 0x76, 0xdd, 0xa3, 0x1f, 0x38, 0xfc, 0xa4, 0xea, + 0xfd, 0xb8, 0xf7, 0x79, 0x10, 0x9f, 0xa3, 0x76, 0x73, 0x47, 0x16, 0x4f, 0xce, 0x99, 0xcd, 0x01, + 0xe4, 0xcb, 0x36, 0x9e, 0x9b, 0x5e, 0x91, 0x71, 0x60, 0x3a, 0x2f, 0x85, 0xa9, 0xcb, 0xee, 0xdc, + 0xab, 0xac, 0xa3, 0xf8, 0xa4, 0xf5, 0xaf, 0xdd, 0x24, 0x5c, 0xfb, 0xf6, 0x2b, 0x00, 0x00, 0xff, + 0xff, 0x52, 0xeb, 0xa1, 0x78, 0x28, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -256,7 +256,7 @@ func NewHttpCheckServiceClient(cc *grpc.ClientConn) HttpCheckServiceClient { func (c *httpCheckServiceClient) Check(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { out := new(Response) - err := c.cc.Invoke(ctx, "/pb.HttpCheckService/Check", in, out, opts...) + err := c.cc.Invoke(ctx, "/api.HttpCheckService/Check", in, out, opts...) if err != nil { return nil, err } @@ -290,7 +290,7 @@ func _HttpCheckService_Check_Handler(srv interface{}, ctx context.Context, dec f } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/pb.HttpCheckService/Check", + FullMethod: "/api.HttpCheckService/Check", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(HttpCheckServiceServer).Check(ctx, req.(*Request)) @@ -299,7 +299,7 @@ func _HttpCheckService_Check_Handler(srv interface{}, ctx context.Context, dec f } var _HttpCheckService_serviceDesc = grpc.ServiceDesc{ - ServiceName: "pb.HttpCheckService", + ServiceName: "api.HttpCheckService", HandlerType: (*HttpCheckServiceServer)(nil), Methods: []grpc.MethodDesc{ { diff --git a/pb/service.proto b/internal/api/service.proto similarity index 97% rename from pb/service.proto rename to internal/api/service.proto index f36bd8f..ec981f5 100644 --- a/pb/service.proto +++ b/internal/api/service.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package pb; +package api; message Request { string protocol = 1; diff --git a/pkg/server/server.go b/internal/server/server.go similarity index 85% rename from pkg/server/server.go rename to internal/server/server.go index 6fde327..5986f3c 100644 --- a/pkg/server/server.go +++ b/internal/server/server.go @@ -7,7 +7,7 @@ import ( "net/http" "time" - "github.com/MauveSoftware/http-check/pb" + "github.com/MauveSoftware/http-check/internal/api" ) // HTTPCheckServer runs HTTP checks. It provides an gRPC interface to receive check tasks @@ -48,7 +48,7 @@ func (s *HTTPCheckServer) newHttpClient(insecure bool) *http.Client { var tr = &http.Transport{ Dial: (&net.Dialer{ Timeout: s.reqTimeout, - FallbackDelay: 100 * time.Microsecond, + FallbackDelay: 100 * time.Millisecond, }).Dial, TLSHandshakeTimeout: s.tlsTimeout, TLSClientConfig: &tls.Config{ @@ -62,8 +62,8 @@ func (s *HTTPCheckServer) newHttpClient(insecure bool) *http.Client { } // Check performs a http check and returns the check result -func (s *HTTPCheckServer) Check(ctx context.Context, in *pb.Request) (*pb.Response, error) { - respCh := make(chan *pb.Response, 1) +func (s *HTTPCheckServer) Check(ctx context.Context, in *api.Request) (*api.Response, error) { + respCh := make(chan *api.Response, 1) s.ch <- &task{ req: in, ch: respCh, diff --git a/pkg/server/worker.go b/internal/server/worker.go similarity index 84% rename from pkg/server/worker.go rename to internal/server/worker.go index 9d7a577..a5f24b3 100644 --- a/pkg/server/worker.go +++ b/internal/server/worker.go @@ -7,14 +7,14 @@ import ( "strings" "time" - "github.com/MauveSoftware/http-check/pb" + "github.com/MauveSoftware/http-check/internal/api" "github.com/MauveSoftware/http-check/pkg/check" "github.com/sirupsen/logrus" ) type task struct { - req *pb.Request - ch chan<- *pb.Response + req *api.Request + ch chan<- *api.Response } type worker struct { @@ -31,7 +31,7 @@ func (w *worker) run() { } } -func (w *worker) processRequest(req *pb.Request) *pb.Response { +func (w *worker) processRequest(req *api.Request) *api.Response { logrus.Infof("#%d: Processing check for %s", w.id, req.Host) out := &strings.Builder{} c := w.checkForRequest(req, out) @@ -40,21 +40,21 @@ func (w *worker) processRequest(req *pb.Request) *pb.Response { err := c.Run() if err != nil { - return &pb.Response{ + return &api.Response{ Success: false, Message: err.Error(), DebugMessage: out.String(), } } - return &pb.Response{ + return &api.Response{ Success: true, Message: fmt.Sprintf("Request took %v", time.Since(start)), DebugMessage: out.String(), } } -func (w *worker) checkForRequest(req *pb.Request, out io.Writer) *check.Check { +func (w *worker) checkForRequest(req *api.Request, out io.Writer) *check.Check { opts := []check.Option{} if len(req.Username) > 0 {