diff --git a/.fleet/settings.json b/.fleet/settings.json index 11805244..db008b26 100644 --- a/.fleet/settings.json +++ b/.fleet/settings.json @@ -1,3 +1,4 @@ { - "editor.guides": [] + "editor.guides": [], + "go.imports.params": "" } \ No newline at end of file diff --git a/cleanup.sh b/cleanup.sh index 2e00f061..4888f16e 100644 --- a/cleanup.sh +++ b/cleanup.sh @@ -4,7 +4,7 @@ wd=$(pwd) array1=( - contrib kit rony + contrib kit rony stub std/gateways/fasthttp std/gateways/fastws std/gateways/silverhttp std/clusters/rediscluster std/clusters/p2pcluster example/ex-01-rpc example/ex-02-rest example/ex-03-cluster diff --git a/example/ex-01-rpc/cmd/client/main.go b/example/ex-01-rpc/cmd/client/main.go index 2b474d46..690adca2 100644 --- a/example/ex-01-rpc/cmd/client/main.go +++ b/example/ex-01-rpc/cmd/client/main.go @@ -10,7 +10,7 @@ import ( "github.com/clubpay/ronykit/example/ex-01-rpc/dto" "github.com/clubpay/ronykit/kit" - "github.com/clubpay/ronykit/kit/stub" + "github.com/clubpay/ronykit/stub" ) func main() { diff --git a/example/ex-01-rpc/go.mod b/example/ex-01-rpc/go.mod index fea67246..3b9dacf3 100644 --- a/example/ex-01-rpc/go.mod +++ b/example/ex-01-rpc/go.mod @@ -3,6 +3,7 @@ module github.com/clubpay/ronykit/example/ex-01-rpc go 1.20 require ( + github.com/clubpay/ronykit v0.7.3 github.com/clubpay/ronykit/kit v0.14.6 github.com/clubpay/ronykit/std/gateways/fasthttp v0.14.6 github.com/clubpay/ronykit/std/gateways/fastws v0.14.6 @@ -31,7 +32,6 @@ require ( golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/example/ex-01-rpc/go.sum b/example/ex-01-rpc/go.sum index 5611b91a..8f11d6fe 100644 --- a/example/ex-01-rpc/go.sum +++ b/example/ex-01-rpc/go.sum @@ -1,5 +1,7 @@ github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= +github.com/clubpay/ronykit v0.7.3 h1:Q8H/VVOoHvPyg0aEC61Pt6SKHjYELhnD7uyioHe0/s8= +github.com/clubpay/ronykit v0.7.3/go.mod h1:tkwJK3UtgFpf688cQlE+gypnrI1CDA1bOAqyrNNHoxk= github.com/clubpay/ronykit/kit v0.14.6 h1:137cCnzMgAkts1/CzFfgReBxjRTB/d3gQ5p0QGBQNWc= github.com/clubpay/ronykit/kit v0.14.6/go.mod h1:NdIVC65RisZCCU5aACdxtovOVl3Cj+mQhPpUIjyG04Q= github.com/clubpay/ronykit/std/gateways/fasthttp v0.14.6 h1:MB20YVT+MU6hHW6A8YImMz1f9dB2P+PDvycLgH+xkLk= @@ -65,7 +67,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/example/ex-02-rest/cmd/client/main.go b/example/ex-02-rest/cmd/client/main.go index 8e7d44b8..dd2f66c5 100644 --- a/example/ex-02-rest/cmd/client/main.go +++ b/example/ex-02-rest/cmd/client/main.go @@ -8,7 +8,7 @@ import ( "github.com/clubpay/ronykit/example/ex-02-rest/dto" "github.com/clubpay/ronykit/example/ex-02-rest/stub/sampleservice" - "github.com/clubpay/ronykit/kit/stub" + "github.com/clubpay/ronykit/stub" ) func main() { diff --git a/example/ex-02-rest/go.mod b/example/ex-02-rest/go.mod index 4f7afde6..1fd04d64 100644 --- a/example/ex-02-rest/go.mod +++ b/example/ex-02-rest/go.mod @@ -4,6 +4,7 @@ go 1.20 require ( github.com/bytedance/sonic v1.11.7 + github.com/clubpay/ronykit v0.7.3 github.com/clubpay/ronykit/kit v0.14.3 github.com/clubpay/ronykit/std/gateways/fasthttp v0.14.3 ) @@ -30,6 +31,5 @@ require ( golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/example/ex-02-rest/go.sum b/example/ex-02-rest/go.sum index e04790e1..eb8b46bd 100644 --- a/example/ex-02-rest/go.sum +++ b/example/ex-02-rest/go.sum @@ -8,6 +8,8 @@ github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/ github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/clubpay/ronykit v0.7.3 h1:Q8H/VVOoHvPyg0aEC61Pt6SKHjYELhnD7uyioHe0/s8= +github.com/clubpay/ronykit v0.7.3/go.mod h1:tkwJK3UtgFpf688cQlE+gypnrI1CDA1bOAqyrNNHoxk= github.com/clubpay/ronykit/kit v0.14.3 h1:yn9SPxJZLXlshQtQKACbWGyDfUi30zzFP6GKNG04He0= github.com/clubpay/ronykit/kit v0.14.3/go.mod h1:5GlJkudFSdiMk3xxTS6bsx3WlgGvqHtDAirP8LP6ZN0= github.com/clubpay/ronykit/std/gateways/fasthttp v0.14.3 h1:tG5k/1yTVhEfv21RKpcIHFdYA/HS/ltauxvTExy4BH0= @@ -71,7 +73,6 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/example/ex-02-rest/stub/gen.go b/example/ex-02-rest/stub/gen.go index 505abb6d..01ae2a7c 100644 --- a/example/ex-02-rest/stub/gen.go +++ b/example/ex-02-rest/stub/gen.go @@ -4,7 +4,7 @@ package main import ( "github.com/clubpay/ronykit/example/ex-02-rest/api" - "github.com/clubpay/ronykit/kit/stub/stubgen" + "github.com/clubpay/ronykit/stubbgen" ) func main() { diff --git a/example/ex-02-rest/stub/sampleservice/stub.go b/example/ex-02-rest/stub/sampleservice/stub.go index b0a7f999..aab5155e 100755 --- a/example/ex-02-rest/stub/sampleservice/stub.go +++ b/example/ex-02-rest/stub/sampleservice/stub.go @@ -7,8 +7,8 @@ import ( "fmt" "github.com/clubpay/ronykit/kit" - "github.com/clubpay/ronykit/kit/stub" "github.com/clubpay/ronykit/kit/utils/reflector" + "github.com/clubpay/ronykit/stub" ) var _ fmt.Stringer diff --git a/example/ex-04-stubgen/api/service.go b/example/ex-04-stubgen/api/service.go index 092bb482..53d7a696 100644 --- a/example/ex-04-stubgen/api/service.go +++ b/example/ex-04-stubgen/api/service.go @@ -20,6 +20,7 @@ var SampleDesc desc.ServiceDescFunc = func() *desc.Service { SetOutput(&dto.VeryComplexResponse{}). NamedSelector("ComplexDummy", fasthttp.POST("/complexDummy")). NamedSelector("ComplexDummy2", fasthttp.POST("/complexDummy/:key1")). + NamedSelector("ComplexDummy3", fasthttp.RPC("complexDummy")). AddModifier(func(envelope *kit.Envelope) { envelope.SetHdr("X-Custom-Header", "justForTestingModifier") }). @@ -30,6 +31,7 @@ var SampleDesc desc.ServiceDescFunc = func() *desc.Service { SetInput(&dto.VeryComplexRequest{}). SetOutput(&dto.VeryComplexResponse{}). NamedSelector("GetComplexDummy", fasthttp.GET("/complexDummy/:key1/xs/:sKey1")). + NamedSelector("GetComplexDummy2", fasthttp.RPC("getComplexDummy")). AddModifier(func(envelope *kit.Envelope) { envelope.SetHdr("X-Custom-Header", "justForTestingModifier") }). diff --git a/example/ex-04-stubgen/go.mod b/example/ex-04-stubgen/go.mod index 71eafbfe..84a81ebe 100644 --- a/example/ex-04-stubgen/go.mod +++ b/example/ex-04-stubgen/go.mod @@ -3,6 +3,7 @@ module github.com/clubpay/ronykit/example/ex-04-stubgen go 1.20 require ( + github.com/clubpay/ronykit v0.7.3 github.com/clubpay/ronykit/kit v0.14.3 github.com/clubpay/ronykit/std/gateways/fasthttp v0.14.3 ) @@ -23,6 +24,5 @@ require ( github.com/valyala/tcplisten v1.0.0 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/example/ex-04-stubgen/go.sum b/example/ex-04-stubgen/go.sum index 66d69379..0881c9ff 100644 --- a/example/ex-04-stubgen/go.sum +++ b/example/ex-04-stubgen/go.sum @@ -1,5 +1,7 @@ github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= +github.com/clubpay/ronykit v0.7.3 h1:Q8H/VVOoHvPyg0aEC61Pt6SKHjYELhnD7uyioHe0/s8= +github.com/clubpay/ronykit v0.7.3/go.mod h1:tkwJK3UtgFpf688cQlE+gypnrI1CDA1bOAqyrNNHoxk= github.com/clubpay/ronykit/kit v0.14.3 h1:yn9SPxJZLXlshQtQKACbWGyDfUi30zzFP6GKNG04He0= github.com/clubpay/ronykit/kit v0.14.3/go.mod h1:5GlJkudFSdiMk3xxTS6bsx3WlgGvqHtDAirP8LP6ZN0= github.com/clubpay/ronykit/std/gateways/fasthttp v0.14.3 h1:tG5k/1yTVhEfv21RKpcIHFdYA/HS/ltauxvTExy4BH0= @@ -46,7 +48,6 @@ golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/example/ex-04-stubgen/stub/gen.go b/example/ex-04-stubgen/stub/gen.go index 9fbcdbcb..0b2f1b50 100644 --- a/example/ex-04-stubgen/stub/gen.go +++ b/example/ex-04-stubgen/stub/gen.go @@ -4,7 +4,7 @@ package main import ( "github.com/clubpay/ronykit/example/ex-04-stubgen/api" - "github.com/clubpay/ronykit/kit/stub/stubgen" + "github.com/clubpay/ronykit/stubbgen" ) func main() { diff --git a/example/ex-04-stubgen/stub/sampleservice/stub.go b/example/ex-04-stubgen/stub/sampleservice/stub.go index e143a467..8a33b0bc 100755 --- a/example/ex-04-stubgen/stub/sampleservice/stub.go +++ b/example/ex-04-stubgen/stub/sampleservice/stub.go @@ -7,7 +7,7 @@ import ( "fmt" "github.com/clubpay/ronykit/kit" - "github.com/clubpay/ronykit/kit/stub" + "github.com/clubpay/ronykit/stub" "github.com/clubpay/ronykit/kit/utils/reflector" ) @@ -215,6 +215,12 @@ func (s sampleServiceStub) GetComplexDummy( return res, nil } +func OnGetComplexDummy(ws *stub.WebsocketCtx, req *VeryComplexRequest) (*VeryComplexResponse, error) { + req := &VeryComplexRequest{} + ws. + +} + type MockOption func(*sampleServiceStubMock) func MockComplexDummy( diff --git a/go.work b/go.work index bfefbc66..bc1b8541 100644 --- a/go.work +++ b/go.work @@ -1,4 +1,4 @@ -go 1.22 +go 1.22.3 use ( ./contrib @@ -17,5 +17,6 @@ use ( ./std/gateways/fasthttp ./std/gateways/fastws ./std/gateways/silverhttp + ./stub ./testenv ) diff --git a/kit/conn.go b/kit/conn.go index f4370478..5e95c22e 100644 --- a/kit/conn.go +++ b/kit/conn.go @@ -1,5 +1,7 @@ package kit +import "io" + // Conn represents a connection between EdgeServer and client. type Conn interface { ConnID() uint64 @@ -25,3 +27,8 @@ type RESTConn interface { Redirect(code int, url string) WalkQueryParams(fn func(key string, val string) bool) } + +type RPCConn interface { + Conn + io.Writer +} diff --git a/kit/ctx_testkit.go b/kit/ctx_testkit.go index 0b73c658..01d9c540 100644 --- a/kit/ctx_testkit.go +++ b/kit/ctx_testkit.go @@ -66,6 +66,7 @@ func (testCtx *TestContext) Run(stream bool) error { return testCtx.expectFunc(conn.out...) } +// RunREST simulates a REST request. func (testCtx *TestContext) RunREST() error { ctx := newContext(&testCtx.ls) conn := newTestRESTConn() diff --git a/kit/go.mod b/kit/go.mod index 3f4b5ec4..4ab24058 100644 --- a/kit/go.mod +++ b/kit/go.mod @@ -3,31 +3,25 @@ module github.com/clubpay/ronykit/kit go 1.19 require ( - github.com/fasthttp/websocket v1.5.9 github.com/goccy/go-json v0.10.3 github.com/goccy/go-reflect v1.2.0 github.com/jedib0t/go-pretty/v6 v6.5.9 github.com/onsi/ginkgo/v2 v2.18.0 github.com/onsi/gomega v1.33.1 - github.com/valyala/fasthttp v1.54.0 - golang.org/x/net v0.25.0 gopkg.in/yaml.v3 v3.0.1 ) require ( - github.com/andybalholm/brotli v1.1.0 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect - github.com/klauspost/compress v1.17.8 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/mattn/go-runewidth v0.0.15 // indirect github.com/rivo/uniseg v0.4.3 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect - github.com/savsgio/gotils v0.0.0-20240303185622-093b76447511 // indirect github.com/stretchr/testify v1.9.0 // indirect - github.com/valyala/bytebufferpool v1.0.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.15.0 // indirect golang.org/x/tools v0.21.0 // indirect diff --git a/kit/go.sum b/kit/go.sum index 8cceb374..c183d435 100644 --- a/kit/go.sum +++ b/kit/go.sum @@ -1,9 +1,5 @@ -github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= -github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/fasthttp/websocket v1.5.9 h1:9deGuzYcCRKjk940kNwSN6Hd14hk4zYwropm4UsUIUQ= -github.com/fasthttp/websocket v1.5.9/go.mod h1:NLzHBFur260OMuZHohOfYQwMTpR7sfSpUnuqKxMpgKA= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= @@ -18,8 +14,6 @@ github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQN github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+UV8OU= github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= -github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= -github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -41,14 +35,8 @@ github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/savsgio/gotils v0.0.0-20240303185622-093b76447511 h1:KanIMPX0QdEdB4R3CiimCAbxFrhB3j7h0/OvpYGVQa8= -github.com/savsgio/gotils v0.0.0-20240303185622-093b76447511/go.mod h1:sM7Mt7uEoCeFSCBM+qBrqvEo+/9vdmj19wzp3yzUhmg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.54.0 h1:cCL+ZZR3z3HPLMVfEYVUMtJqVaui0+gu7Lx63unHwS0= -github.com/valyala/fasthttp v1.54.0/go.mod h1:6dt4/8olwq9QARP/TDuPmWyWcl4byhpvTJ4AAtcz+QM= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= diff --git a/std/clusters/rediscluster/.golangci.yml b/std/clusters/rediscluster/.golangci.yml index 61ac5229..76dbd298 100644 --- a/std/clusters/rediscluster/.golangci.yml +++ b/std/clusters/rediscluster/.golangci.yml @@ -15,7 +15,6 @@ linters: - testpackage - tagliatelle - exhaustruct - - maligned - wrapcheck - varnamelen - ireturn diff --git a/std/gateways/fasthttp/conn_ws.go b/std/gateways/fasthttp/conn_ws.go index bb5ccf46..225101a9 100644 --- a/std/gateways/fasthttp/conn_ws.go +++ b/std/gateways/fasthttp/conn_ws.go @@ -15,7 +15,10 @@ type wsConn struct { rpcOutFactory kit.OutgoingRPCFactory } -var _ kit.Conn = (*wsConn)(nil) +var ( + _ kit.Conn = (*wsConn)(nil) + _ kit.RPCConn = (*wsConn)(nil) +) func (w *wsConn) Close() { w.Lock() diff --git a/std/gateways/fastws/conn.go b/std/gateways/fastws/conn.go index 7c4d061b..2f10e09a 100644 --- a/std/gateways/fastws/conn.go +++ b/std/gateways/fastws/conn.go @@ -32,7 +32,10 @@ type wsConn struct { w *wsutil.Writer } -var _ kit.Conn = (*wsConn)(nil) +var ( + _ kit.Conn = (*wsConn)(nil) + _ kit.RPCConn = (*wsConn)(nil) +) func newWebsocketConn( id uint64, c gnet.Conn, diff --git a/kit/stub/README.MD b/stub/README.MD similarity index 96% rename from kit/stub/README.MD rename to stub/README.MD index af71f015..a1fa7157 100644 --- a/kit/stub/README.MD +++ b/stub/README.MD @@ -12,7 +12,7 @@ import ( "context" "net/http" - "github.com/clubpay/ronykit/kit/stub" + "github.com/clubpay/ronykit/stub" ) func main() { @@ -43,7 +43,7 @@ import ( "context" "github.com/clubpay/ronykit/kit" - "github.com/clubpay/ronykit/kit/stub" + "github.com/clubpay/ronykit/stub" ) type ErrorMessage struct { diff --git a/kit/stub/error.go b/stub/error.go similarity index 100% rename from kit/stub/error.go rename to stub/error.go diff --git a/kit/stub/export_test.go b/stub/export_test.go similarity index 100% rename from kit/stub/export_test.go rename to stub/export_test.go diff --git a/stub/go.mod b/stub/go.mod new file mode 100644 index 00000000..75724435 --- /dev/null +++ b/stub/go.mod @@ -0,0 +1,33 @@ +module github.com/clubpay/ronykit/stub + +go 1.19 + +require ( + github.com/clubpay/ronykit/kit v0.14.14 + github.com/fasthttp/websocket v1.5.9 + github.com/onsi/ginkgo/v2 v2.19.0 + github.com/onsi/gomega v1.33.1 + github.com/valyala/fasthttp v1.54.0 + golang.org/x/net v0.26.0 +) + +require ( + github.com/andybalholm/brotli v1.1.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-task/slim-sprig/v3 v3.0.0 // indirect + github.com/goccy/go-json v0.10.3 // indirect + github.com/goccy/go-reflect v1.2.0 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect + github.com/jedib0t/go-pretty/v6 v6.5.9 // indirect + github.com/klauspost/compress v1.17.8 // indirect + github.com/kr/text v0.2.0 // indirect + github.com/mattn/go-runewidth v0.0.15 // indirect + github.com/rivo/uniseg v0.4.3 // indirect + github.com/savsgio/gotils v0.0.0-20240303185622-093b76447511 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/stub/go.sum b/stub/go.sum new file mode 100644 index 00000000..f775de35 --- /dev/null +++ b/stub/go.sum @@ -0,0 +1,58 @@ +github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= +github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= +github.com/clubpay/ronykit/kit v0.14.14 h1:SFfi+sdoZSFUUAoqC4cHyo+OhasFtwXrRsvhTiZueoQ= +github.com/clubpay/ronykit/kit v0.14.14/go.mod h1:NdIVC65RisZCCU5aACdxtovOVl3Cj+mQhPpUIjyG04Q= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/fasthttp/websocket v1.5.9 h1:9deGuzYcCRKjk940kNwSN6Hd14hk4zYwropm4UsUIUQ= +github.com/fasthttp/websocket v1.5.9/go.mod h1:NLzHBFur260OMuZHohOfYQwMTpR7sfSpUnuqKxMpgKA= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= +github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= +github.com/goccy/go-reflect v1.2.0 h1:O0T8rZCuNmGXewnATuKYnkL0xm6o8UNOJZd/gOkb9ms= +github.com/goccy/go-reflect v1.2.0/go.mod h1:n0oYZn8VcV2CkWTxi8B9QjkCoq6GTtCEdfmR66YhFtE= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg= +github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw= +github.com/jedib0t/go-pretty/v6 v6.5.9 h1:ACteMBRrrmm1gMsXe9PSTOClQ63IXDUt03H5U+UV8OU= +github.com/jedib0t/go-pretty/v6 v6.5.9/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= +github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU= +github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= +github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/onsi/ginkgo/v2 v2.19.0 h1:9Cnnf7UHo57Hy3k6/m5k3dRfGTMXGvxhHFvkDTCTpvA= +github.com/onsi/ginkgo/v2 v2.19.0/go.mod h1:rlwLi9PilAFJ8jCg9UE1QP6VBpd6/xj3SRC0d6TU0To= +github.com/onsi/gomega v1.33.1 h1:dsYjIxxSR755MDmKVsaFQTE22ChNBcuuTWgkUDSubOk= +github.com/onsi/gomega v1.33.1/go.mod h1:U4R44UsT+9eLIaYRB2a5qajjtQYn0hauxvRm16AVYg0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= +github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/savsgio/gotils v0.0.0-20240303185622-093b76447511 h1:KanIMPX0QdEdB4R3CiimCAbxFrhB3j7h0/OvpYGVQa8= +github.com/savsgio/gotils v0.0.0-20240303185622-093b76447511/go.mod h1:sM7Mt7uEoCeFSCBM+qBrqvEo+/9vdmj19wzp3yzUhmg= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasthttp v1.54.0 h1:cCL+ZZR3z3HPLMVfEYVUMtJqVaui0+gu7Lx63unHwS0= +github.com/valyala/fasthttp v1.54.0/go.mod h1:6dt4/8olwq9QARP/TDuPmWyWcl4byhpvTJ4AAtcz+QM= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/kit/stub/godepgraph.png b/stub/godepgraph.png similarity index 100% rename from kit/stub/godepgraph.png rename to stub/godepgraph.png diff --git a/kit/internal/tpl/go/stub.gotmpl b/stub/internal/tpl/go/stub.gotmpl similarity index 99% rename from kit/internal/tpl/go/stub.gotmpl rename to stub/internal/tpl/go/stub.gotmpl index 3225f112..b7e3caef 100644 --- a/kit/internal/tpl/go/stub.gotmpl +++ b/stub/internal/tpl/go/stub.gotmpl @@ -40,7 +40,7 @@ import ( "fmt" "github.com/clubpay/ronykit/kit" -"github.com/clubpay/ronykit/kit/stub" +"github.com/clubpay/ronykit/stub" "github.com/clubpay/ronykit/kit/utils/reflector" ) diff --git a/kit/internal/tpl/tpl.go b/stub/internal/tpl/tpl.go similarity index 100% rename from kit/internal/tpl/tpl.go rename to stub/internal/tpl/tpl.go diff --git a/kit/internal/tpl/ts/stub.tstmpl b/stub/internal/tpl/ts/stub.tstmpl similarity index 100% rename from kit/internal/tpl/ts/stub.tstmpl rename to stub/internal/tpl/ts/stub.tstmpl diff --git a/kit/internal/tpl/util.go b/stub/internal/tpl/util.go similarity index 100% rename from kit/internal/tpl/util.go rename to stub/internal/tpl/util.go diff --git a/kit/stub/option.go b/stub/option.go similarity index 100% rename from kit/stub/option.go rename to stub/option.go diff --git a/kit/stub/stub.go b/stub/stub.go similarity index 100% rename from kit/stub/stub.go rename to stub/stub.go diff --git a/kit/stub/stub_rest.go b/stub/stub_rest.go similarity index 100% rename from kit/stub/stub_rest.go rename to stub/stub_rest.go diff --git a/kit/stub/stub_rest_option.go b/stub/stub_rest_option.go similarity index 100% rename from kit/stub/stub_rest_option.go rename to stub/stub_rest_option.go diff --git a/kit/stub/stub_test.go b/stub/stub_test.go similarity index 98% rename from kit/stub/stub_test.go rename to stub/stub_test.go index b0e92b74..db500055 100644 --- a/kit/stub/stub_test.go +++ b/stub/stub_test.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/clubpay/ronykit/kit" - "github.com/clubpay/ronykit/kit/stub" + "github.com/clubpay/ronykit/stub" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/kit/stub/stub_ws.go b/stub/stub_ws.go similarity index 100% rename from kit/stub/stub_ws.go rename to stub/stub_ws.go diff --git a/kit/stub/stub_ws_option.go b/stub/stub_ws_option.go similarity index 100% rename from kit/stub/stub_ws_option.go rename to stub/stub_ws_option.go diff --git a/kit/stub/stubgen/gen.go b/stub/stubgen/gen.go similarity index 100% rename from kit/stub/stubgen/gen.go rename to stub/stubgen/gen.go diff --git a/kit/stub/stubgen/gen_func.go b/stub/stubgen/gen_func.go similarity index 91% rename from kit/stub/stubgen/gen_func.go rename to stub/stubgen/gen_func.go index e54f50d7..730687db 100644 --- a/kit/stub/stubgen/gen_func.go +++ b/stub/stubgen/gen_func.go @@ -3,7 +3,7 @@ package stubgen import ( "strings" - "github.com/clubpay/ronykit/kit/internal/tpl" + "github.com/clubpay/ronykit/stub/internal/tpl" ) // GenFunc is the function which generates the final code. For example to generate diff --git a/kit/stub/stubgen/gen_test.go b/stub/stubgen/gen_test.go similarity index 97% rename from kit/stub/stubgen/gen_test.go rename to stub/stubgen/gen_test.go index b5a6050e..d4916d1f 100644 --- a/kit/stub/stubgen/gen_test.go +++ b/stub/stubgen/gen_test.go @@ -7,7 +7,7 @@ import ( "github.com/clubpay/ronykit/kit" "github.com/clubpay/ronykit/kit/desc" - "github.com/clubpay/ronykit/kit/stub/stubgen" + "github.com/clubpay/ronykit/stub/stubgen" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/kit/stub/stubgen/input.go b/stub/stubgen/input.go similarity index 100% rename from kit/stub/stubgen/input.go rename to stub/stubgen/input.go diff --git a/kit/stub/stubgen/options.go b/stub/stubgen/options.go similarity index 100% rename from kit/stub/stubgen/options.go rename to stub/stubgen/options.go diff --git a/kit/stub/utils.go b/stub/utils.go similarity index 100% rename from kit/stub/utils.go rename to stub/utils.go diff --git a/kit/stub/utils_test.go b/stub/utils_test.go similarity index 95% rename from kit/stub/utils_test.go rename to stub/utils_test.go index b57bf6b4..4b5fa9ef 100644 --- a/kit/stub/utils_test.go +++ b/stub/utils_test.go @@ -1,7 +1,7 @@ package stub_test import ( - "github.com/clubpay/ronykit/kit/stub" + "github.com/clubpay/ronykit/stub" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/testenv/cluster_test.go b/testenv/cluster_test.go index c9806a35..9497043e 100644 --- a/testenv/cluster_test.go +++ b/testenv/cluster_test.go @@ -12,7 +12,7 @@ import ( "github.com/clubpay/ronykit/kit" "github.com/clubpay/ronykit/kit/common" - "github.com/clubpay/ronykit/kit/stub" + "github.com/clubpay/ronykit/stub" "github.com/clubpay/ronykit/kit/utils" "github.com/clubpay/ronykit/std/clusters/p2pcluster" "github.com/clubpay/ronykit/std/clusters/rediscluster" diff --git a/testenv/fastws_test.go b/testenv/fastws_test.go index 1c565b03..c38cf3ae 100644 --- a/testenv/fastws_test.go +++ b/testenv/fastws_test.go @@ -15,8 +15,7 @@ import ( "github.com/clubpay/ronykit/std/gateways/fastws" "github.com/clubpay/ronykit/kit" - "github.com/clubpay/ronykit/kit/stub" - . "github.com/smartystreets/goconvey/convey" + "github.com/clubpay/ronykit/stub "github.com/smartystreets/goconvey/convey" "go.uber.org/fx" ) diff --git a/updateversion.sh b/updateversion.sh index 84b008fe..6be57a98 100644 --- a/updateversion.sh +++ b/updateversion.sh @@ -29,7 +29,7 @@ frs="github.com/clubpay/ronykit/std/gateways/fasthttp $2" css="github.com/clubpay/ronykit/contrib $1" crs="github.com/clubpay/ronykit/contrib $2" -array2=(contrib rony) +array2=(contrib rony stub) for i in "${array2[@]}" do filename="$i"/go.mod