From d36170500c669b101e152f3d2ff67828a1d9d9fd Mon Sep 17 00:00:00 2001 From: Omer Akram Date: Sat, 1 Jun 2024 16:57:58 +0500 Subject: [PATCH] integrate wamppproto-go to print hello hex --- cmd/wampproto/main.go | 17 ++++++++++++++++- go.mod | 9 +++++++++ go.sum | 14 ++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 go.sum diff --git a/cmd/wampproto/main.go b/cmd/wampproto/main.go index aca2f04..396d545 100644 --- a/cmd/wampproto/main.go +++ b/cmd/wampproto/main.go @@ -1,5 +1,20 @@ package main +import ( + "encoding/hex" + "log" + + "github.com/xconnio/wampproto-go/messages" + "github.com/xconnio/wampproto-go/serializers" +) + func main() { - println("HELLO") + hello := messages.NewHello("realm1", "test", nil, nil, []string{"anonymous"}) + serializer := &serializers.MsgPackSerializer{} + data, err := serializer.Serialize(hello) + if err != nil { + panic(err) + } + + log.Println("HELLO", hex.EncodeToString(data)) } diff --git a/go.mod b/go.mod index 01637a0..f3b56b0 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,12 @@ module github.com/xconnio/wampproto-cli go 1.20 + +require github.com/xconnio/wampproto-go v0.0.0-20240531231532-d8fa7f588c4e + +require ( + github.com/fxamacker/cbor/v2 v2.6.0 // indirect + github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + github.com/x448/float16 v0.8.4 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..2aca340 --- /dev/null +++ b/go.sum @@ -0,0 +1,14 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/fxamacker/cbor/v2 v2.6.0 h1:sU6J2usfADwWlYDAFhZBQ6TnLFBHxgesMrQfQgk1tWA= +github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/xconnio/wampproto-go v0.0.0-20240531231532-d8fa7f588c4e h1:15wgqkrASYTouf37nDshH9TjTSDNjB6EOfPSytHq9kg= +github.com/xconnio/wampproto-go v0.0.0-20240531231532-d8fa7f588c4e/go.mod h1:BH0AFRLJ9POvVfxsFd9GyvA15U9o0XYQfq8TdkqO2vQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=