Skip to content

🧹 Remove statistics strategy #2994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
534 changes: 0 additions & 534 deletions shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs

This file was deleted.

43 changes: 1 addition & 42 deletions shadowsocks-csharp/Controller/ShadowsocksController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ public class ShadowsocksController
private PrivoxyRunner privoxyRunner;
private readonly ConcurrentDictionary<Server, Sip003Plugin> _pluginsByServer;

public AvailabilityStatistics availabilityStatistics = AvailabilityStatistics.Instance;
public StatisticsStrategyConfiguration StatisticsConfiguration { get; private set; }

private long _inboundCounter = 0;
private long _outboundCounter = 0;
public long InboundCounter => Interlocked.Read(ref _inboundCounter);
Expand Down Expand Up @@ -98,7 +95,6 @@ public ShadowsocksController()
httpClient = new HttpClient();
_config = Configuration.Load();
Configuration.Process(ref _config);
StatisticsConfiguration = StatisticsStrategyConfiguration.Load();
_strategyManager = new StrategyManager(this);
_pluginsByServer = new ConcurrentDictionary<Server, Sip003Plugin>();
StartTrafficStatistics(61);
Expand Down Expand Up @@ -188,8 +184,6 @@ protected void Reload()
httpClient.DefaultRequestHeaders.Add("User-Agent", _config.userAgentString);
}

StatisticsConfiguration = StatisticsStrategyConfiguration.Load();

privoxyRunner = privoxyRunner ?? new PrivoxyRunner();

_pacDaemon = _pacDaemon ?? new PACDaemon(_config);
Expand All @@ -202,7 +196,6 @@ protected void Reload()
GeositeUpdater.UpdateCompleted += PacServer_PACUpdateCompleted;
GeositeUpdater.Error += PacServer_PACUpdateError;

availabilityStatistics.UpdateConfiguration(this);
_listener?.Stop();
StopPlugins();

Expand All @@ -220,7 +213,6 @@ protected void Reload()
privoxyRunner.Start(_config);

TCPRelay tcpRelay = new TCPRelay(this, _config);
tcpRelay.OnConnected += UpdateLatency;
tcpRelay.OnInbound += UpdateInboundCounter;
tcpRelay.OnOutbound += UpdateOutboundCounter;
tcpRelay.OnFailed += (o, e) => GetCurrentStrategy()?.SetFailure(e.server);
Expand Down Expand Up @@ -524,7 +516,7 @@ public void SaveHotkeyConfig(HotkeyConfig newConfig)

#endregion

#region Statistics
#region Strategy

public void SelectStrategy(string strategyID)
{
Expand All @@ -533,12 +525,6 @@ public void SelectStrategy(string strategyID)
SaveConfig(_config);
}

public void SaveStrategyConfigurations(StatisticsStrategyConfiguration configuration)
{
StatisticsConfiguration = configuration;
StatisticsStrategyConfiguration.Save(configuration);
}

public IList<IStrategy> GetStrategies()
{
return _strategyManager.GetStrategies();
Expand All @@ -556,43 +542,16 @@ public IStrategy GetCurrentStrategy()
return null;
}

public void UpdateStatisticsConfiguration(bool enabled)
{
if (availabilityStatistics != null)
{
availabilityStatistics.UpdateConfiguration(this);
_config.availabilityStatistics = enabled;
SaveConfig(_config);
}
}

public void UpdateLatency(object sender, SSTCPConnectedEventArgs args)
{
GetCurrentStrategy()?.UpdateLatency(args.server, args.latency);
if (_config.availabilityStatistics)
{
availabilityStatistics.UpdateLatency(args.server, (int)args.latency.TotalMilliseconds);
}
}

public void UpdateInboundCounter(object sender, SSTransmitEventArgs args)
{
GetCurrentStrategy()?.UpdateLastRead(args.server);
Interlocked.Add(ref _inboundCounter, args.length);
if (_config.availabilityStatistics)
{
availabilityStatistics.UpdateInboundCounter(args.server, args.length);
}
}

