Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
78 lines (42 loc) · 1.39 KB
/
Copy pathmain.cpp
File metadata and controls
78 lines (42 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <iostream>
#include <string>
#include <memory>
#include <thread>
#include <boost/asio.hpp>
#include <conn_handler.h>
using namespace std;
class server_operations{
public:
void start_server(domain_details domain);
bool server_status();
server_operations(boost::asio::io_context& context,std::vector<domain_details> endpoint_url,boost::asio::ssl::context& ssl_context,std::string algo)
: server(context,endpoint_url,ssl_context,algo) {};
private:
server_engine server;
};
void server_operations::start_server(domain_details domain){
try{
server.open_listener(domain);
} catch(const exception& e){
cout<<"Internal Server Error "<<e.what()<<endl;
};
};
bool server_operations::server_status(){
return server.get_server_status();
};
int main(){
//proxy domain address
domain_details engine_domain = { "localhost", "8888" };
//endpoint server domain
domain_details beryl_id_engine={"localhost","8080"};
//algo
std::string traffic_algo="round_robin";
std::vector<domain_details> endpoint;
endpoint.push_back(beryl_id_engine);
boost::asio::io_context context;
boost::asio::ssl::context ssl(boost::asio::ssl::context::tlsv12_client);
server_operations server_constructor(context,endpoint,ssl,traffic_algo);
server_constructor.start_server(engine_domain);
context.run();
return 0;
}