Added BanLoopEvasionOverride to config proxy settings

This commit is contained in:
ruri
2020-03-31 03:37:26 +02:00
parent 1c6639acb5
commit 4a4bc561f5
3 changed files with 21 additions and 1 deletions
@@ -26,6 +26,10 @@
<xctk:IntegerUpDown Background="Transparent" Width="50" Margin="10 0 0 0" Value="{Binding MaxProxyUses}" Foreground="{DynamicResource ForegroundMain}" HorizontalAlignment="Right"/>
</DockPanel>
<CheckBox Content="Ban Proxy after Good Status" IsChecked="{Binding BanProxyAfterGoodStatus}" VerticalContentAlignment="Center" ToolTip="Bans a Proxy after a SUCCESS, CUSTOM or TOCHECK result."/>
<DockPanel>
<Label Content="Ban Loop Evasion (-1 = default)" />
<xctk:IntegerUpDown Background="Transparent" Width="50" Margin="10 0 0 0" Minimum="-1" Value="{Binding BanLoopEvasionOverride}" Foreground="{DynamicResource ForegroundMain}" HorizontalAlignment="Right"/>
</DockPanel>
</StackPanel>
</StackPanel>
</Grid>
+7
View File
@@ -89,6 +89,13 @@ namespace RuriLib
private bool banProxyAfterGoodStatus = false;
/// <summary>Whether to ban the proxy after a SUCCESS, CUSTOM or NONE status (not FAIL or RETRY).</summary>
public bool BanProxyAfterGoodStatus { get { return banProxyAfterGoodStatus; } set { banProxyAfterGoodStatus = value; OnPropertyChanged(); } }
private int banLoopEvasionOverride = -1;
/// <summary>
/// The maximum amount of times a data line ends up with a BAN status before it's marked as ToCheck.
/// Overrides the global setting unless set to -1.
/// </summary>
public int BanLoopEvasionOverride { get { return banLoopEvasionOverride; } set { banLoopEvasionOverride = value; OnPropertyChanged(); } }
#endregion
#region Data
+10 -1
View File
@@ -931,7 +931,7 @@ namespace RuriLib.Runner
RetryCount++;
}
if (currentData.Retries < Settings.Proxies.BanLoopEvasion || Settings.Proxies.BanLoopEvasion == 0)
if (ShouldTriggerEvasion(currentData.Retries))
{
currentData.Retries++;
goto GETPROXY;
@@ -1269,6 +1269,15 @@ namespace RuriLib.Runner
return proxies;
}
private bool ShouldTriggerEvasion(int retries)
{
var evasionValue = Config.Settings.BanLoopEvasionOverride == -1
? Settings.Proxies.BanLoopEvasion
: Config.Settings.BanLoopEvasionOverride;
return retries < evasionValue || evasionValue == 0;
}
#endregion
#region Bot Management Methods