kunlang_video/include/tunnel_client.hpp

26 lines
524 B
C++
Raw Normal View History

2026-01-21 14:02:52 +08:00
#pragma once
#include <atomic>
#include <string>
#include <thread>
class TunnelClient
{
public:
TunnelClient(const std::string& vid, const std::string& server_ws_url, int local_http_port);
void start();
void stop();
private:
void run_loop();
std::string handle_local_http(const std::string& method, const std::string& path, const std::string& body);
private:
std::string vid_;
std::string ws_url_;
int local_port_;
std::atomic<bool> running_{false};
std::thread th_;
};