mirror of https://github.com/tp4a/teleport
parent
45edd4e21f
commit
32e0991164
|
@ -17,7 +17,7 @@ debug=0
|
||||||
|
|
||||||
; 'replay-path' define the replay file location. if not set, default location
|
; 'replay-path' define the replay file location. if not set, default location
|
||||||
; to $INSTDIR%/data/replay/
|
; to $INSTDIR%/data/replay/
|
||||||
;replay-path=/var/lib/teleport/data/replay
|
;replay-path=/var/lib/teleport/replay
|
||||||
|
|
||||||
web-server-rpc=http://127.0.0.1:7190/rpc
|
web-server-rpc=http://127.0.0.1:7190/rpc
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,16 @@ bool TsEnv::init(bool load_config)
|
||||||
EXLOG_DEBUG(true);
|
EXLOG_DEBUG(true);
|
||||||
|
|
||||||
ex_wstr tmp;
|
ex_wstr tmp;
|
||||||
|
|
||||||
|
if (!ps->GetStr(L"web-server-rpc", tmp))
|
||||||
|
{
|
||||||
|
web_server_rpc = "http://127.0.0.1:7190/rpc";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ex_wstr2astr(tmp, web_server_rpc);
|
||||||
|
}
|
||||||
|
|
||||||
ps = m_ini.GetSection(L"rpc");
|
ps = m_ini.GetSection(L"rpc");
|
||||||
if (!ps->GetStr(L"bind-ip", tmp))
|
if (!ps->GetStr(L"bind-ip", tmp))
|
||||||
{
|
{
|
||||||
|
@ -125,11 +135,18 @@ bool TsEnv::init(bool load_config)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ex_wstr2astr(tmp, rpc_bind_ip);
|
ex_wstr2astr(tmp, rpc_bind_ip);
|
||||||
|
if (rpc_bind_ip == "localhost")
|
||||||
|
rpc_bind_ip = "127.0.0.1";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ps->GetInt(L"bind-port", rpc_bind_port))
|
if (!ps->GetInt(L"bind-port", rpc_bind_port))
|
||||||
{
|
{
|
||||||
rpc_bind_port = TS_HTTP_RPC_PORT;
|
rpc_bind_port = TS_HTTP_RPC_PORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char port_str[20] = { 0 };
|
||||||
|
ex_strformat(port_str, 20, "%d", rpc_bind_port);
|
||||||
|
core_server_rpc = "http://" + rpc_bind_ip + ":" + port_str + "/rpc";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,9 @@ public:
|
||||||
ex_astr rpc_bind_ip;
|
ex_astr rpc_bind_ip;
|
||||||
int rpc_bind_port;
|
int rpc_bind_port;
|
||||||
|
|
||||||
|
ex_astr web_server_rpc;
|
||||||
|
ex_astr core_server_rpc;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ExIniFile m_ini;
|
ExIniFile m_ini;
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,7 +77,11 @@ bool TsHttpRpc::init(void)
|
||||||
m_host_port = g_env.rpc_bind_port;
|
m_host_port = g_env.rpc_bind_port;
|
||||||
|
|
||||||
char addr[128] = { 0 };
|
char addr[128] = { 0 };
|
||||||
if (0 == strcmp(m_host_ip.c_str(), "127.0.0.1") || 0 == strcmp(m_host_ip.c_str(), "localhost"))
|
// if (0 == strcmp(m_host_ip.c_str(), "127.0.0.1") || 0 == strcmp(m_host_ip.c_str(), "localhost"))
|
||||||
|
// ex_strformat(addr, 128, ":%d", m_host_port);
|
||||||
|
// else
|
||||||
|
// ex_strformat(addr, 128, "%s:%d", m_host_ip.c_str(), m_host_port);
|
||||||
|
if (0 == strcmp(m_host_ip.c_str(), "0.0.0.0"))
|
||||||
ex_strformat(addr, 128, ":%d", m_host_port);
|
ex_strformat(addr, 128, ":%d", m_host_port);
|
||||||
else
|
else
|
||||||
ex_strformat(addr, 128, "%s:%d", m_host_ip.c_str(), m_host_port);
|
ex_strformat(addr, 128, "%s:%d", m_host_ip.c_str(), m_host_port);
|
||||||
|
|
|
@ -13,7 +13,8 @@ bool ts_web_rpc_register_core()
|
||||||
jreq["method"] = "register_core";
|
jreq["method"] = "register_core";
|
||||||
//jreq["param"]["ip"] = g_env.rpc_bind_ip.c_str();
|
//jreq["param"]["ip"] = g_env.rpc_bind_ip.c_str();
|
||||||
//jreq["param"]["port"] = g_env.rpc_bind_port;
|
//jreq["param"]["port"] = g_env.rpc_bind_port;
|
||||||
jreq["param"]["rpc"] = "http://127.0.0.1:52080/rpc";
|
//jreq["param"]["rpc"] = "http://127.0.0.1:52080/rpc";
|
||||||
|
jreq["param"]["rpc"] = g_env.core_server_rpc;
|
||||||
|
|
||||||
// ExIniFile& ini = g_env.get_ini();
|
// ExIniFile& ini = g_env.get_ini();
|
||||||
// ExIniSection* sec = ini.GetSection(L"common");
|
// ExIniSection* sec = ini.GetSection(L"common");
|
||||||
|
@ -33,7 +34,9 @@ bool ts_web_rpc_register_core()
|
||||||
ex_astr param;
|
ex_astr param;
|
||||||
ts_url_encode(json_param.c_str(), param);
|
ts_url_encode(json_param.c_str(), param);
|
||||||
|
|
||||||
ex_astr url = "http://127.0.0.1:7190/rpc?";
|
//ex_astr url = "http://127.0.0.1:7190/rpc?";
|
||||||
|
ex_astr url = g_env.web_server_rpc;
|
||||||
|
url += "?";
|
||||||
url += param;
|
url += param;
|
||||||
|
|
||||||
ex_astr body;
|
ex_astr body;
|
||||||
|
@ -52,7 +55,10 @@ bool ts_web_rpc_get_auth_info(int auth_id, Json::Value& jret)
|
||||||
|
|
||||||
ex_astr param;
|
ex_astr param;
|
||||||
ts_url_encode(json_param.c_str(), param);
|
ts_url_encode(json_param.c_str(), param);
|
||||||
ex_astr url = "http://127.0.0.1:7190/rpc?";
|
|
||||||
|
//ex_astr url = "http://127.0.0.1:7190/rpc?";
|
||||||
|
ex_astr url = g_env.web_server_rpc;
|
||||||
|
url += "?";
|
||||||
url += param;
|
url += param;
|
||||||
|
|
||||||
ex_astr body;
|
ex_astr body;
|
||||||
|
@ -114,7 +120,10 @@ bool ts_web_rpc_session_begin(TS_SESSION_INFO& info, int& record_id)
|
||||||
|
|
||||||
ex_astr param;
|
ex_astr param;
|
||||||
ts_url_encode(json_param.c_str(), param);
|
ts_url_encode(json_param.c_str(), param);
|
||||||
ex_astr url = "http://127.0.0.1:7190/rpc?";
|
|
||||||
|
//ex_astr url = "http://127.0.0.1:7190/rpc?";
|
||||||
|
ex_astr url = g_env.web_server_rpc;
|
||||||
|
url += "?";
|
||||||
url += param;
|
url += param;
|
||||||
|
|
||||||
ex_astr body;
|
ex_astr body;
|
||||||
|
@ -157,13 +166,11 @@ bool ts_web_rpc_session_end(int record_id, int ret_code)
|
||||||
|
|
||||||
ex_astr param;
|
ex_astr param;
|
||||||
ts_url_encode(json_param.c_str(), param);
|
ts_url_encode(json_param.c_str(), param);
|
||||||
ex_astr url = "http://127.0.0.1:7190/rpc?";
|
|
||||||
url += param;
|
|
||||||
|
|
||||||
// ex_astr param;
|
//ex_astr url = "http://127.0.0.1:7190/rpc?";
|
||||||
// ts_url_encode("{\"method\":\"session_end\",\"param\":[]}", param);
|
ex_astr url = g_env.web_server_rpc;
|
||||||
// ex_astr url = "http://127.0.0.1:7190/rpc?";
|
url += "?";
|
||||||
// url += param;
|
url += param;
|
||||||
|
|
||||||
ex_astr body;
|
ex_astr body;
|
||||||
return ts_http_get(url, body);
|
return ts_http_get(url, body);
|
||||||
|
|
Loading…
Reference in New Issue