Package org.eblocker.server.common.data
Interface DataSource
- All Known Implementing Classes:
JedisDataSource
public interface DataSource
Provides access to persistent data, e.g. devices, users, ...
-
Method Summary
Modifier and TypeMethodDescriptionAdd a new userbooleanbooleanvoidRemoves the DHCP range.voidPersist a snapshot of the database to disk.voidvoidvoidvoidDelete a devicevoidDeletes a uservoidvoid<T> T<T> T<T> List<T>getAppModuleState(int moduleID) Get the 'enabled' status of the AppWhitelistModule with a certain IDReturn the configuration for automatic updatesGet the state of the AutomaticUpdater (active or not)booleanReturns the flag that indicates that the last shutdown was clean.Get the currently used language in the frontendGet the current set of country names, which were chosen as allowed tor exit node countriesReturns a device with a specific IDReturns a sorted set of all device IDsReturns a sorted set of all devicesGet the pause in seconds between scanning for new devicesReturns the range of IP addresses the DHCP server should give to clientsbooleanReturns the router's IP addressbooleanbooleanjava.time.LocalDateTimeGet the last time an update was performedbooleanbooleanbyte[]getRedirectDecision(String sessionId, String domain) booleanbooleanGet the POSIX timezone stringReturns all user IDsReturns the current schema version.booleanGet the current state of the blocking of WebRTCbooleanbooleanbooleanbooleanbooleanbooleanbooleanintvoidSave a devicevoidSave a uservoidsave(AutomaticUpdaterConfiguration configuration) Save the new time frame for automatic updates<T> Tsave(T entity) <T> Tsave(T entity, int id) voidsaveCurrentTorExitNodes(Set<String> selectedCountries) Save the current set of exit nodes in allowed countries for Tor instancevoidsaveLastUpdateTime(java.time.LocalDateTime lastUpdate) Save the last time an update was executed (either automatic or manually)voidvoidsetAppWhitelistModuleStatus(int moduleID, boolean enabled) Set an 'enabled' status for a certain AppWhitelistModulevoidsetAutoEnableNewDevices(boolean autoEnableNewDevices) voidsetAutomaticUpdatesActivated(boolean activated) Save the state of the AutomaticUpdatervoidsetCleanShutdownFlag(boolean cleanShutdown) Sets the flag that indicates that the last shutdown was clean.voidsetCompressionMode(CompressionMode compressionMode) voidsetContentFilterEnabled(boolean enabled) voidsetCurrentLanguage(Language language) Set the current language for the frontendvoidsetCurrentNetworkState(NetworkStateId networkState) voidsetDeviceScanningInterval(Long seconds) Set the pause in seconds between scanning for new devicesvoidsetDhcpLeaseTime(Integer leaseTime) voidsetDhcpRange(DhcpRange range) Sets the range of IP addresses the DHCP server should give to clientsvoidsetDntHeaderState(boolean enabled) Enable or disable setting the DNT (Do not track) HeadervoidsetDoNotShowReminder(boolean show) Enable or disable displaying the license expiration reminder to the uservoidsetGateway(String gateway) Set the router's IP addressvoidsetGoogleCaptivePortalRedirectorState(boolean enabled) Enable or disable the direct responding (by the eBlocker) to the "Google Captive Portal check"voidsetHTTPRefererRemovingState(boolean enabled) Enable or disable the deletion of the HTTP Referer header from the requestsvoidsetIdSequence(Class<?> entityClass, int value) Sets id sequence to initial value.voidsetIpAddressesFixed(boolean fixed) voidsetIpFixedByDefault(boolean ipFixedByDefault) voidsetIsExpertMode(boolean expert) voidsetMalwareUrlFilterEnabled(boolean enabled) voidvoidsetOpenVpnMappedPort(Integer port) voidvoidsetOpenVpnServerFirstRun(boolean state) voidsetOpenVpnServerHost(String host) voidsetOpenVpnServerState(boolean state) voidsetPasswordHash(byte[] passwordHash) voidsetPrivacyExtensionsEnabled(boolean enabled) voidsetRedirectDecision(String sessionId, String domain, Decision decision) voidsetResolvedDnsGateway(String gateway) voidsetRouterAdvertisementsEnabled(boolean enabled) voidsetShowSplashScreen(boolean show) Enable or disable displaying of the splash screen for eBlocker 2voidsetSSLEnabledState(boolean enabled) voidsetSslRecordErrors(boolean recordSslErrors) voidsetTimezone(String posixString) Save the POSIX timezone String for the default timezone to usevoidsetVersion(String version) Sets the current schema version.voidsetWebRTCBlockingState(boolean enabled) Enable or disable the WebRTCBlockerProcessor, to block WebRTC connection establishments because it might leak the IP (even though the client is routed through TOR)voidupdateLastSeen(Device device) Update only the last seen timestamp of a device
-
Method Details
-
getIds
-
get
-
getAll
-
save
<T> T save(T entity, int id) -
delete
-
deleteAll
-
nextId
-
get
-
save
<T> T save(T entity) -
delete
-
keys
-
delete
-
setIdSequence
Sets id sequence to initial value. This method should only used by migrations. -
getGateway
String getGateway()Returns the router's IP address -
setGateway
Set the router's IP address- Parameters:
gateway-
-
getDeviceIds
Returns a sorted set of all device IDs -
getDevices
Returns a sorted set of all devices -
getDevice
Returns a device with a specific ID -
getDeviceScanningInterval
Long getDeviceScanningInterval()Get the pause in seconds between scanning for new devices- Returns:
-
setDeviceScanningInterval
Set the pause in seconds between scanning for new devices -
getUserIds
Returns all user IDs- Returns:
-
save
Save a device- Parameters:
device-
-
updateLastSeen
Update only the last seen timestamp of a device -
save
Save a user- Parameters:
user-
-
addUser
Add a new user- Parameters:
user-- Returns:
-
delete
Deletes a user- Parameters:
user-
-
delete
Delete a device- Parameters:
device-
-
getVersion
String getVersion()Returns the current schema version. This method should only used by migrations.- Returns:
-
setVersion
Sets the current schema version. This method should only be used by migrations.- Parameters:
version-
-
setCurrentNetworkState
- Parameters:
networkState-
-
getCurrentNetworkState
NetworkStateId getCurrentNetworkState()- Returns:
-
setDhcpRange
Sets the range of IP addresses the DHCP server should give to clients- Parameters:
range-
-
clearDhcpRange
void clearDhcpRange()Removes the DHCP range. -
getDhcpRange
DhcpRange getDhcpRange()Returns the range of IP addresses the DHCP server should give to clients- Returns:
-
getAutomaticUpdateConfig
AutomaticUpdaterConfiguration getAutomaticUpdateConfig()Return the configuration for automatic updates- Returns:
-
save
Save the new time frame for automatic updates- Parameters:
configuration-
-
setAutomaticUpdatesActivated
void setAutomaticUpdatesActivated(boolean activated) Save the state of the AutomaticUpdater- Parameters:
activated-
-
getAutomaticUpdatesActivated
String getAutomaticUpdatesActivated()Get the state of the AutomaticUpdater (active or not)- Returns:
- String "true" or "false" if this information exists, null otherwise
-
createSnapshot
void createSnapshot()Persist a snapshot of the database to disk. Call this method after important data has been written. -
saveSynchronously
void saveSynchronously() -
saveLastUpdateTime
void saveLastUpdateTime(java.time.LocalDateTime lastUpdate) Save the last time an update was executed (either automatic or manually)- Parameters:
lastUpdate-
-
getLastUpdateTime
java.time.LocalDateTime getLastUpdateTime()Get the last time an update was performed- Returns:
-
getSSLEnabledState
boolean getSSLEnabledState() -
setSSLEnabledState
void setSSLEnabledState(boolean enabled) -
saveCurrentTorExitNodes
Save the current set of exit nodes in allowed countries for Tor instance- Parameters:
selectedCountries-
-
getCurrentTorExitNodes
Get the current set of country names, which were chosen as allowed tor exit node countries- Returns:
-
setWebRTCBlockingState
void setWebRTCBlockingState(boolean enabled) Enable or disable the WebRTCBlockerProcessor, to block WebRTC connection establishments because it might leak the IP (even though the client is routed through TOR)- Parameters:
enabled-
-
getWebRTCBlockingState
boolean getWebRTCBlockingState()Get the current state of the blocking of WebRTC- Returns:
-
setHTTPRefererRemovingState
void setHTTPRefererRemovingState(boolean enabled) Enable or disable the deletion of the HTTP Referer header from the requests- Parameters:
enabled-
-
getHTTPRefererRemovingState
boolean getHTTPRefererRemovingState() -
setGoogleCaptivePortalRedirectorState
void setGoogleCaptivePortalRedirectorState(boolean enabled) Enable or disable the direct responding (by the eBlocker) to the "Google Captive Portal check"- Parameters:
enabled-
-
getGoogleCaptivePortalRedirectorState
boolean getGoogleCaptivePortalRedirectorState() -
setDntHeaderState
void setDntHeaderState(boolean enabled) Enable or disable setting the DNT (Do not track) Header- Parameters:
enabled-
-
getDntHeaderState
boolean getDntHeaderState() -
setDoNotShowReminder
void setDoNotShowReminder(boolean show) Enable or disable displaying the license expiration reminder to the user- Parameters:
show-
-
isDoNotShowReminder
boolean isDoNotShowReminder() -
setShowSplashScreen
void setShowSplashScreen(boolean show) Enable or disable displaying of the splash screen for eBlocker 2- Parameters:
show-
-
isShowSplashScreen
boolean isShowSplashScreen() -
setAutoEnableNewDevices
void setAutoEnableNewDevices(boolean autoEnableNewDevices) -
isAutoEnableNewDevices
boolean isAutoEnableNewDevices() -
getCompressionMode
CompressionMode getCompressionMode() -
setCompressionMode
-
getSslRecordErrors
boolean getSslRecordErrors() -
setSslRecordErrors
void setSslRecordErrors(boolean recordSslErrors) -
getCurrentLanguage
Language getCurrentLanguage()Get the currently used language in the frontend- Returns:
-
setCurrentLanguage
Set the current language for the frontend- Parameters:
language-
-
setTimezone
Save the POSIX timezone String for the default timezone to use- Parameters:
posixString-
-
getTimezone
String getTimezone()Get the POSIX timezone string- Returns:
-
getAppModuleState
Get the 'enabled' status of the AppWhitelistModule with a certain ID- Parameters:
moduleID-- Returns:
- DEFAULT: if no status was set by the user, it is still the default ENABLED: the user enabled the module DISABLED: the user disabled the module
-
setAppWhitelistModuleStatus
void setAppWhitelistModuleStatus(int moduleID, boolean enabled) Set an 'enabled' status for a certain AppWhitelistModule- Parameters:
moduleID-enabled-
-
getRedirectDecision
-
setRedirectDecision
-
setPasswordHash
void setPasswordHash(byte[] passwordHash) -
getPasswordHash
byte[] getPasswordHash() -
deletePasswordHash
void deletePasswordHash() -
getListsPackageVersion
String getListsPackageVersion() -
isIpFixedByDefault
boolean isIpFixedByDefault() -
setIsExpertMode
void setIsExpertMode(boolean expert) -
isExpertMode
boolean isExpertMode() -
setIpFixedByDefault
void setIpFixedByDefault(boolean ipFixedByDefault) -
setIpAddressesFixed
void setIpAddressesFixed(boolean fixed) -
getCleanShutdownFlag
boolean getCleanShutdownFlag()Returns the flag that indicates that the last shutdown was clean.- Returns:
- true if the shutdown was clean (or if it has never been set yet)
-
setCleanShutdownFlag
void setCleanShutdownFlag(boolean cleanShutdown) Sets the flag that indicates that the last shutdown was clean. Set this to false during startup (after evaluating the flag). Set this to true in a shutdown hook.- Parameters:
cleanShutdown-
-
setOpenVpnServerState
void setOpenVpnServerState(boolean state) -
getOpenVpnServerState
boolean getOpenVpnServerState() -
setOpenVpnServerFirstRun
void setOpenVpnServerFirstRun(boolean state) -
getOpenVpnServerFirstRun
boolean getOpenVpnServerFirstRun() -
setOpenVpnServerHost
-
getOpenVpnServerHost
String getOpenVpnServerHost() -
getOpenVpnMappedPort
Integer getOpenVpnMappedPort() -
setOpenVpnMappedPort
-
getOpenVpnPortForwardingMode
PortForwardingMode getOpenVpnPortForwardingMode() -
setOpenVpnPortForwardingMode
-
getOpenVpnExternalAddressType
ExternalAddressType getOpenVpnExternalAddressType() -
setOpenVpnExternalAddressType
-
getResolvedDnsGateway
String getResolvedDnsGateway() -
setResolvedDnsGateway
-
getDhcpLeaseTime
Integer getDhcpLeaseTime() -
setDhcpLeaseTime
-
isMalwareUrlFilterEnabled
boolean isMalwareUrlFilterEnabled() -
setMalwareUrlFilterEnabled
void setMalwareUrlFilterEnabled(boolean enabled) -
isContentFilterEnabled
boolean isContentFilterEnabled() -
setContentFilterEnabled
void setContentFilterEnabled(boolean enabled) -
areRouterAdvertisementsEnabled
boolean areRouterAdvertisementsEnabled() -
setRouterAdvertisementsEnabled
void setRouterAdvertisementsEnabled(boolean enabled) -
arePrivacyExtensionsEnabled
boolean arePrivacyExtensionsEnabled() -
setPrivacyExtensionsEnabled
void setPrivacyExtensionsEnabled(boolean enabled)
-