public void UpdateOutboundCounter(object sender, SSTransmitEventArgs args)
{
GetCurrentStrategy()?.UpdateLastWrite(args.server);
Interlocked.Add(ref _outboundCounter, args.length);
if (_config.availabilityStatistics)
{
availabilityStatistics.UpdateOutboundCounter(args.server, args.length);
}
}

#endregion
Expand Down
170 changes: 0 additions & 170 deletions shadowsocks-csharp/Controller/Strategy/StatisticsStrategy.cs

This file was deleted.

1 change: 0 additions & 1 deletion shadowsocks-csharp/Controller/Strategy/StrategyManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public StrategyManager(ShadowsocksController controller)
_strategies = new List<IStrategy>();
_strategies.Add(new BalancingStrategy(controller));
_strategies.Add(new HighAvailabilityStrategy(controller));
_strategies.Add(new StatisticsStrategy(controller));
// TODO: load DLL plugins
}
public IList<IStrategy> GetStrategies()
Expand Down
32 changes: 0 additions & 32 deletions shadowsocks-csharp/Data/i18n.csv
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ PAC,Сценарий настройки (PAC),PAC 模式,PAC 模式,PACモード
Global,Для всей системы,全局模式,全局模式,グローバルプロキシ,전역,Global
Servers,Серверы,服务器,伺服器,サーバー,서버,Serveurs
Edit Servers...,Редактировать серверы…,编辑服务器...,編輯伺服器...,サーバーの編集...,서버 수정…,Éditer serveurs…
Statistics Config...,Настройки статистики…,统计配置...,統計設定檔...,統計情報の設定...,통계 설정,Configuration des statistiques…
Online Config...,,在线配置...,線上配置...,,,
Start on Boot,Автозагрузка,开机启动,開機啟動,システム起動時に実行,시스템 시작 시에 시작하기,Démarrage automatique
Associate ss:// Links,Ассоциированный ss:// Ссылки,关联 ss:// 链接,關聯 ss:// 鏈接,ss:// リンクの関連付け,ss:// 링크 연결,
Expand Down Expand Up @@ -47,7 +46,6 @@ Quit,Выход,退出,結束,終了,종료,Quitter
Edit Servers,Редактирование серверов,编辑服务器,編輯伺服器,サーバーの編集,서버 수정,Éditer serveurs
Load Balance,Балансировка нагрузки,负载均衡,負載平衡,サーバーロードバランス,로드밸런싱,Répartition de charge
High Availability,Высокая доступность,高可用,高可用性,高可用性,고가용성,Haute disponibilité
Choose by statistics,На основе статистики,根据统计,根據統計,統計で選ぶ,통계 기반,Choisissez par statistiques
Show Plugin Output,События плагинов в журнале,显示插件输出,,プラグインの出力情報を表示,플러그인 출력 보이기,Afficher la sortie du plugin
Write translation template,Создать шаблон для перевода,写入翻译模板,,翻訳テンプレートファイルを書き込む,번역 템플릿 쓰기,Écrire un modèle de traduction
,,,,,,
Expand Down Expand Up @@ -81,36 +79,6 @@ Move D&own,Ниже,下移(&O),下移 (&O),下に移動 (&O),아래로 (&O),Desc
deprecated,Устаревшее,不推荐,不推薦,非推奨,더 이상 사용되지 않음,Obsolète
"Encryption method {0} not exist, will replace with {1}",,加密方法{0}不存在,将使用{1}代替,,暗号化方式{0}が存在しません,{1}に置換します,{0} 암호화 방식이 존재하지 않으므로 {1}로 대체될 것입니다.,"Méthode de chiffrement {0} n'existe pas, sera remplacée par {1}"
,,,,,,
#Statistics Config,,,,,,
,,,,,,
Enable Statistics,Включить сбор статистики,启用统计,,統計を有効にする,통계 활성화,Activer statistiques
Ping Test,Проверка связи (Ping),Ping测试,,Ping測定,Ping 테스트,Test ping
packages everytime,пакета на проверку,个包/次,,パケット/回,시간 당 패킷,Packages à chaque fois
By hour of day,Ежечасно,按照每天的小时数统计,,毎日の時間数で統計,매 시간,Par heure du jour
Collect data per,Собирать данные за,收集数据每,,ごとにデータを収集,데이터 수집 기간,Recueillir des données par
Keep choice for,Хранить отбор данных за,保持选择每,,,설정 유지하기,Gardez le choix pour
minutes,мин.,分钟,,分,분,Minutes
Final Score:,Финальная оценка:,总分:,,,최종 점수:,Score final:
AverageLatency,СредЗадержка,平均延迟,,平均遅延時間,평균 지연시간,LatenceMoyenne
MinLatency,МинЗадержка,最小延迟,,最小遅延時間,최소 지연시간,MinLatence
MaxLatency,МаксЗадержка,最大延迟,,最大遅延時間,최대 지연시간,MaxLatence
AverageInboundSpeed,СредВходСкорость,平均入站速度,,平均インバウンド速度,평균 인바운드 속도,VitesseEntranteMoyenne
MinInboundSpeed,МинВходСкорость,最小入站速度,,最小インバウンド速度,최소 인바운드 속도,MinVitesseEntrante
MaxInboundSpeed,СредВходСкорость,最大入站速度,,最大インバウンド速度,최대 인바운드 속도,MaxVitesseEntrante
AverageOutboundSpeed,СредИсхСкорость,平均出站速度,,平均アウトバウンド速度,평균 아웃바운드 속도,VitesseSortanteMoyenne
MinOutboundSpeed,МинИсхСкорость,最小出站速度,,最小アウトバウンド速度,최소 아웃바운드 속도,MinVitesseSortante
MaxOutboundSpeed,МаксИсхСкорость,最大出站速度,,最大アウトバウンド速度,최대 아웃바운드 속도,MaxVitesseSortante
AverageResponse,СредВремяОтвета,平均响应速度,,平均レスポンス速度,평균 응답,RéponseMoyenne
MinResponse,МинВремяОтвета,最小响应速度,,最小レスポンス速度,최소 응답,MinRéponse
MaxResponse,МаксВремяОтвета,最大响应速度,,最大レスポンス速度,최대 응답,MaxRéponse
PackageLoss,ПотериПакетов,丢包率,,パケットロス率,패킷 손실,Perte de paquets
Speed,Скорость,速度,,速度,속도,Vitesse
Package Loss,Потери пакетов,丢包率,,パケットロス率,패킷 손실,Perte de paquets
Ping,Ping,网络延迟,,Ping,Ping,Ping
Chart Mode,График,图表模式,,図表モード,차트 모드,Mode graphique
24h,24ч,24小时,,24時間,24시간,24h
all,За все время,全部,,すべて,전체,tout
,,,,,,
# Log Form,,,,,,
,,,,,,
&File,Файл,文件(&F),檔案 (&F),ファイル (&F),파일 (&F),Fichier
Expand Down
2 changes: 0 additions & 2 deletions shadowsocks-csharp/Model/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class Configuration
public bool useOnlinePac;
public bool secureLocalPac; // enable secret for PAC server
public bool regeneratePacOnUpdate; // regenerate pac.txt on version update
public bool availabilityStatistics;
public bool autoCheckUpdate;
public bool checkPreRelease;
public string skippedUpdateVersion; // skip the update with this version number
Expand Down Expand Up @@ -76,7 +75,6 @@ public Configuration()
useOnlinePac = false;
secureLocalPac = true;
regeneratePacOnUpdate = true;
availabilityStatistics = false;
autoCheckUpdate = false;
checkPreRelease = false;
skippedUpdateVersion = "";
Expand Down
Loading