(cobra) IXCobraConfig struct has tlsOptions and per message deflate options
This commit is contained in:
19
ws/ws.cpp
19
ws/ws.cpp
@ -356,6 +356,10 @@ int main(int argc, char** argv)
|
||||
tlsOptions.caFile = "NONE";
|
||||
}
|
||||
|
||||
// Cobra config
|
||||
cobraConfig.webSocketPerMessageDeflateOptions = ix::WebSocketPerMessageDeflateOptions(true);
|
||||
cobraConfig.socketTLSOptions = tlsOptions;
|
||||
|
||||
int ret = 1;
|
||||
if (app.got_subcommand("transfer"))
|
||||
{
|
||||
@ -425,17 +429,17 @@ int main(int argc, char** argv)
|
||||
else if (app.got_subcommand("cobra_subscribe"))
|
||||
{
|
||||
ret = ix::ws_cobra_subscribe_main(
|
||||
cobraConfig, channel, filter, quiet, fluentd, tlsOptions);
|
||||
cobraConfig, channel, filter, quiet, fluentd);
|
||||
}
|
||||
else if (app.got_subcommand("cobra_publish"))
|
||||
{
|
||||
ret = ix::ws_cobra_publish_main(
|
||||
cobraConfig, channel, path, tlsOptions);
|
||||
cobraConfig, channel, path);
|
||||
}
|
||||
else if (app.got_subcommand("cobra_metrics_publish"))
|
||||
{
|
||||
ret = ix::ws_cobra_metrics_publish_main(
|
||||
cobraConfig, channel, path, stress, tlsOptions);
|
||||
cobraConfig, channel, path, stress);
|
||||
}
|
||||
else if (app.got_subcommand("cobra_to_statsd"))
|
||||
{
|
||||
@ -446,8 +450,7 @@ int main(int argc, char** argv)
|
||||
statsdPort,
|
||||
prefix,
|
||||
fields,
|
||||
verbose,
|
||||
tlsOptions);
|
||||
verbose);
|
||||
}
|
||||
else if (app.got_subcommand("cobra_to_sentry"))
|
||||
{
|
||||
@ -458,8 +461,7 @@ int main(int argc, char** argv)
|
||||
verbose,
|
||||
strict,
|
||||
jobs,
|
||||
maxQueueSize,
|
||||
tlsOptions);
|
||||
maxQueueSize);
|
||||
}
|
||||
else if (app.got_subcommand("cobra_metrics_to_redis"))
|
||||
{
|
||||
@ -467,8 +469,7 @@ int main(int argc, char** argv)
|
||||
channel,
|
||||
filter,
|
||||
hostname,
|
||||
redisPort,
|
||||
tlsOptions);
|
||||
redisPort);
|
||||
}
|
||||
else if (app.got_subcommand("snake"))
|
||||
{
|
||||
|
18
ws/ws.h
18
ws/ws.h
@ -79,19 +79,16 @@ namespace ix
|
||||
const std::string& channel,
|
||||
const std::string& filter,
|
||||
bool quiet,
|
||||
bool fluentd,
|
||||
const ix::SocketTLSOptions& tlsOptions);
|
||||
bool fluentd);
|
||||
|
||||
int ws_cobra_publish_main(const ix::CobraConfig& appkey,
|
||||
const std::string& channel,
|
||||
const std::string& path,
|
||||
const ix::SocketTLSOptions& tlsOptions);
|
||||
const std::string& path);
|
||||
|
||||
int ws_cobra_metrics_publish_main(const ix::CobraConfig& config,
|
||||
const std::string& channel,
|
||||
const std::string& path,
|
||||
bool stress,
|
||||
const ix::SocketTLSOptions& tlsOptions);
|
||||
bool stress);
|
||||
|
||||
int ws_cobra_to_statsd_main(const ix::CobraConfig& config,
|
||||
const std::string& channel,
|
||||
@ -100,8 +97,7 @@ namespace ix
|
||||
int port,
|
||||
const std::string& prefix,
|
||||
const std::string& fields,
|
||||
bool verbose,
|
||||
const ix::SocketTLSOptions& tlsOptions);
|
||||
bool verbose);
|
||||
|
||||
int ws_cobra_to_sentry_main(const ix::CobraConfig& config,
|
||||
const std::string& channel,
|
||||
@ -110,15 +106,13 @@ namespace ix
|
||||
bool verbose,
|
||||
bool strict,
|
||||
int jobs,
|
||||
size_t maxQueueSize,
|
||||
const ix::SocketTLSOptions& tlsOptions);
|
||||
size_t maxQueueSize);
|
||||
|
||||
int ws_cobra_metrics_to_redis(const ix::CobraConfig& config,
|
||||
const std::string& channel,
|
||||
const std::string& filter,
|
||||
const std::string& host,
|
||||
int port,
|
||||
const ix::SocketTLSOptions& tlsOptions);
|
||||
int port);
|
||||
|
||||
int ws_snake_main(int port,
|
||||
const std::string& hostname,
|
||||
|
@ -18,8 +18,7 @@ namespace ix
|
||||
int ws_cobra_metrics_publish_main(const ix::CobraConfig& config,
|
||||
const std::string& channel,
|
||||
const std::string& path,
|
||||
bool stress,
|
||||
const ix::SocketTLSOptions& tlsOptions)
|
||||
bool stress)
|
||||
{
|
||||
std::atomic<int> sentMessages(0);
|
||||
std::atomic<int> ackedMessages(0);
|
||||
@ -34,7 +33,7 @@ namespace ix
|
||||
|
||||
bool enablePerMessageDeflate = true;
|
||||
cobraMetricsPublisher.configure(
|
||||
config.appkey, config.endpoint, channel, config.rolename, config.rolesecret, enablePerMessageDeflate, tlsOptions);
|
||||
config.appkey, config.endpoint, channel, config.rolename, config.rolesecret, enablePerMessageDeflate, config.socketTLSOptions);
|
||||
|
||||
while (!cobraMetricsPublisher.isAuthenticated())
|
||||
;
|
||||
|
@ -21,16 +21,10 @@ namespace ix
|
||||
const std::string& channel,
|
||||
const std::string& filter,
|
||||
const std::string& host,
|
||||
int port,
|
||||
const ix::SocketTLSOptions& tlsOptions)
|
||||
int port)
|
||||
{
|
||||
ix::CobraConnection conn;
|
||||
conn.configure(config.appkey,
|
||||
config.endpoint,
|
||||
config.rolename,
|
||||
config.rolesecret,
|
||||
ix::WebSocketPerMessageDeflateOptions(true),
|
||||
tlsOptions);
|
||||
conn.configure(config);
|
||||
conn.connect();
|
||||
|
||||
// Display incoming messages
|
||||
|
@ -18,8 +18,7 @@ namespace ix
|
||||
{
|
||||
int ws_cobra_publish_main(const ix::CobraConfig& config,
|
||||
const std::string& channel,
|
||||
const std::string& path,
|
||||
const ix::SocketTLSOptions& tlsOptions)
|
||||
const std::string& path)
|
||||
{
|
||||
std::ifstream f(path);
|
||||
std::string str((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
|
||||
@ -33,12 +32,7 @@ namespace ix
|
||||
}
|
||||
|
||||
ix::CobraConnection conn;
|
||||
conn.configure(config.appkey,
|
||||
config.endpoint,
|
||||
config.rolename,
|
||||
config.rolesecret,
|
||||
ix::WebSocketPerMessageDeflateOptions(true),
|
||||
tlsOptions);
|
||||
conn.configure(config);
|
||||
|
||||
// Display incoming messages
|
||||
std::atomic<bool> authenticated(false);
|
||||
|
@ -35,16 +35,10 @@ namespace ix
|
||||
const std::string& channel,
|
||||
const std::string& filter,
|
||||
bool quiet,
|
||||
bool fluentd,
|
||||
const ix::SocketTLSOptions& tlsOptions)
|
||||
bool fluentd)
|
||||
{
|
||||
ix::CobraConnection conn;
|
||||
conn.configure(config.appkey,
|
||||
config.endpoint,
|
||||
config.rolename,
|
||||
config.rolesecret,
|
||||
ix::WebSocketPerMessageDeflateOptions(true),
|
||||
tlsOptions);
|
||||
conn.configure(config);
|
||||
conn.connect();
|
||||
|
||||
Json::FastWriter jsonWriter;
|
||||
|
@ -99,16 +99,10 @@ namespace ix
|
||||
bool verbose,
|
||||
bool strict,
|
||||
int jobs,
|
||||
size_t maxQueueSize,
|
||||
const ix::SocketTLSOptions& tlsOptions)
|
||||
size_t maxQueueSize)
|
||||
{
|
||||
ix::CobraConnection conn;
|
||||
conn.configure(config.appkey,
|
||||
config.endpoint,
|
||||
config.rolename,
|
||||
config.rolesecret,
|
||||
ix::WebSocketPerMessageDeflateOptions(true),
|
||||
tlsOptions);
|
||||
conn.configure(config);
|
||||
conn.connect();
|
||||
|
||||
Json::FastWriter jsonWriter;
|
||||
|
@ -116,16 +116,10 @@ namespace ix
|
||||
int port,
|
||||
const std::string& prefix,
|
||||
const std::string& fields,
|
||||
bool verbose,
|
||||
const ix::SocketTLSOptions& tlsOptions)
|
||||
bool verbose)
|
||||
{
|
||||
ix::CobraConnection conn;
|
||||
conn.configure(config.appkey,
|
||||
config.endpoint,
|
||||
config.rolename,
|
||||
config.rolesecret,
|
||||
ix::WebSocketPerMessageDeflateOptions(true),
|
||||
tlsOptions);
|
||||
conn.configure(config);
|
||||
conn.connect();
|
||||
|
||||
auto tokens = parseFields(fields);
|
||||
|
Reference in New Issue
Block a user