| 356 | }); |
| 357 | } |
| 358 | void BaseRunner::initialize_rpc_server(td::Promise<td::Unit> promise) { |
| 359 | client_ = TcpClient::create(make_tcp_client_callback()); |
| 360 | for (auto &x : rpc_ports_) { |
| 361 | td::actor::send_closure(client_, &TcpClient::add_listening_port, generate_unique_uint64(), x.first, x.second); |
| 362 | } |
| 363 | |
| 364 | if (connection_to_proxy_via_.is_valid()) { |
| 365 | LOG(INFO) << "using proxy " << connection_to_proxy_via_; |
| 366 | td::actor::send_closure(client_, &TcpClient::add_connection_to_remote_app_type_rule, remote_app_type_proxy(), |
| 367 | std::make_shared<TcpConnectionType>(TcpConnectionSocks5(connection_to_proxy_via_))); |
| 368 | td::actor::send_closure(client_, &TcpClient::add_connection_to_remote_app_type_rule, remote_app_type_key_manager(), |
| 369 | std::make_shared<TcpConnectionType>(TcpConnectionSocks5(connection_to_proxy_via_))); |
| 370 | } else { |
| 371 | LOG(INFO) << "using " << (fake_tee_ ? "fake" : "real") << " tdx-tls connection"; |
| 372 | |
| 373 | auto make_tee = [&](bool fake) -> td::Result<TeeInterfaceRef> { |
| 374 | TRY_RESULT(tee_type, TeeInterface::this_cpu_tee_type()); |
| 375 | |
| 376 | switch (tee_type) { |
| 377 | case TeeType::Sev: |
| 378 | return sev::make_tee(fake, sev_tee_config_); |
| 379 | case TeeType::Tdx: |
| 380 | return tdx::make_tee(fake, tdx_tee_config_); |
| 381 | } |
| 382 | |
| 383 | UNREACHABLE(); |
| 384 | }; |
| 385 | TRY_RESULT_PROMISE(promise, tee_interface, make_tee(fake_tee_)); |
| 386 | TRY_RESULT_PROMISE(promise, cert_and_key, generate_cert_and_key(tee_interface.get())); |
| 387 | TRY_RESULT_PROMISE(promise, ratls_interface, RATLSInterface::make(scheduler_, fake_tee_, ratls_config_)); |
| 388 | |
| 389 | td::actor::send_closure( |
| 390 | client_, &TcpClient::add_connection_to_remote_app_type_rule, remote_app_type_proxy(), |
| 391 | std::make_shared<TcpConnectionType>(TcpConnectionTls(cert_and_key, RATLSPolicy::make(ratls_interface)))); |
| 392 | td::actor::send_closure( |
| 393 | client_, &TcpClient::add_connection_to_remote_app_type_rule, remote_app_type_key_manager(), |
| 394 | std::make_shared<TcpConnectionType>(TcpConnectionTls(cert_and_key, RATLSPolicy::make(ratls_interface)))); |
| 395 | } |
| 396 | promise.set_value(td::Unit()); |
| 397 | } |
| 398 | void BaseRunner::rpc_server_initialized() { |
| 399 | coro_init().start().detach("BaseRunner::coro_init"); |
| 400 | } |
nothing calls this directly
no test coverage detected