Categorygithub.com/linxGnu/gosmpp
modulepackage
0.3.1
Repository: https://github.com/linxgnu/gosmpp.git
Documentation: pkg.go.dev

# README

gosmpp

Go Report Card Coverage Status godoc

SMPP (3.4) Client Library in pure Go.

This library is well tested with SMSC simulators:

Installation

go get -u github.com/linxGnu/gosmpp

Usage

Highlight

  • From v0.1.4, gosmpp is written in event-based style and fully-manage your smpp session, connection, error, rebinding, etc. You only need to implement some hooks:
		trans, err := gosmpp.NewSession(
		gosmpp.TRXConnector(gosmpp.NonTLSDialer, auth),
		gosmpp.Settings{
			EnquireLink: 5 * time.Second,

			ReadTimeout: 10 * time.Second,

			OnSubmitError: func(_ pdu.PDU, err error) {
				log.Fatal("SubmitPDU error:", err)
			},

			OnReceivingError: func(err error) {
				fmt.Println("Receiving PDU/Network error:", err)
			},

			OnRebindingError: func(err error) {
				fmt.Println("Rebinding but error:", err)
			},

			OnPDU: handlePDU(),

			OnClosed: func(state gosmpp.State) {
				fmt.Println(state)
			},
		}, 5*time.Second)
		if err != nil {
		  log.Println(err)
		}
		defer func() {
		  _ = trans.Close()
		}()

Version (0.1.4.RC+)

Old version (0.1.3 and previous)

Full example could be found: gist

Supported PDUs

  • bind_transmitter
  • bind_transmitter_resp
  • bind_receiver
  • bind_receiver_resp
  • bind_transceiver
  • bind_transceiver_resp
  • outbind
  • unbind
  • unbind_resp
  • submit_sm
  • submit_sm_resp
  • submit_sm_multi
  • submit_sm_multi_resp
  • data_sm
  • data_sm_resp
  • deliver_sm
  • deliver_sm_resp
  • query_sm
  • query_sm_resp
  • cancel_sm
  • cancel_sm_resp
  • replace_sm
  • replace_sm_resp
  • enquire_link
  • enquire_link_resp
  • alert_notification
  • generic_nack

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

NewConnection returns a Connection.
No description provided by the author
NewSession creates new session for TX, RX, TRX.
RXConnector returns a Receiver (RX) connector.
TRXConnector returns a Transceiver (TRX) connector.
TXConnector returns a Transmitter (TX) connector.
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
ConnectionIssue indicates that Transmitter/Receiver/Transceiver is closed due to network connection issue or SMSC is not available anymore.
ExplicitClosing indicates that Transmitter/Receiver/Transceiver is closed explicitly (from outside).
InvalidStreaming indicates Transceiver/Receiver data reading state is invalid due to network connection or SMSC responsed with an invalid PDU which potentially damages other following PDU(s).
StoppingProcessOnly stops daemons but does not close underlying net conn.
UnbindClosing indicates Receiver got unbind request from SMSC and closed due to this request.

# Variables

ErrConnectionClosing indicates transmitter is closing.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NonTLSDialer is non-tls connection dialer.

# Structs

Auth represents basic authentication to SMSC.
No description provided by the author
Connection wraps over net.Conn with buffered data reader.
No description provided by the author
Request represent a request tracked by the RequestStore.
Response represents a response from a Request in the RequestStore.
Session represents session for TX, RX, TRX.
Settings for TX (transmitter), RX (receiver), TRX (transceiver).
WindowedRequestTracking settings for TX (transmitter) and TRX (transceiver) request store.

# Interfaces

Connector is connection factory interface.
Receiver interface.
RequestStore interface used for WindowedRequestTracking.
Transceiver interface.
Transmitter interface.

# Type aliases

AllPDUCallback handles all received PDU.
ClosedCallback notifies closed event due to State.
Dialer is connection dialer.
ErrorCallback notifies happened error while reading PDU.
PDUCallback handles received PDU.
PDUErrorCallback notifies fail-to-submit PDU with along error.
RebindCallback notifies rebind event due to State.
No description provided by the author
State represents Transmitter/Receiver/Transceiver state.
No description provided by the author