|
| | TSslSocket (TSocket &&socket, TSslContext &ctx) |
| | Constructs a TSslSocket, taking ownership of the underlying socket.
|
| |
|
| TSslSocket (TSslSocket &&other) |
| |
|
TSslSocket & | operator= (TSslSocket &&other) |
| |
|
| TSslSocket (const TSslSocket &)=delete |
| |
|
TSslSocket & | operator= (const TSslSocket &)=delete |
| |
|
| ~TSslSocket () |
| | Frees the SSL instance, associated BIOs, and any in-progress handshake coroutine.
|
| |
| void | SslSetTlsExtHostName (const std::string &host) |
| | Sets the TLS SNI host name sent in the ClientHello.
|
| |
| TFuture< TSslSocket< TSocket > > | Accept () |
| | Accepts a TCP connection and performs the server-side TLS handshake.
|
| |
| TFuture< void > | AcceptHandshake () |
| | Performs the server-side TLS handshake on an already-accepted TCP socket.
|
| |
| TFuture< void > | Connect (const TAddress &address, TTime deadline=TTime::max()) |
| | TCP-connects to address and performs the client-side TLS handshake.
|
| |
| TFuture< ssize_t > | ReadSome (void *data, size_t size) |
| | Reads up to size decrypted bytes into data.
|
| |
| TFuture< ssize_t > | WriteSome (const void *data, size_t size) |
| | Encrypts and sends all size bytes from data.
|
| |
|
auto | Poller () |
| | Returns the poller associated with the underlying socket.
|
| |
template<typename
TSocket>
class NNet::TSslSocket< TSocket >
TLS layer over any connected socket, exposing the same ReadSome/WriteSome interface.
Takes ownership of the underlying socket (moved in). References the TSslContext — the context must outlive this object. Move-only.
Client usage:
ssl.SslSetTlsExtHostName("example.com");
co_await ssl.Connect(addr);
ssize_t n = co_await ssl.ReadSome(buf, size);
TLS layer over any connected socket, exposing the same ReadSome/WriteSome interface.
Definition ssl.hpp:108
Owns an OpenSSL SSL_CTX and optional log callback.
Definition ssl.hpp:39
static TSslContext Client(const std::function< void(const char *)> &logFunc={})
Creates a TLS client context (no certificate required).
Definition ssl.cpp:24
Server usage:
TSslSocket listener(std::move(listeningSocket), ctx);
auto client = co_await listener.Accept();
static TSslContext Server(const char *certfile, const char *keyfile, const std::function< void(const char *)> &logFunc={})
Creates a TLS server context from PEM files on disk.
Definition ssl.cpp:32
- Template Parameters
-