From f812d4c7e80ab6c3aa3cc7ef4996cba7972cbb4b Mon Sep 17 00:00:00 2001 From: DShaimardanova Date: Wed, 11 Dec 2024 00:50:47 +0500 Subject: [PATCH 1/2] Update maxLen for SubmitLongMsg --- .idea/.gitignore | 8 ++++++++ .idea/go-smpp.iml | 9 +++++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ go.mod | 16 +++++++++++----- go.sum | 35 ++++++++++++++++++++++++++++------ smpp/client.go | 4 ++-- smpp/conn.go | 2 +- smpp/conn_test.go | 6 +++--- smpp/example_test.go | 8 ++++---- smpp/pdu/body.go | 4 ++-- smpp/pdu/codec.go | 4 ++-- smpp/pdu/pdufield/map.go | 2 +- smpp/pdu/pdufield/map_test.go | 2 +- smpp/pdu/pdutext/gsm7.go | 30 ++++++++++++++--------------- smpp/pdu/pdutext/gsm7packed.go | 30 ++++++++++++++--------------- smpp/pdu/types.go | 4 ++-- smpp/pdu/types_test.go | 2 +- smpp/receiver.go | 4 ++-- smpp/receiver_test.go | 6 +++--- smpp/smpptest/conn.go | 2 +- smpp/smpptest/server.go | 4 ++-- smpp/smpptest/server_test.go | 10 +++++----- smpp/transceiver.go | 4 ++-- smpp/transceiver_test.go | 8 ++++---- smpp/transmitter.go | 18 ++++++++--------- smpp/transmitter_test.go | 8 ++++---- 27 files changed, 152 insertions(+), 92 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/go-smpp.iml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/go-smpp.iml b/.idea/go-smpp.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/go-smpp.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..7ea7992 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/go.mod b/go.mod index f998134..292661d 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,15 @@ -module github.com/fiorix/go-smpp +module github.com/fishparmak/go-smpp -go 1.16 +go 1.20 require ( - github.com/urfave/cli v1.22.5 - golang.org/x/text v0.3.6 - golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba + github.com/fiorix/go-smpp v0.0.0-20210403173735-2894b96e70ba + github.com/urfave/cli v1.22.16 + golang.org/x/text v0.21.0 + golang.org/x/time v0.8.0 +) + +require ( + github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect ) diff --git a/go.sum b/go.sum index 314a648..d89f9ef 100644 --- a/go.sum +++ b/go.sum @@ -1,18 +1,41 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= +github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc= +github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +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= +github.com/fiorix/go-smpp v0.0.0-20210403173735-2894b96e70ba h1:vBqABUa2HUSc6tj22Tw+ZMVGHuBzKtljM38kbRanmrM= +github.com/fiorix/go-smpp v0.0.0-20210403173735-2894b96e70ba/go.mod h1:VfKFK7fGeCP81xEhbrOqUEh45n73Yy6jaPWwTVbxprI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= +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/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +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/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +github.com/urfave/cli v1.22.16 h1:MH0k6uJxdwdeWQTwhSO42Pwr4YLrNLwBtg1MRgTqPdQ= +github.com/urfave/cli v1.22.16/go.mod h1:EeJR6BKodywf4zciqrdw6hpCPk68JO9z5LazXZMn5Po= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 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.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +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= diff --git a/smpp/client.go b/smpp/client.go index 2da8e9e..f217df8 100644 --- a/smpp/client.go +++ b/smpp/client.go @@ -12,8 +12,8 @@ import ( "sync" "time" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" ) // ConnStatus is an abstract interface for a connection status change. diff --git a/smpp/conn.go b/smpp/conn.go index e471110..6a3ddc9 100644 --- a/smpp/conn.go +++ b/smpp/conn.go @@ -13,7 +13,7 @@ import ( "net" "sync" - "github.com/fiorix/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu" ) var ( diff --git a/smpp/conn_test.go b/smpp/conn_test.go index 17e8fad..8db9cd7 100644 --- a/smpp/conn_test.go +++ b/smpp/conn_test.go @@ -7,9 +7,9 @@ package smpp import ( "testing" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" - "github.com/fiorix/go-smpp/smpp/smpptest" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/smpptest" ) func TestConn(t *testing.T) { diff --git a/smpp/example_test.go b/smpp/example_test.go index 918afef..d7f4ee8 100644 --- a/smpp/example_test.go +++ b/smpp/example_test.go @@ -12,10 +12,10 @@ import ( "golang.org/x/time/rate" - "github.com/fiorix/go-smpp/smpp" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" - "github.com/fiorix/go-smpp/smpp/pdu/pdutext" + "github.com/fishparmak/go-smpp/smpp" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutext" ) func ExampleReceiver() { diff --git a/smpp/pdu/body.go b/smpp/pdu/body.go index 997aa12..947f5e5 100644 --- a/smpp/pdu/body.go +++ b/smpp/pdu/body.go @@ -7,8 +7,8 @@ package pdu import ( "io" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" - "github.com/fiorix/go-smpp/smpp/pdu/pdutlv" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutlv" ) // MaxSize is the maximum size allowed for a PDU. diff --git a/smpp/pdu/codec.go b/smpp/pdu/codec.go index afd07ec..2ea4bb6 100644 --- a/smpp/pdu/codec.go +++ b/smpp/pdu/codec.go @@ -10,8 +10,8 @@ import ( "io" "sync/atomic" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" - "github.com/fiorix/go-smpp/smpp/pdu/pdutlv" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutlv" ) var nextSeq uint32 diff --git a/smpp/pdu/pdufield/map.go b/smpp/pdu/pdufield/map.go index 29be43c..8e80dc9 100644 --- a/smpp/pdu/pdufield/map.go +++ b/smpp/pdu/pdufield/map.go @@ -7,7 +7,7 @@ package pdufield import ( "fmt" - "github.com/fiorix/go-smpp/smpp/pdu/pdutext" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutext" ) // Map is a collection of PDU field data indexed by name. diff --git a/smpp/pdu/pdufield/map_test.go b/smpp/pdu/pdufield/map_test.go index e9dd01d..b829244 100644 --- a/smpp/pdu/pdufield/map_test.go +++ b/smpp/pdu/pdufield/map_test.go @@ -8,7 +8,7 @@ import ( "bytes" "testing" - "github.com/fiorix/go-smpp/smpp/pdu/pdutext" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutext" ) func TestMapSet(t *testing.T) { diff --git a/smpp/pdu/pdutext/gsm7.go b/smpp/pdu/pdutext/gsm7.go index 163a685..7aa9012 100644 --- a/smpp/pdu/pdutext/gsm7.go +++ b/smpp/pdu/pdutext/gsm7.go @@ -5,8 +5,8 @@ package pdutext import ( - "golang.org/x/text/transform" - "github.com/fiorix/go-smpp/smpp/encoding" + "github.com/fishparmak/go-smpp/smpp/encoding" + "golang.org/x/text/transform" ) // GSM 7-bit (unpacked) @@ -14,25 +14,25 @@ type GSM7 []byte // Type implements the Codec interface. func (s GSM7) Type() DataCoding { - return DefaultType + return DefaultType } // Encode to GSM 7-bit (unpacked) func (s GSM7) Encode() []byte { - e := encoding.GSM7(false).NewEncoder() - es, _, err := transform.Bytes(e, s) - if err != nil { - return s - } - return es + e := encoding.GSM7(false).NewEncoder() + es, _, err := transform.Bytes(e, s) + if err != nil { + return s + } + return es } // Decode from GSM 7-bit (unpacked) func (s GSM7) Decode() []byte { - e := encoding.GSM7(false).NewDecoder() - es, _, err := transform.Bytes(e, s) - if err != nil { - return s - } - return es + e := encoding.GSM7(false).NewDecoder() + es, _, err := transform.Bytes(e, s) + if err != nil { + return s + } + return es } diff --git a/smpp/pdu/pdutext/gsm7packed.go b/smpp/pdu/pdutext/gsm7packed.go index 432ee52..c35332b 100644 --- a/smpp/pdu/pdutext/gsm7packed.go +++ b/smpp/pdu/pdutext/gsm7packed.go @@ -5,8 +5,8 @@ package pdutext import ( - "golang.org/x/text/transform" - "github.com/fiorix/go-smpp/smpp/encoding" + "github.com/fishparmak/go-smpp/smpp/encoding" + "golang.org/x/text/transform" ) // GSM 7-bit (packed) @@ -14,25 +14,25 @@ type GSM7Packed []byte // Type implements the Codec interface. func (s GSM7Packed) Type() DataCoding { - return DefaultType + return DefaultType } // Encode to GSM 7-bit (packed) func (s GSM7Packed) Encode() []byte { - e := encoding.GSM7(true).NewEncoder() - es, _, err := transform.Bytes(e, s) - if err != nil { - return s - } - return es + e := encoding.GSM7(true).NewEncoder() + es, _, err := transform.Bytes(e, s) + if err != nil { + return s + } + return es } // Decode from GSM 7-bit (packed) func (s GSM7Packed) Decode() []byte { - e := encoding.GSM7(true).NewDecoder() - es, _, err := transform.Bytes(e, s) - if err != nil { - return s - } - return es + e := encoding.GSM7(true).NewDecoder() + es, _, err := transform.Bytes(e, s) + if err != nil { + return s + } + return es } diff --git a/smpp/pdu/types.go b/smpp/pdu/types.go index 336c9ae..58c730e 100644 --- a/smpp/pdu/types.go +++ b/smpp/pdu/types.go @@ -5,8 +5,8 @@ package pdu import ( - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" - "github.com/fiorix/go-smpp/smpp/pdu/pdutlv" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutlv" ) // PDU Types. diff --git a/smpp/pdu/types_test.go b/smpp/pdu/types_test.go index add6b47..bef5e11 100644 --- a/smpp/pdu/types_test.go +++ b/smpp/pdu/types_test.go @@ -10,7 +10,7 @@ import ( "strconv" "testing" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" ) func TestBind(t *testing.T) { diff --git a/smpp/receiver.go b/smpp/receiver.go index 0548c59..bb3b21e 100644 --- a/smpp/receiver.go +++ b/smpp/receiver.go @@ -11,8 +11,8 @@ import ( "sync" "time" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" ) // Receiver implements an SMPP client receiver. diff --git a/smpp/receiver_test.go b/smpp/receiver_test.go index b10043f..f72438d 100644 --- a/smpp/receiver_test.go +++ b/smpp/receiver_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/smpptest" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/smpptest" ) func TestReceiver(t *testing.T) { @@ -43,4 +43,4 @@ func TestReceiver(t *testing.T) { case <-time.After(time.Second): t.Fatal("timeout waiting for server to echo") } -} \ No newline at end of file +} diff --git a/smpp/smpptest/conn.go b/smpp/smpptest/conn.go index 355d5ba..3f1947b 100644 --- a/smpp/smpptest/conn.go +++ b/smpp/smpptest/conn.go @@ -10,7 +10,7 @@ import ( "io" "net" - "github.com/fiorix/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu" ) // Conn implements a server side connection. diff --git a/smpp/smpptest/server.go b/smpp/smpptest/server.go index f760ccb..6038459 100644 --- a/smpp/smpptest/server.go +++ b/smpp/smpptest/server.go @@ -13,8 +13,8 @@ import ( "net" "sync" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" ) // Default settings. diff --git a/smpp/smpptest/server_test.go b/smpp/smpptest/server_test.go index ea0004a..cba21a9 100644 --- a/smpp/smpptest/server_test.go +++ b/smpp/smpptest/server_test.go @@ -9,10 +9,10 @@ import ( "net" "testing" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" - "github.com/fiorix/go-smpp/smpp/pdu/pdutext" - "github.com/fiorix/go-smpp/smpp/pdu/pdutlv" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutext" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutlv" ) func TestServer(t *testing.T) { @@ -75,7 +75,7 @@ func TestServer(t *testing.T) { } } // submit_sm + tlv field - p = pdu.NewSubmitSM(pdutlv.Fields{ pdutlv.TagReceiptedMessageID: pdutlv.CString("xyz123") }) + p = pdu.NewSubmitSM(pdutlv.Fields{pdutlv.TagReceiptedMessageID: pdutlv.CString("xyz123")}) f = p.Fields() f.Set(pdufield.SourceAddr, "foobar") f.Set(pdufield.DestinationAddr, "bozo") diff --git a/smpp/transceiver.go b/smpp/transceiver.go index bb520a4..78ed192 100644 --- a/smpp/transceiver.go +++ b/smpp/transceiver.go @@ -10,8 +10,8 @@ import ( "math/rand" "time" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" ) // Transceiver implements an SMPP transceiver. diff --git a/smpp/transceiver_test.go b/smpp/transceiver_test.go index 96602ff..dc57d94 100644 --- a/smpp/transceiver_test.go +++ b/smpp/transceiver_test.go @@ -11,10 +11,10 @@ import ( "golang.org/x/time/rate" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" - "github.com/fiorix/go-smpp/smpp/pdu/pdutext" - "github.com/fiorix/go-smpp/smpp/smpptest" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutext" + "github.com/fishparmak/go-smpp/smpp/smpptest" ) func TestTransceiver(t *testing.T) { diff --git a/smpp/transmitter.go b/smpp/transmitter.go index ae49aad..b6bcd59 100644 --- a/smpp/transmitter.go +++ b/smpp/transmitter.go @@ -15,10 +15,10 @@ import ( "sync/atomic" "time" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" - "github.com/fiorix/go-smpp/smpp/pdu/pdutext" - "github.com/fiorix/go-smpp/smpp/pdu/pdutlv" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutext" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutlv" ) // ErrMaxWindowSize is returned when an operation (such as Submit) violates @@ -182,7 +182,7 @@ type ShortMessage struct { Register pdufield.DeliverySetting // Other fields, normally optional. - TLVFields pdutlv.Fields + TLVFields pdutlv.Fields ServiceType string SourceAddrTON uint8 SourceAddrNPI uint8 @@ -328,16 +328,16 @@ func (t *Transmitter) Submit(sm *ShortMessage) (*ShortMessage, error) { // and returns and updates the given sm with the response status. // It returns the same sm object. func (t *Transmitter) SubmitLongMsg(sm *ShortMessage) ([]ShortMessage, error) { - maxLen := 133 // 140-7 (UDH with 2 byte reference number) + maxLen := 67 // 140-7 (UDH with 2 byte reference number) switch sm.Text.(type) { case pdutext.GSM7: - maxLen = 152 // to avoid an escape character being split between payloads + maxLen = 67 // to avoid an escape character being split between payloads break case pdutext.GSM7Packed: - maxLen = 132 // to avoid an escape character being split between payloads + maxLen = 67 // to avoid an escape character being split between payloads break case pdutext.UCS2: - maxLen = 132 // to avoid a character being split between payloads + maxLen = 67 // to avoid a character being split between payloads break } rawMsg := sm.Text.Encode() diff --git a/smpp/transmitter_test.go b/smpp/transmitter_test.go index a6b41b7..bf1f771 100644 --- a/smpp/transmitter_test.go +++ b/smpp/transmitter_test.go @@ -11,10 +11,10 @@ import ( "golang.org/x/time/rate" - "github.com/fiorix/go-smpp/smpp/pdu" - "github.com/fiorix/go-smpp/smpp/pdu/pdufield" - "github.com/fiorix/go-smpp/smpp/pdu/pdutext" - "github.com/fiorix/go-smpp/smpp/smpptest" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" + "github.com/fishparmak/go-smpp/smpp/pdu/pdutext" + "github.com/fishparmak/go-smpp/smpp/smpptest" ) func TestShortMessage(t *testing.T) { From 12cfb61ed29618bd273623a95c301772a3b2be9d Mon Sep 17 00:00:00 2001 From: DShaimardanova Date: Fri, 18 Apr 2025 16:58:24 +0500 Subject: [PATCH 2/2] Update maxLen for SubmitLongMsg --- smpp/client.go | 5 ++--- smpp/transmitter.go | 8 ++++---- smpp/transmitter_test.go | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/smpp/client.go b/smpp/client.go index f217df8..583bfaf 100644 --- a/smpp/client.go +++ b/smpp/client.go @@ -7,13 +7,12 @@ package smpp import ( "context" "crypto/tls" + "github.com/fishparmak/go-smpp/smpp/pdu" + "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" "io" "math" "sync" "time" - - "github.com/fishparmak/go-smpp/smpp/pdu" - "github.com/fishparmak/go-smpp/smpp/pdu/pdufield" ) // ConnStatus is an abstract interface for a connection status change. diff --git a/smpp/transmitter.go b/smpp/transmitter.go index b6bcd59..cf7e90d 100644 --- a/smpp/transmitter.go +++ b/smpp/transmitter.go @@ -328,16 +328,16 @@ func (t *Transmitter) Submit(sm *ShortMessage) (*ShortMessage, error) { // and returns and updates the given sm with the response status. // It returns the same sm object. func (t *Transmitter) SubmitLongMsg(sm *ShortMessage) ([]ShortMessage, error) { - maxLen := 67 // 140-7 (UDH with 2 byte reference number) + maxLen := 133 // 140-7 (UDH with 2 byte reference number) switch sm.Text.(type) { case pdutext.GSM7: - maxLen = 67 // to avoid an escape character being split between payloads + maxLen = 152 // to avoid an escape character being split between payloads break case pdutext.GSM7Packed: - maxLen = 67 // to avoid an escape character being split between payloads + maxLen = 132 // to avoid an escape character being split between payloads break case pdutext.UCS2: - maxLen = 67 // to avoid a character being split between payloads + maxLen = 132 // to avoid a character being split between payloads break } rawMsg := sm.Text.Encode() diff --git a/smpp/transmitter_test.go b/smpp/transmitter_test.go index bf1f771..c750010 100644 --- a/smpp/transmitter_test.go +++ b/smpp/transmitter_test.go @@ -152,7 +152,7 @@ func TestLongMessage(t *testing.T) { parts, err := tx.SubmitLongMsg(&ShortMessage{ Src: "root", Dst: "foobar", - Text: pdutext.Raw("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam consequat nisl enim, vel finibus neque aliquet sit amet. Interdum et malesuada fames ac ante ipsum primis in faucibus."), + Text: pdutext.Raw(fmt.Sprintf("Ваш ответ некорректен. Попробуйте снова. %s", "c")), Validity: 10 * time.Minute, Register: pdufield.NoDeliveryReceipt, })