Introduce option to enable SSL encryption for LocalTrajectoryUploader (#1084)
parent
3383643627
commit
337e594662
|
@ -41,8 +41,8 @@ const common::Duration kPopTimeout = common::FromMilliseconds(100);
|
||||||
class LocalTrajectoryUploader : public LocalTrajectoryUploaderInterface {
|
class LocalTrajectoryUploader : public LocalTrajectoryUploaderInterface {
|
||||||
public:
|
public:
|
||||||
LocalTrajectoryUploader(const std::string &uplink_server_address,
|
LocalTrajectoryUploader(const std::string &uplink_server_address,
|
||||||
int batch_size);
|
int batch_size, bool enable_ssl_encryption);
|
||||||
~LocalTrajectoryUploader() {}
|
~LocalTrajectoryUploader();
|
||||||
|
|
||||||
// Starts the upload thread.
|
// Starts the upload thread.
|
||||||
void Start() final;
|
void Start() final;
|
||||||
|
@ -75,9 +75,13 @@ class LocalTrajectoryUploader : public LocalTrajectoryUploaderInterface {
|
||||||
};
|
};
|
||||||
|
|
||||||
LocalTrajectoryUploader::LocalTrajectoryUploader(
|
LocalTrajectoryUploader::LocalTrajectoryUploader(
|
||||||
const std::string &uplink_server_address, int batch_size)
|
const std::string &uplink_server_address, int batch_size,
|
||||||
|
bool enable_ssl_encryption)
|
||||||
: client_channel_(::grpc::CreateChannel(
|
: client_channel_(::grpc::CreateChannel(
|
||||||
uplink_server_address, ::grpc::InsecureChannelCredentials())),
|
uplink_server_address,
|
||||||
|
enable_ssl_encryption
|
||||||
|
? ::grpc::SslCredentials(::grpc::SslCredentialsOptions())
|
||||||
|
: ::grpc::InsecureChannelCredentials())),
|
||||||
batch_size_(batch_size) {
|
batch_size_(batch_size) {
|
||||||
std::chrono::system_clock::time_point deadline(
|
std::chrono::system_clock::time_point deadline(
|
||||||
std::chrono::system_clock::now() +
|
std::chrono::system_clock::now() +
|
||||||
|
@ -88,6 +92,8 @@ LocalTrajectoryUploader::LocalTrajectoryUploader(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocalTrajectoryUploader::~LocalTrajectoryUploader() {}
|
||||||
|
|
||||||
void LocalTrajectoryUploader::Start() {
|
void LocalTrajectoryUploader::Start() {
|
||||||
CHECK(!shutting_down_);
|
CHECK(!shutting_down_);
|
||||||
CHECK(!upload_thread_);
|
CHECK(!upload_thread_);
|
||||||
|
@ -180,9 +186,10 @@ void LocalTrajectoryUploader::EnqueueSensorData(
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::unique_ptr<LocalTrajectoryUploaderInterface> CreateLocalTrajectoryUploader(
|
std::unique_ptr<LocalTrajectoryUploaderInterface> CreateLocalTrajectoryUploader(
|
||||||
const std::string &uplink_server_address, int batch_size) {
|
const std::string &uplink_server_address, int batch_size,
|
||||||
return make_unique<LocalTrajectoryUploader>(uplink_server_address,
|
bool enable_ssl_encryption) {
|
||||||
batch_size);
|
return make_unique<LocalTrajectoryUploader>(uplink_server_address, batch_size,
|
||||||
|
enable_ssl_encryption);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cloud
|
} // namespace cloud
|
||||||
|
|
|
@ -55,7 +55,8 @@ class LocalTrajectoryUploaderInterface {
|
||||||
|
|
||||||
// Returns LocalTrajectoryUploader with the actual implementation.
|
// Returns LocalTrajectoryUploader with the actual implementation.
|
||||||
std::unique_ptr<LocalTrajectoryUploaderInterface> CreateLocalTrajectoryUploader(
|
std::unique_ptr<LocalTrajectoryUploaderInterface> CreateLocalTrajectoryUploader(
|
||||||
const std::string& uplink_server_address, int batch_size);
|
const std::string& uplink_server_address, int batch_size,
|
||||||
|
bool enable_ssl_encryption);
|
||||||
|
|
||||||
} // namespace cloud
|
} // namespace cloud
|
||||||
} // namespace cartographer
|
} // namespace cartographer
|
||||||
|
|
|
@ -61,7 +61,8 @@ MapBuilderServer::MapBuilderServer(
|
||||||
if (!map_builder_server_options.uplink_server_address().empty()) {
|
if (!map_builder_server_options.uplink_server_address().empty()) {
|
||||||
local_trajectory_uploader_ = CreateLocalTrajectoryUploader(
|
local_trajectory_uploader_ = CreateLocalTrajectoryUploader(
|
||||||
map_builder_server_options.uplink_server_address(),
|
map_builder_server_options.uplink_server_address(),
|
||||||
map_builder_server_options.upload_batch_size());
|
map_builder_server_options.upload_batch_size(),
|
||||||
|
map_builder_server_options.enable_ssl_encryption());
|
||||||
}
|
}
|
||||||
server_builder.RegisterHandler<handlers::AddTrajectoryHandler>();
|
server_builder.RegisterHandler<handlers::AddTrajectoryHandler>();
|
||||||
server_builder.RegisterHandler<handlers::AddOdometryDataHandler>();
|
server_builder.RegisterHandler<handlers::AddOdometryDataHandler>();
|
||||||
|
|
|
@ -39,6 +39,8 @@ proto::MapBuilderServerOptions CreateMapBuilderServerOptions(
|
||||||
lua_parameter_dictionary->GetString("uplink_server_address"));
|
lua_parameter_dictionary->GetString("uplink_server_address"));
|
||||||
map_builder_server_options.set_upload_batch_size(
|
map_builder_server_options.set_upload_batch_size(
|
||||||
lua_parameter_dictionary->GetInt("upload_batch_size"));
|
lua_parameter_dictionary->GetInt("upload_batch_size"));
|
||||||
|
map_builder_server_options.set_enable_ssl_encryption(
|
||||||
|
lua_parameter_dictionary->GetBool("enable_ssl_encryption"));
|
||||||
return map_builder_server_options;
|
return map_builder_server_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,4 +25,5 @@ message MapBuilderServerOptions {
|
||||||
cartographer.mapping.proto.MapBuilderOptions map_builder_options = 4;
|
cartographer.mapping.proto.MapBuilderOptions map_builder_options = 4;
|
||||||
string uplink_server_address = 5;
|
string uplink_server_address = 5;
|
||||||
int32 upload_batch_size = 6;
|
int32 upload_batch_size = 6;
|
||||||
|
bool enable_ssl_encryption = 7;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,4 +21,5 @@ MAP_BUILDER_SERVER = {
|
||||||
server_address = "0.0.0.0:50051",
|
server_address = "0.0.0.0:50051",
|
||||||
uplink_server_address = "",
|
uplink_server_address = "",
|
||||||
upload_batch_size = 100,
|
upload_batch_size = 100,
|
||||||
|
enable_ssl_encryption = false,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue