|
|
@@ -51,6 +51,7 @@ public class StandardDeviceIdService implements DeviceIdService { |
|
|
|
// used in dnscrypt-proxy and mitmproxy to check device security level |
|
|
|
public static final String REDIS_KEY_DEVICE_SECURITY_LEVEL_PREFIX = "bubble_device_security_level_"; |
|
|
|
public static final String REDIS_KEY_DEVICE_SITE_MAX_SECURITY_LEVEL_PREFIX = "bubble_device_site_max_security_level_"; |
|
|
|
public static final String REDIS_KEY_ACCOUNT_SHOW_BLOCK_STATS = "bubble_account_showBlockStats_"; |
|
|
|
|
|
|
|
// used in dnscrypt-proxy to determine how to respond to blocked requests |
|
|
|
public static final String REDIS_KEY_DEVICE_REJECT_WITH = "bubble_device_reject_with_"; |
|
|
@@ -152,6 +153,7 @@ public class StandardDeviceIdService implements DeviceIdService { |
|
|
|
} |
|
|
|
|
|
|
|
public void initBlockStats (Account account) { |
|
|
|
redis.set_plaintext(REDIS_KEY_ACCOUNT_SHOW_BLOCK_STATS+account.getUuid(), Boolean.toString(account.showBlockStats())); |
|
|
|
for (Device device : deviceDAO.findByAccount(account.getUuid())) { |
|
|
|
if (account.showBlockStats()) { |
|
|
|
showBlockStats(device); |
|
|
@@ -161,6 +163,10 @@ public class StandardDeviceIdService implements DeviceIdService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public boolean doShowBlockStats(Account account) { |
|
|
|
return Boolean.parseBoolean(redis.get_plaintext(REDIS_KEY_ACCOUNT_SHOW_BLOCK_STATS + account.getUuid())); |
|
|
|
} |
|
|
|
|
|
|
|
public void showBlockStats (Device device) { |
|
|
|
final Set<String> configuredIps = NetworkUtil.configuredIps(); |
|
|
|
final String privateIp = configuredIps.stream() |
|
|
|