ajankovic / smpp

Go library for SMPP 3.4
MIT License
24 stars 21 forks source link

How to enable TLS for SMPP Server and Client ? #18

Open vanipolnedi opened 2 years ago

vanipolnedi commented 2 years ago

I need secure SMPP Server connections by enabling TLS. Can you please help me in doing so? Thanks in advance

cellezam commented 3 months ago

Hey @vanipolnedi

I think that you can use the .Serve from Server method and pass your tls conf inside it.

` srv := smpp.NewServer(s.Address, sessConf) cert, err := tls.LoadX509KeyPair("path/to/server.crt", "path/to/server.key") if err != nil { log.Fatalf("failed to load key pair: %v", err) }

tlsConfig := &tls.Config{
    Certificates: []tls.Certificate{cert},
}

ln, err := tls.Listen("tcp", ":2775", tlsConfig)
if err != nil {
    log.Fatalf("failed to listen: %v", err)
}
return srv.Serve(ln)

`