26 lines
524 B
C++
26 lines
524 B
C++
#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_;
|
|
};
|