MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / wrap_tls_server

Function wrap_tls_server

tee/cocoon/utils.cpp:134–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132}
133
134td::actor::Task<std::pair<td::Pipe, RATLSAttestedPeerInfo>> wrap_tls_server(td::Slice name, td::Pipe pipe,
135 TeeCertAndKey cert_and_key,
136 RATLSPolicyRef policy,
137 const td::IPAddress &source,
138 const td::IPAddress &destination) {
139 auto [t_peer_info, p_peer_info] = td::actor::StartedTask<RATLSAttestedPeerInfo>::make_bridge();
140 auto ssl_stream = co_await create_server_ssl_stream(
141 std::move(cert_and_key),
142 std::make_shared<RATLSPolicyHelper>(std::move(policy), std::move(p_peer_info), source, destination));
143 auto proxy = td::actor::create_actor<TlsPipeWorker>(PSLICE() << "TlsPipeWorker" << name, std::move(pipe),
144 std::move(ssl_stream))
145 .release();
146 auto peer_info = co_await std::move(t_peer_info);
147 auto tls_pipe = co_await ask(proxy, &TlsPipeWorker::extract_fd);
148 co_return std::make_pair(std::move(tls_pipe), std::move(peer_info));
149}
150
151td::StringBuilder &operator<<(td::StringBuilder &sb, const ProxyState &state) {
152 sb << state.state_;

Callers 1

task_loop_onceMethod · 0.85

Calls 1

create_server_ssl_streamFunction · 0.85

Tested by

no test coverage detected