smpp

package module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2022 License: MIT Imports: 11 Imported by: 0

README

go-smpp

A complete implementation of SMPP v5 protocol, written in golang.

Key features

  • Message encoding auto-detection

  • Multipart SMS automatic splitting and concatenating

  • Supported encodings:

    UCS-2     GSM 7bit  ASCII      Latin-1
    Cyrillic  Hebrew    Shift-JIS  ISO-2022-JP
    EUC-JP    EUC-KR
    

Caveats

Command line tools

  1. smpp-receiver

    SMPP Simple Receiver tool

  2. smpp-repl

    SMPP Simple Test tool

LICENSE

This piece of software is released under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConnectionClosed = errors.New("smpp: connection closed")
	ErrContextDone      = errors.New("smpp: context done")
)

Functions

func ServeTCP

func ServeTCP(address string, handler Handler, config *tls.Config) (err error)

Types

type Conn

type Conn struct {
	NextSequence func() int32
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, parent net.Conn) *Conn

func (*Conn) Close

func (c *Conn) Close() (err error)

func (*Conn) Done

func (c *Conn) Done() <-chan struct{}
func (c *Conn) EnquireLink(tick time.Duration, timeout time.Duration)

func (*Conn) PDU

func (c *Conn) PDU() <-chan any

func (*Conn) Send

func (c *Conn) Send(packet any) (err error)

func (*Conn) Submit

func (c *Conn) Submit(ctx context.Context, packet Responsable) (resp interface{}, err error)

func (*Conn) Watch

func (c *Conn) Watch()

type Handler

type Handler interface{ Serve(*Session) }

type HandlerFunc

type HandlerFunc func(*Session)

func (HandlerFunc) Serve

func (h HandlerFunc) Serve(session *Session)

type Session

type Session struct {
	NextSequence func() int32
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	// contains filtered or unexported fields
}

func NewSession

func NewSession(ctx context.Context, parent net.Conn) (session *Session)

func (*Session) Close

func (s *Session) Close(ctx context.Context) (err error)
func (s *Session) EnquireLink(ctx context.Context, tick time.Duration, timeout time.Duration) (err error)

func (*Session) PDU

func (s *Session) PDU() <-chan any

func (*Session) Send

func (s *Session) Send(packet any) (err error)

func (*Session) Submit

func (s *Session) Submit(ctx context.Context, packet pdu.Responsable) (resp any, err error)

Submit prepares the packet pdu while adding a new sequence to it. Then it calls send and waits for a response if send did not return an error. BUG: blocks Submit until a response is received or the context timed out. As the async enquireLink uses Submit too, this causes issue.

Directories

Path Synopsis
cmd
sms

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL