mirror of
https://github.com/openziti/zrok.git
synced 2024-11-22 08:03:49 +01:00
check service/refresh missing services zrok proxy fix (#27)
This commit is contained in:
parent
def97a564d
commit
b3939dbd84
8
go.mod
8
go.mod
@ -19,8 +19,8 @@ require (
|
||||
github.com/michaelquigley/pfxlog v0.6.9
|
||||
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d
|
||||
github.com/openziti/edge v0.22.39
|
||||
github.com/openziti/foundation/v2 v2.0.1
|
||||
github.com/openziti/sdk-golang v0.16.103
|
||||
github.com/openziti/foundation/v2 v2.0.2
|
||||
github.com/openziti/sdk-golang v0.16.105
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rubenv/sql-migrate v1.1.2
|
||||
github.com/shirou/gopsutil/v3 v3.22.7
|
||||
@ -60,7 +60,7 @@ require (
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/openziti/channel v0.18.58 // indirect
|
||||
github.com/openziti/identity v1.0.5 // indirect
|
||||
github.com/openziti/metrics v1.0.2 // indirect
|
||||
github.com/openziti/metrics v1.0.3 // indirect
|
||||
github.com/openziti/transport/v2 v2.0.20 // indirect
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.0 // indirect
|
||||
github.com/parallaxsecond/parsec-client-go v0.0.0-20220111122524-cb78842db373 // indirect
|
||||
@ -77,7 +77,7 @@ require (
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
|
||||
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
16
go.sum
16
go.sum
@ -396,14 +396,14 @@ github.com/openziti/channel v0.18.58 h1:kTJGaH9/b6bvQnpEjaFFkBSJYvmWVLXuMk4foUuc
|
||||
github.com/openziti/channel v0.18.58/go.mod h1:2VK/VwFpre30GIPfzd0cPBXN5GmyKaiBJGHdpKcxiDo=
|
||||
github.com/openziti/edge v0.22.39 h1:vxILPpjf4pk2Ha1ga3vlbvYrDFgoA71lc46z8fQIwGs=
|
||||
github.com/openziti/edge v0.22.39/go.mod h1:0jSUt6SdibB9zYhYsCF8+NGpKyUwihm7N+tr05V7DPk=
|
||||
github.com/openziti/foundation/v2 v2.0.1 h1:HKYwAyxlZ4zmlt0t9Y/v6SWso0qUaeWapkWOlQDKPEk=
|
||||
github.com/openziti/foundation/v2 v2.0.1/go.mod h1:L75kwCC5WTUPqxuAd3G+WMBompaElMb/nYlJjR1sJ9Q=
|
||||
github.com/openziti/foundation/v2 v2.0.2 h1:mRmBgVSMLmySpORIbCEuFEH+8AUKasAnSAH5HLMKFEM=
|
||||
github.com/openziti/foundation/v2 v2.0.2/go.mod h1:L75kwCC5WTUPqxuAd3G+WMBompaElMb/nYlJjR1sJ9Q=
|
||||
github.com/openziti/identity v1.0.5 h1:PKW1tj0ctOWgscL3P4gKiVFfKrP6dYeP0U6R8Aw6DKM=
|
||||
github.com/openziti/identity v1.0.5/go.mod h1:Nxf0CPFPkvdtFGvvsP4I/eZ//flU0q+sJVnLZDzlFOE=
|
||||
github.com/openziti/metrics v1.0.2 h1:X3ip93aDDgVeyhqxBLVwCtdG7/kILktFxcpl5N2+4+E=
|
||||
github.com/openziti/metrics v1.0.2/go.mod h1:30EzUXm/VJfTVNoqPLx4x3mC/eslpCeh6wc4ejbZR/g=
|
||||
github.com/openziti/sdk-golang v0.16.103 h1:NNztHODL4teeVuAXa+5zq5XRCit23DrrjYV6r/VOL5U=
|
||||
github.com/openziti/sdk-golang v0.16.103/go.mod h1:4xZ7kwoXWrlYIFQIcNHNT1o7FaBrE3A/KJ3H94XD1Ro=
|
||||
github.com/openziti/metrics v1.0.3 h1:eS+DPbD1lfXOcFZWRuLz9Hhw+r5LgMwdczw4kXY+C/g=
|
||||
github.com/openziti/metrics v1.0.3/go.mod h1:SeALokb6OJrCRwqX8U8EpnXDQBe/OkMuQLlU5zgOadQ=
|
||||
github.com/openziti/sdk-golang v0.16.105 h1:xUIaSmS8cA9TrRx8uBKJ2My+ZVH8v43Wvqt14DtwXQk=
|
||||
github.com/openziti/sdk-golang v0.16.105/go.mod h1:xR8u1NrDGWfDtItVfsblgW8GZq168/SKpISx2nZ+s+I=
|
||||
github.com/openziti/transport/v2 v2.0.20 h1:5qn+d7qTb0KpjdHRac7yWmvaQ8wsKdm7SJOnwkXLAPY=
|
||||
github.com/openziti/transport/v2 v2.0.20/go.mod h1:9ZzJLGjaAgG4mOzrUhk2YLRisl3JIDNCjCEWU+JcS5o=
|
||||
github.com/orcaman/concurrent-map/v2 v2.0.0 h1:iSMwuBQvQ1nX5i9gYuGMiSy0fjWHmazdjF+NdSO9JzI=
|
||||
@ -888,8 +888,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
|
||||
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/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=
|
||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
||||
google.golang.org/protobuf v1.28.1/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 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
@ -16,7 +16,7 @@ func Run(cfg *Config) error {
|
||||
return errors.Wrap(err, "error loading config")
|
||||
}
|
||||
zCtx := ziti.NewContextWithConfig(zCfg)
|
||||
zDialCtx := util.ZitiDialContext{Context: zCtx}
|
||||
zDialCtx := ZitiDialContext{Context: zCtx}
|
||||
zTransport := http.DefaultTransport.(*http.Transport).Clone()
|
||||
zTransport.DialContext = zDialCtx.Dial
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
package util
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/openziti/sdk-golang/ziti"
|
||||
"github.com/sirupsen/logrus"
|
||||
"net"
|
||||
"strings"
|
||||
)
|
||||
@ -13,5 +14,10 @@ type ZitiDialContext struct {
|
||||
|
||||
func (self *ZitiDialContext) Dial(_ context.Context, _ string, addr string) (net.Conn, error) {
|
||||
service := strings.Split(addr, ":")[0] // ignore :port (we get passed 'host:port')
|
||||
_, found := self.Context.GetService(service)
|
||||
if !found {
|
||||
logrus.Infof("service '%v' not cached; refreshing", service)
|
||||
self.Context.RefreshServices()
|
||||
}
|
||||
return self.Context.Dial(service)
|
||||
}
|
Loading…
Reference in New Issue
Block a user