Package org.eblocker.server.common.data
Class JedisDataSource
java.lang.Object
org.eblocker.server.common.data.JedisDataSource
- All Implemented Interfaces:
DataSource
-
Constructor Summary
ConstructorsConstructorDescriptionJedisDataSource(redis.clients.jedis.JedisPool pool, com.fasterxml.jackson.databind.ObjectMapper objectMapper) -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.booleanbooleanvoidRemoves the DHCP range.voidPersist a snapshot of the database to disk.voidvoidvoidvoidDelete a devicevoidDeprecated.voidvoid<T> T<T> Tprotected <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 true the the eBlocker should add the DNT HeaderReturns the router's IP addressbooleanReturns true if eBlocker should respond to Google captive portal check requests.booleanprotected StringgetIdSequenceKey(Class<?> entityClass) protected Stringprotected Stringjava.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 WebRTCbooleanbooleanbooleanReturns true if the eBlocker should not display the license expiration reminder to the userbooleanbooleanbooleanbooleanintvoidSave a devicevoidDeprecated.voidsave(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
-
Constructor Details
-
JedisDataSource
@Inject public JedisDataSource(redis.clients.jedis.JedisPool pool, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
getKey
-
getKey
-
getIdSequenceKey
-
getIds
- Specified by:
getIdsin interfaceDataSource
-
get
- Specified by:
getin interfaceDataSource
-
get
- Specified by:
getin interfaceDataSource
-
get
-
getAll
- Specified by:
getAllin interfaceDataSource
-
save
public <T> T save(T entity, int id) - Specified by:
savein interfaceDataSource
-
save
public <T> T save(T entity) - Specified by:
savein interfaceDataSource
-
delete
- Specified by:
deletein interfaceDataSource
-
delete
- Specified by:
deletein interfaceDataSource
-
keys
- Specified by:
keysin interfaceDataSource
-
delete
- Specified by:
deletein interfaceDataSource
-
deleteAll
- Specified by:
deleteAllin interfaceDataSource
-
nextId
- Specified by:
nextIdin interfaceDataSource
-
setIdSequence
Description copied from interface:DataSourceSets id sequence to initial value. This method should only used by migrations.- Specified by:
setIdSequencein interfaceDataSource
-
getGateway
Description copied from interface:DataSourceReturns the router's IP address- Specified by:
getGatewayin interfaceDataSource
-
setGateway
Description copied from interface:DataSourceSet the router's IP address- Specified by:
setGatewayin interfaceDataSource
-
getDeviceIds
Description copied from interface:DataSourceReturns a sorted set of all device IDs- Specified by:
getDeviceIdsin interfaceDataSource
-
getDevices
Description copied from interface:DataSourceReturns a sorted set of all devices- Specified by:
getDevicesin interfaceDataSource
-
getDeviceScanningInterval
Description copied from interface:DataSourceGet the pause in seconds between scanning for new devices- Specified by:
getDeviceScanningIntervalin interfaceDataSource- Returns:
-
setDeviceScanningInterval
Description copied from interface:DataSourceSet the pause in seconds between scanning for new devices- Specified by:
setDeviceScanningIntervalin interfaceDataSource
-
getDevice
Description copied from interface:DataSourceReturns a device with a specific ID- Specified by:
getDevicein interfaceDataSource
-
save
Description copied from interface:DataSourceSave a device- Specified by:
savein interfaceDataSource
-
updateLastSeen
Description copied from interface:DataSourceUpdate only the last seen timestamp of a device- Specified by:
updateLastSeenin interfaceDataSource
-
setIpAddressesFixed
public void setIpAddressesFixed(boolean fixed) - Specified by:
setIpAddressesFixedin interfaceDataSource
-
isIpFixedByDefault
public boolean isIpFixedByDefault()- Specified by:
isIpFixedByDefaultin interfaceDataSource
-
isExpertMode
public boolean isExpertMode()- Specified by:
isExpertModein interfaceDataSource
-
setIsExpertMode
public void setIsExpertMode(boolean expert) - Specified by:
setIsExpertModein interfaceDataSource
-
setIpFixedByDefault
public void setIpFixedByDefault(boolean ipFixedByDefault) - Specified by:
setIpFixedByDefaultin interfaceDataSource
-
getUserIds
Description copied from interface:DataSourceReturns all user IDs- Specified by:
getUserIdsin interfaceDataSource- Returns:
-
save
Deprecated.Description copied from interface:DataSourceSave a user- Specified by:
savein interfaceDataSource
-
addUser
Deprecated.Description copied from interface:DataSourceAdd a new user- Specified by:
addUserin interfaceDataSource- Returns:
-
delete
Deprecated.Description copied from interface:DataSourceDeletes a user- Specified by:
deletein interfaceDataSource
-
delete
Description copied from interface:DataSourceDelete a device- Specified by:
deletein interfaceDataSource
-
getVersion
Description copied from interface:DataSourceReturns the current schema version. This method should only used by migrations.- Specified by:
getVersionin interfaceDataSource- Returns:
-
setVersion
Description copied from interface:DataSourceSets the current schema version. This method should only be used by migrations.- Specified by:
setVersionin interfaceDataSource
-
setCurrentNetworkState
- Specified by:
setCurrentNetworkStatein interfaceDataSource
-
getCurrentNetworkState
- Specified by:
getCurrentNetworkStatein interfaceDataSource- Returns:
-
setDhcpRange
Description copied from interface:DataSourceSets the range of IP addresses the DHCP server should give to clients- Specified by:
setDhcpRangein interfaceDataSource
-
getDhcpRange
Description copied from interface:DataSourceReturns the range of IP addresses the DHCP server should give to clients- Specified by:
getDhcpRangein interfaceDataSource- Returns:
-
clearDhcpRange
public void clearDhcpRange()Description copied from interface:DataSourceRemoves the DHCP range.- Specified by:
clearDhcpRangein interfaceDataSource
-
createSnapshot
public void createSnapshot()Description copied from interface:DataSourcePersist a snapshot of the database to disk. Call this method after important data has been written.- Specified by:
createSnapshotin interfaceDataSource
-
saveSynchronously
public void saveSynchronously()- Specified by:
saveSynchronouslyin interfaceDataSource
-
saveLastUpdateTime
public void saveLastUpdateTime(java.time.LocalDateTime lastUpdate) Description copied from interface:DataSourceSave the last time an update was executed (either automatic or manually)- Specified by:
saveLastUpdateTimein interfaceDataSource
-
getLastUpdateTime
public java.time.LocalDateTime getLastUpdateTime()Description copied from interface:DataSourceGet the last time an update was performed- Specified by:
getLastUpdateTimein interfaceDataSource- Returns:
-
getAutomaticUpdateConfig
Description copied from interface:DataSourceReturn the configuration for automatic updates- Specified by:
getAutomaticUpdateConfigin interfaceDataSource- Returns:
-
save
Description copied from interface:DataSourceSave the new time frame for automatic updates- Specified by:
savein interfaceDataSource
-
setAutomaticUpdatesActivated
public void setAutomaticUpdatesActivated(boolean activated) Description copied from interface:DataSourceSave the state of the AutomaticUpdater- Specified by:
setAutomaticUpdatesActivatedin interfaceDataSource
-
getAutomaticUpdatesActivated
Description copied from interface:DataSourceGet the state of the AutomaticUpdater (active or not)- Specified by:
getAutomaticUpdatesActivatedin interfaceDataSource- Returns:
- String "true" or "false" if this information exists, null otherwise
-
getSSLEnabledState
public boolean getSSLEnabledState()- Specified by:
getSSLEnabledStatein interfaceDataSource
-
setSSLEnabledState
public void setSSLEnabledState(boolean enabled) - Specified by:
setSSLEnabledStatein interfaceDataSource
-
setOpenVpnServerState
public void setOpenVpnServerState(boolean state) - Specified by:
setOpenVpnServerStatein interfaceDataSource
-
setOpenVpnServerHost
- Specified by:
setOpenVpnServerHostin interfaceDataSource
-
getOpenVpnServerHost
- Specified by:
getOpenVpnServerHostin interfaceDataSource
-
getOpenVpnMappedPort
- Specified by:
getOpenVpnMappedPortin interfaceDataSource
-
setOpenVpnMappedPort
- Specified by:
setOpenVpnMappedPortin interfaceDataSource
-
getOpenVpnPortForwardingMode
- Specified by:
getOpenVpnPortForwardingModein interfaceDataSource
-
setOpenVpnPortForwardingMode
- Specified by:
setOpenVpnPortForwardingModein interfaceDataSource
-
getOpenVpnExternalAddressType
- Specified by:
getOpenVpnExternalAddressTypein interfaceDataSource
-
setOpenVpnExternalAddressType
- Specified by:
setOpenVpnExternalAddressTypein interfaceDataSource
-
getOpenVpnServerState
public boolean getOpenVpnServerState()- Specified by:
getOpenVpnServerStatein interfaceDataSource
-
setOpenVpnServerFirstRun
public void setOpenVpnServerFirstRun(boolean state) - Specified by:
setOpenVpnServerFirstRunin interfaceDataSource
-
getOpenVpnServerFirstRun
public boolean getOpenVpnServerFirstRun()- Specified by:
getOpenVpnServerFirstRunin interfaceDataSource
-
saveCurrentTorExitNodes
Description copied from interface:DataSourceSave the current set of exit nodes in allowed countries for Tor instance- Specified by:
saveCurrentTorExitNodesin interfaceDataSource
-
getCurrentTorExitNodes
Description copied from interface:DataSourceGet the current set of country names, which were chosen as allowed tor exit node countries- Specified by:
getCurrentTorExitNodesin interfaceDataSource- Returns:
-
setWebRTCBlockingState
public void setWebRTCBlockingState(boolean enabled) Description copied from interface:DataSourceEnable or disable the WebRTCBlockerProcessor, to block WebRTC connection establishments because it might leak the IP (even though the client is routed through TOR)- Specified by:
setWebRTCBlockingStatein interfaceDataSource
-
getWebRTCBlockingState
public boolean getWebRTCBlockingState()Description copied from interface:DataSourceGet the current state of the blocking of WebRTC- Specified by:
getWebRTCBlockingStatein interfaceDataSource- Returns:
-
setHTTPRefererRemovingState
public void setHTTPRefererRemovingState(boolean enabled) Description copied from interface:DataSourceEnable or disable the deletion of the HTTP Referer header from the requests- Specified by:
setHTTPRefererRemovingStatein interfaceDataSource
-
getHTTPRefererRemovingState
public boolean getHTTPRefererRemovingState()- Specified by:
getHTTPRefererRemovingStatein interfaceDataSource
-
setGoogleCaptivePortalRedirectorState
public void setGoogleCaptivePortalRedirectorState(boolean enabled) Description copied from interface:DataSourceEnable or disable the direct responding (by the eBlocker) to the "Google Captive Portal check"- Specified by:
setGoogleCaptivePortalRedirectorStatein interfaceDataSource
-
getGoogleCaptivePortalRedirectorState
public boolean getGoogleCaptivePortalRedirectorState()Returns true if eBlocker should respond to Google captive portal check requests.If the option is not set in Redis, true is returned.
- Specified by:
getGoogleCaptivePortalRedirectorStatein interfaceDataSource
-
setDntHeaderState
public void setDntHeaderState(boolean enabled) Description copied from interface:DataSourceEnable or disable setting the DNT (Do not track) Header- Specified by:
setDntHeaderStatein interfaceDataSource
-
getDntHeaderState
public boolean getDntHeaderState()Returns true the the eBlocker should add the DNT HeaderIf the option is not set in Redis, false is returned.
- Specified by:
getDntHeaderStatein interfaceDataSource
-
setDoNotShowReminder
public void setDoNotShowReminder(boolean show) Description copied from interface:DataSourceEnable or disable displaying the license expiration reminder to the user- Specified by:
setDoNotShowReminderin interfaceDataSource
-
isDoNotShowReminder
public boolean isDoNotShowReminder()Returns true if the eBlocker should not display the license expiration reminder to the userIf the option is not set in Redis, false is returned.
- Specified by:
isDoNotShowReminderin interfaceDataSource
-
setShowSplashScreen
public void setShowSplashScreen(boolean show) Description copied from interface:DataSourceEnable or disable displaying of the splash screen for eBlocker 2- Specified by:
setShowSplashScreenin interfaceDataSource
-
isShowSplashScreen
public boolean isShowSplashScreen()- Specified by:
isShowSplashScreenin interfaceDataSource
-
setAutoEnableNewDevices
public void setAutoEnableNewDevices(boolean autoEnableNewDevices) - Specified by:
setAutoEnableNewDevicesin interfaceDataSource
-
isAutoEnableNewDevices
public boolean isAutoEnableNewDevices()- Specified by:
isAutoEnableNewDevicesin interfaceDataSource
-
getCompressionMode
- Specified by:
getCompressionModein interfaceDataSource
-
setCompressionMode
- Specified by:
setCompressionModein interfaceDataSource
-
getSslRecordErrors
public boolean getSslRecordErrors()- Specified by:
getSslRecordErrorsin interfaceDataSource
-
setSslRecordErrors
public void setSslRecordErrors(boolean recordSslErrors) - Specified by:
setSslRecordErrorsin interfaceDataSource
-
getCurrentLanguage
Description copied from interface:DataSourceGet the currently used language in the frontend- Specified by:
getCurrentLanguagein interfaceDataSource- Returns:
-
setCurrentLanguage
Description copied from interface:DataSourceSet the current language for the frontend- Specified by:
setCurrentLanguagein interfaceDataSource
-
setTimezone
Description copied from interface:DataSourceSave the POSIX timezone String for the default timezone to use- Specified by:
setTimezonein interfaceDataSource
-
getTimezone
Description copied from interface:DataSourceGet the POSIX timezone string- Specified by:
getTimezonein interfaceDataSource- Returns:
-
getAppModuleState
Description copied from interface:DataSourceGet the 'enabled' status of the AppWhitelistModule with a certain ID- Specified by:
getAppModuleStatein interfaceDataSource- 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
public void setAppWhitelistModuleStatus(int moduleID, boolean enabled) Description copied from interface:DataSourceSet an 'enabled' status for a certain AppWhitelistModule- Specified by:
setAppWhitelistModuleStatusin interfaceDataSource
-
getRedirectDecision
- Specified by:
getRedirectDecisionin interfaceDataSource
-
setRedirectDecision
- Specified by:
setRedirectDecisionin interfaceDataSource
-
setPasswordHash
public void setPasswordHash(byte[] passwordHash) - Specified by:
setPasswordHashin interfaceDataSource
-
getPasswordHash
public byte[] getPasswordHash()- Specified by:
getPasswordHashin interfaceDataSource
-
deletePasswordHash
public void deletePasswordHash()- Specified by:
deletePasswordHashin interfaceDataSource
-
getListsPackageVersion
- Specified by:
getListsPackageVersionin interfaceDataSource
-
getCleanShutdownFlag
public boolean getCleanShutdownFlag()Description copied from interface:DataSourceReturns the flag that indicates that the last shutdown was clean.- Specified by:
getCleanShutdownFlagin interfaceDataSource- Returns:
- true if the shutdown was clean (or if it has never been set yet)
-
setCleanShutdownFlag
public void setCleanShutdownFlag(boolean cleanShutdown) Description copied from interface:DataSourceSets 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.- Specified by:
setCleanShutdownFlagin interfaceDataSource
-
getResolvedDnsGateway
- Specified by:
getResolvedDnsGatewayin interfaceDataSource
-
setResolvedDnsGateway
- Specified by:
setResolvedDnsGatewayin interfaceDataSource
-
getDhcpLeaseTime
- Specified by:
getDhcpLeaseTimein interfaceDataSource
-
setDhcpLeaseTime
- Specified by:
setDhcpLeaseTimein interfaceDataSource
-
isMalwareUrlFilterEnabled
public boolean isMalwareUrlFilterEnabled()- Specified by:
isMalwareUrlFilterEnabledin interfaceDataSource
-
setMalwareUrlFilterEnabled
public void setMalwareUrlFilterEnabled(boolean enabled) - Specified by:
setMalwareUrlFilterEnabledin interfaceDataSource
-
isContentFilterEnabled
public boolean isContentFilterEnabled()- Specified by:
isContentFilterEnabledin interfaceDataSource
-
setContentFilterEnabled
public void setContentFilterEnabled(boolean enabled) - Specified by:
setContentFilterEnabledin interfaceDataSource
-
areRouterAdvertisementsEnabled
public boolean areRouterAdvertisementsEnabled()- Specified by:
areRouterAdvertisementsEnabledin interfaceDataSource
-
setRouterAdvertisementsEnabled
public void setRouterAdvertisementsEnabled(boolean enabled) - Specified by:
setRouterAdvertisementsEnabledin interfaceDataSource
-
arePrivacyExtensionsEnabled
public boolean arePrivacyExtensionsEnabled()- Specified by:
arePrivacyExtensionsEnabledin interfaceDataSource
-
setPrivacyExtensionsEnabled
public void setPrivacyExtensionsEnabled(boolean enabled) - Specified by:
setPrivacyExtensionsEnabledin interfaceDataSource
-