Skip to content
API Documentation
BastionGuard™
GoogleSafe Class Reference

#include <google_safe.hpp>

Public Member Functions

 GoogleSafe ()
bool is_enabled () const
bool is_unsafe (const std::string &url, std::string &threatType)

Private Attributes

std::string api_key_
bool enabled_ = false

Detailed Description

Definition at line 24 of file google_safe.hpp.

Constructor & Destructor Documentation

◆ GoogleSafe()

GoogleSafe::GoogleSafe ( )

Definition at line 28 of file google_safe.cpp.

28 {
29 try {
30
31 std::string conf = Glib::get_home_dir() + "/.config/BastionGuard/google_safe.conf";
32 std::ifstream f(conf);
33 if (f.is_open())
34 std::getline(f, api_key_);
35 std::string flag = Glib::get_home_dir() + "/.config/BastionGuard/google_safe_enabled";
36 enabled_ = std::filesystem::exists(flag);
37 } catch (...) {
38 enabled_ = false;
39 }
40
41 if (enabled_)
42 std::cout << _("[GoogleSafe] 🛈 Modulo attivo ma disabilitato in questa build (dnsmasq backend)\n");
43}
#define _(s)
std::string api_key_

References _, api_key_, and enabled_.

Member Function Documentation

◆ is_enabled()

bool GoogleSafe::is_enabled ( ) const

Definition at line 45 of file google_safe.cpp.

45 {
46 return false;
47}

◆ is_unsafe()

bool GoogleSafe::is_unsafe ( const std::string & url,
std::string & threatType )

Definition at line 49 of file google_safe.cpp.

49 {
50 (void)url;
51 (void)threatType;
52 return false;
53}

Member Data Documentation

◆ api_key_

std::string GoogleSafe::api_key_
private

Definition at line 32 of file google_safe.hpp.

Referenced by GoogleSafe().

◆ enabled_

bool GoogleSafe::enabled_ = false
private

Definition at line 33 of file google_safe.hpp.

Referenced by GoogleSafe().


The documentation for this class was generated from the following files: