Documentation ¶
Overview ¶
Package smpptest provides an SMPP test server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DefaultUser = "client" DefaultPasswd = "secret" DefaultSystemID = "smpptest" )
Default settings.
Functions ¶
func EchoHandler ¶
EchoHandler is the default Server HandlerFunc, and echoes back any PDUs received.
Types ¶
type Conn ¶
type Conn interface { // Write serializes the given PDU and writes to the connection. Write(p pdu.Body) error // Close terminates the connection. Close() error // RemoteAddr returns the peer address. RemoteAddr() net.Addr }
Conn implements a server side connection.
type HandlerFunc ¶
HandlerFunc is the signature of a function passed to Server instances, that is called when client PDU messages arrive.
type Server ¶
type Server struct { User string Passwd string TLS *tls.Config Handler HandlerFunc // contains filtered or unexported fields }
Server is an SMPP server for testing purposes. By default it authenticate clients with the configured credentials, and echoes any other PDUs back to the client.
func NewServer ¶
func NewServer() *Server
NewServer creates and initializes a new Server. Callers are supposed to call Close on that server later.
func NewUnstartedServer ¶
func NewUnstartedServer() *Server
NewUnstartedServer creates a new Server with default settings, and does not start it. Callers are supposed to call Start and Close later.
func (*Server) Addr ¶
Addr returns the local address of the server, or an empty string if the server hasn't been started yet.
func (*Server) BroadcastMessage ¶
BroadcastMessage broadcasts a test PDU to the all bound clients
func (*Server) Close ¶
func (srv *Server) Close()
Close stops the server, causing the accept loop to break out.