From 0c84601cd0153b60003d453cb15620757daba449 Mon Sep 17 00:00:00 2001 From: Paul Lorenz Date: Wed, 12 Jul 2023 04:14:37 -0400 Subject: [PATCH] Update for link management changes --- .../handler_edge_ctrl/create_terminator.go | 9 +- go.mod | 10 +- go.sum | 19 ++-- router/xgress_edge/certchecker_test.go | 97 ++++++++++++++++--- 4 files changed, 100 insertions(+), 35 deletions(-) diff --git a/controller/handler_edge_ctrl/create_terminator.go b/controller/handler_edge_ctrl/create_terminator.go index 304f2e22..8dedd978 100644 --- a/controller/handler_edge_ctrl/create_terminator.go +++ b/controller/handler_edge_ctrl/create_terminator.go @@ -92,11 +92,7 @@ func (self *createTerminatorHandler) CreateTerminator(ctx *CreateTerminatorReque return } - id, err := idgen.NewUUIDString() - if err != nil { - self.returnError(ctx, internalError(err)) - return - } + id := idgen.NewUUIDString() terminator := &network.Terminator{ BaseEntity: models.BaseEntity{ @@ -120,8 +116,7 @@ func (self *createTerminatorHandler) CreateTerminator(ctx *CreateTerminatorReque Entity: terminator, Context: ctx.newChangeContext(), } - err = self.appEnv.GetHostController().GetNetwork().Managers.Command.Dispatch(cmd) - if err != nil { + if err := self.appEnv.GetHostController().GetNetwork().Managers.Command.Dispatch(cmd); err != nil { self.returnError(ctx, internalError(err)) return } diff --git a/go.mod b/go.mod index 906b8ce9..09354840 100644 --- a/go.mod +++ b/go.mod @@ -30,14 +30,14 @@ require ( github.com/mitchellh/mapstructure v1.5.0 github.com/openziti/channel/v2 v2.0.91 github.com/openziti/edge-api v0.25.31 - github.com/openziti/fabric v0.23.54 + github.com/openziti/fabric v0.24.1 github.com/openziti/foundation/v2 v2.0.29 github.com/openziti/identity v1.0.60 github.com/openziti/jwks v1.0.3 github.com/openziti/metrics v1.2.31 github.com/openziti/sdk-golang v0.20.90 github.com/openziti/secretstream v0.1.10 - github.com/openziti/storage v0.2.11 + github.com/openziti/storage v0.2.12 github.com/openziti/transport/v2 v2.0.99 github.com/openziti/x509-claims v1.0.3 github.com/openziti/xweb/v2 v2.1.0 @@ -126,17 +126,17 @@ require ( github.com/shirou/gopsutil/v3 v3.23.7 // indirect github.com/shoenig/go-m1cpu v0.1.6 // indirect github.com/speps/go-hashids v2.0.0+incompatible // indirect - github.com/tklauser/go-sysconf v0.3.11 // indirect + github.com/tklauser/go-sysconf v0.3.12 // indirect github.com/tklauser/numcpus v0.6.1 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect - go.mongodb.org/mongo-driver v1.12.0 // indirect + go.mongodb.org/mongo-driver v1.12.1 // indirect go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect go.opentelemetry.io/otel v1.16.0 // indirect go.opentelemetry.io/otel/metric v1.16.0 // indirect go.opentelemetry.io/otel/trace v1.16.0 // indirect - golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect + golang.org/x/exp v0.0.0-20230807204917-050eac23e9de // indirect golang.org/x/mod v0.11.0 // indirect golang.org/x/net v0.14.0 // indirect golang.org/x/oauth2 v0.10.0 // indirect diff --git a/go.sum b/go.sum index 541bd2c7..1b8bf2bc 100644 --- a/go.sum +++ b/go.sum @@ -494,8 +494,8 @@ github.com/openziti/channel/v2 v2.0.91 h1:HKD7uniGOfiQfbzaP1AJ0JGvls7oejC+fMj6gL github.com/openziti/channel/v2 v2.0.91/go.mod h1:2uJzEV3pX4soPPl07l8ScONNGuSQTQzUqAYkgATA3Rk= github.com/openziti/edge-api v0.25.31 h1:KiM4pQVIqy/0CN/FW2AgoN7PcejB+y8FdgjN86Jn83Q= github.com/openziti/edge-api v0.25.31/go.mod h1:7fyXLqNcyC5IG29GuI8danhhppAaxRV6HiCLwN1Kk64= -github.com/openziti/fabric v0.23.54 h1:iiFRHoGcwyPiaDMnL618aZ1ZmiJZ+59P7mtxLt1t2s4= -github.com/openziti/fabric v0.23.54/go.mod h1:tLjBByqe3Um+U9sO2wsqkmXXwm95U0K4+io9r5H2otE= +github.com/openziti/fabric v0.24.1 h1:2BDvNG926025n2XBD/FrUBGeXeuJTGOU4szl/RgfomI= +github.com/openziti/fabric v0.24.1/go.mod h1:rXhb73v5rgoUV1AbRDXF8gAcbualabJU9YyLMkiB0yw= github.com/openziti/foundation/v2 v2.0.29 h1:E63p5/esqOJ/OSMePR3fKYHb3Wq2BR4PLkDFynESij8= github.com/openziti/foundation/v2 v2.0.29/go.mod h1:MpXSCSn4MABvtIXzfTBFqhK5pNsNXHWnR8xxVrfxn0g= github.com/openziti/identity v1.0.60 h1:6gvBXY9J6F7SbuksdxsUA1t1WmtsFfY61Oqm/00ijGU= @@ -508,8 +508,8 @@ github.com/openziti/sdk-golang v0.20.90 h1:QXWa1Ti1Sky9D2uv3kAxmybwicZLJH6hgyDpX github.com/openziti/sdk-golang v0.20.90/go.mod h1:IorK7wik0unGAGBuYjdb9ZPFX7ENACtxFpWuTBPOT9Q= github.com/openziti/secretstream v0.1.10 h1:aLheoP6vVAv96mItwkXxWr9Ym0tTooJ5o9H1j2fAh04= github.com/openziti/secretstream v0.1.10/go.mod h1:HrS6P9G0jjHNHuKESMaybNdxBHjD1b0SzxSi0rDzshY= -github.com/openziti/storage v0.2.11 h1:Ws23any7NtbEKQroFJt6DJmeEFGMPjZqjAK2/Re9LIE= -github.com/openziti/storage v0.2.11/go.mod h1:M46XIxPYwTDTgaamI6o9cyEJkYvUYfhJjwvZtQu4tUQ= +github.com/openziti/storage v0.2.12 h1:ghQkt3SCLwRuiTeRLOUWgNL69XQNp9Gx8K3eVw0QTQY= +github.com/openziti/storage v0.2.12/go.mod h1:RxWIe9FyQg9LZQFZ4FuUROf0lhnfUW2XeWfTbHAMGeY= github.com/openziti/transport/v2 v2.0.99 h1:+/DYNzaUrzSSaoKEBNFumXJsXMDEUNiWbWZfX48Z2vc= github.com/openziti/transport/v2 v2.0.99/go.mod h1:bV9XKtxnmqW8crReZB2z+cJhSNLl6EsyoouTkyUY8mk= github.com/openziti/x509-claims v1.0.3 h1:HNdQ8Nf1agB3lBs1gahcO6zfkeS4S5xoQ2/PkY4HRX0= @@ -621,8 +621,9 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125 h1:3SNcvBmEPE1YlB1JpVZouslJpI3GBNoiqW7+wb0Rz7w= github.com/teris-io/shortid v0.0.0-20201117134242-e59966efd125/go.mod h1:M8agBzgqHIhgj7wEn9/0hJUZcrvt9VY+Ln+S1I5Mha0= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM= github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI= +github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU= +github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI= github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4= github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk= github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY= @@ -663,8 +664,8 @@ go.etcd.io/etcd/client/v2 v2.305.0/go.mod h1:h9puh54ZTgAKtEbut2oe9P4L/oqKCVB6xsX go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= -go.mongodb.org/mongo-driver v1.12.0 h1:aPx33jmn/rQuJXPQLZQ8NtfPQG8CaqgLThFtqRb0PiE= -go.mongodb.org/mongo-driver v1.12.0/go.mod h1:AZkxhPnFJUoH7kZlFkVKucV20K387miPfm7oimrSmK0= +go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE= +go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ= go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 h1:CCriYyAfq1Br1aIYettdHZTy8mBTIPo7We18TuO/bak= go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= @@ -711,8 +712,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 h1:MGwJjxBy0HJshjDNfLsYO8xppfqWlA5ZT9OhtUUhTNw= -golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20230807204917-050eac23e9de h1:l5Za6utMv/HsBWWqzt4S8X17j+kt1uVETUX5UFhn2rE= +golang.org/x/exp v0.0.0-20230807204917-050eac23e9de/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= diff --git a/router/xgress_edge/certchecker_test.go b/router/xgress_edge/certchecker_test.go index 28cfe49e..80918714 100644 --- a/router/xgress_edge/certchecker_test.go +++ b/router/xgress_edge/certchecker_test.go @@ -12,11 +12,13 @@ import ( "github.com/openziti/edge/router/internal/edgerouter" "github.com/openziti/fabric/router/env" "github.com/openziti/foundation/v2/tlz" + "github.com/openziti/foundation/v2/versions" "github.com/openziti/identity" "github.com/openziti/transport/v2" "github.com/pkg/errors" "github.com/stretchr/testify/require" "math/big" + "net" "sync/atomic" "testing" "time" @@ -563,6 +565,76 @@ func newCertChecker() (*CertExpirationChecker, func()) { return NewCertExpirationChecker(id, &edgerouter.Config{}, ctrls, closeNotify), func() { close(closeNotify) } } +type simpleTestUnderlay struct{} + +func (s simpleTestUnderlay) Rx() (*channel.Message, error) { + panic("implement me") +} + +func (s simpleTestUnderlay) Tx(*channel.Message) error { + panic("implement me") +} + +func (s simpleTestUnderlay) Id() string { + return "id-test" +} + +func (s simpleTestUnderlay) LogicalName() string { + return "logical-test" +} + +func (s simpleTestUnderlay) ConnectionId() string { + return "conn-test" +} + +func (s simpleTestUnderlay) Certificates() []*x509.Certificate { + panic("implement me") +} + +func (s simpleTestUnderlay) Label() string { + return "label-test" +} + +func (s simpleTestUnderlay) Close() error { + panic("implement me") +} + +func (s simpleTestUnderlay) IsClosed() bool { + return false +} + +func (s simpleTestUnderlay) Headers() map[int32][]byte { + v, err := versions.StdVersionEncDec.Encode(&versions.VersionInfo{ + Version: "0.0.0", + Revision: "1", + BuildDate: "2000-01-01", + OS: "linux", + Arch: "amd64", + }) + if err != nil { + panic(err) + } + return map[int32][]byte{ + channel.HelloVersionHeader: v, + } +} + +func (s simpleTestUnderlay) SetWriteTimeout(time.Duration) error { + panic("implement me") +} + +func (s simpleTestUnderlay) SetWriteDeadline(time.Time) error { + panic("implement me") +} + +func (s simpleTestUnderlay) GetLocalAddr() net.Addr { + panic("implement me") +} + +func (s simpleTestUnderlay) GetRemoteAddr() net.Addr { + panic("implement me") +} + type simpleTestChannel struct { isClosed bool } @@ -571,28 +643,28 @@ func (ch *simpleTestChannel) Bind(h channel.BindHandler) error { return h.BindChannel(ch) } -func (ch *simpleTestChannel) AddPeekHandler(h channel.PeekHandler) { +func (ch *simpleTestChannel) AddPeekHandler(channel.PeekHandler) { } -func (ch *simpleTestChannel) AddTransformHandler(h channel.TransformHandler) { +func (ch *simpleTestChannel) AddTransformHandler(channel.TransformHandler) { } -func (ch *simpleTestChannel) AddReceiveHandler(contentType int32, h channel.ReceiveHandler) { +func (ch *simpleTestChannel) AddReceiveHandler(int32, channel.ReceiveHandler) { } -func (ch *simpleTestChannel) AddReceiveHandlerF(contentType int32, h channel.ReceiveHandlerF) { +func (ch *simpleTestChannel) AddReceiveHandlerF(int32, channel.ReceiveHandlerF) { } -func (ch *simpleTestChannel) AddTypedReceiveHandler(h channel.TypedReceiveHandler) { +func (ch *simpleTestChannel) AddTypedReceiveHandler(channel.TypedReceiveHandler) { } -func (ch *simpleTestChannel) AddErrorHandler(h channel.ErrorHandler) { +func (ch *simpleTestChannel) AddErrorHandler(channel.ErrorHandler) { } -func (ch *simpleTestChannel) AddCloseHandler(h channel.CloseHandler) { +func (ch *simpleTestChannel) AddCloseHandler(channel.CloseHandler) { } -func (ch *simpleTestChannel) SetUserData(data interface{}) { +func (ch *simpleTestChannel) SetUserData(interface{}) { } func (ch *simpleTestChannel) GetUserData() interface{} { @@ -603,19 +675,16 @@ func (ch *simpleTestChannel) GetChannel() channel.Channel { return ch } -func (ch *simpleTestChannel) TrySend(s channel.Sendable) (bool, error) { - //TODO implement me +func (ch *simpleTestChannel) TrySend(channel.Sendable) (bool, error) { panic("implement me") } -func (ch *simpleTestChannel) Send(s channel.Sendable) error { - //TODO implement me +func (ch *simpleTestChannel) Send(channel.Sendable) error { panic("implement me") } func (ch *simpleTestChannel) Underlay() channel.Underlay { - //TODO implement me - panic("implement me") + return simpleTestUnderlay{} } func (ch *simpleTestChannel) StartRx() {