Skip to content

Commit

Permalink
8.15
Browse files Browse the repository at this point in the history
2 new settings for SmartProxy

- Selection order (default random)
- Reset slot proxy (default true)
  • Loading branch information
tonikelope committed Nov 23, 2023
1 parent 3c39435 commit 3c327bc
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 130 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.tonikelope</groupId>
<artifactId>MegaBasterd</artifactId>
<version>8.14</version>
<version>8.15</version>
<packaging>jar</packaging>
<repositories>
<repository>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ public void run() {
setExit(true);
}

} else {
} else if (proxy_manager != null && proxy_manager.isReset_slot_proxy()) {
_current_smart_proxy = null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/tonikelope/megabasterd/MainPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
*/
public final class MainPanel {

public static final String VERSION = "8.14";
public static final String VERSION = "8.15";
public static final boolean FORCE_SMART_PROXY = false; //TRUE FOR DEBUGING SMART PROXY
public static final int THROTTLE_SLICE_SIZE = 16 * 1024;
public static final int DEFAULT_BYTE_BUFFER_SIZE = 16 * 1024;
Expand Down
213 changes: 146 additions & 67 deletions src/main/java/com/tonikelope/megabasterd/SettingsDialog.form

Large diffs are not rendered by default.

217 changes: 159 additions & 58 deletions src/main/java/com/tonikelope/megabasterd/SettingsDialog.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public final class SmartMegaProxyManager {
public static final int PROXY_BLOCK_TIME = 300;
public static final int PROXY_AUTO_REFRESH_TIME = 60;
public static final int PROXY_AUTO_REFRESH_SLEEP_TIME = 30;
public static final boolean RESET_SLOT_PROXY = true;
public static final boolean RANDOM_SELECT = true;

private static final Logger LOG = Logger.getLogger(SmartMegaProxyManager.class.getName());
private volatile String _proxy_list_url;
Expand All @@ -52,6 +54,16 @@ public final class SmartMegaProxyManager {
private volatile boolean _force_smart_proxy;
private volatile int _autorefresh_time;
private volatile long _last_refresh_timestamp;
private volatile boolean _random_select;
private volatile boolean _reset_slot_proxy;

public boolean isRandom_select() {
return _random_select;
}

public boolean isReset_slot_proxy() {
return _reset_slot_proxy;
}

public int getProxy_timeout() {
return _proxy_timeout;
Expand Down Expand Up @@ -141,7 +153,25 @@ public synchronized void refreshSmartProxySettings() {
_autorefresh_time = PROXY_AUTO_REFRESH_TIME;
}

LOG.log(Level.INFO, "SmartProxy BAN_TIME: " + String.valueOf(_ban_time) + " TIMEOUT: " + String.valueOf(_proxy_timeout / 1000) + " REFRESH: " + String.valueOf(_autorefresh_time) + " FORCE: " + String.valueOf(_force_smart_proxy));
String reset_slot_proxy = DBTools.selectSettingValue("reset_slot_proxy");

if (reset_slot_proxy != null) {

_reset_slot_proxy = reset_slot_proxy.equals("yes");
} else {
_reset_slot_proxy = RESET_SLOT_PROXY;
}

String random_select = DBTools.selectSettingValue("random_proxy");

if (random_select != null) {

_random_select = random_select.equals("yes");
} else {
_random_select = RANDOM_SELECT;
}

LOG.log(Level.INFO, "SmartProxy BAN_TIME: " + String.valueOf(_ban_time) + " TIMEOUT: " + String.valueOf(_proxy_timeout / 1000) + " REFRESH: " + String.valueOf(_autorefresh_time) + " FORCE: " + String.valueOf(_force_smart_proxy) + " RANDOM: " + String.valueOf(_random_select) + " RESET-SLOT-PROXY: " + String.valueOf(_reset_slot_proxy));
}

public synchronized int getProxyCount() {
Expand All @@ -157,7 +187,9 @@ public synchronized String[] getProxy(ArrayList<String> excluded) {

List<String> keysList = new ArrayList<>(keys);

Collections.shuffle(keysList);
if (isRandom_select()) {
Collections.shuffle(keysList);
}

Long current_time = System.currentTimeMillis();

Expand Down
Binary file modified src/main/resources/images/mbasterd_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3c327bc

Please sign in to comment.