Skip to content

Commit 4d8be3e

Browse files
authored
Merge pull request #10 from oviron/byedpi-data-driven-strategies
feat(byedpi): data-driven strategies, drop ByeDpiPreset enum
2 parents 73156c6 + 6b2bea2 commit 4d8be3e

18 files changed

Lines changed: 315 additions & 357 deletions

CHANGELOG.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,49 @@
1+
## v0.13.8
2+
3+
- Data-driven ByeDPI strategies: the `ByeDpiPreset` enum is gone; strategies live solely in `assets/data/byedpi-strategies.json`, loaded at runtime. Updating/adding one is a pure JSON edit (no Dart/codegen/l10n)
4+
5+
- Strategy set is taken verbatim from upstream romanvht/ByeByeDPI `proxytest_strategies.list` (2026-05): `universal` is the maintainer's own default, the rest are the top usable entries (excluding `{sni}`/raw-blob lines we can't run) with neutral labels. No invented per-operator labeling
6+
7+
- On-disk override (no force-install) seams in a future remote refresh of the strategy set without a release
8+
9+
## v0.13.7
10+
11+
- Maintenance release: version bump, no functional changes since v0.13.6
12+
13+
## v0.13.6
14+
15+
- Bump libmihomo-android 0.1.1 -> 0.1.2
16+
17+
## v0.13.5
18+
19+
- Fix: proxies tab FAB pings the visible group instead of the persisted one
20+
21+
## v0.13.4
22+
23+
- Drop China-specific leftovers from default config; add Android connectivity probe coverage; enable sniffer by default
24+
25+
- Omit null override-destination in defaults
26+
27+
## v0.13.3
28+
29+
- Restore v0.12.0 DNS defaults; simplify IPv6 to a 2-state toggle
30+
31+
- Remove the fallback-filter setting; move Reset to an AppBar icon
32+
33+
- l10n cleanup (drop orphaned keys from the removed fallback-filter)
34+
35+
## v0.13.2
36+
37+
- Deep information-architecture restructure of settings, research-driven (settings audit PR1-PR5.9)
38+
39+
- Flatten single-tile tool sections; move Diagnostics to the bottom
40+
41+
- Strip desktop/dead code paths (ViewMode, NavigationItemMode, isMobile branches)
42+
43+
- dart_code_linter sweep + CI gate; skip APK build on pull requests
44+
45+
- Add 7 missing l10n entries
46+
147
## v0.12.0
248

349
- Audit sweep: 59 findings + 4 carry-overs

assets/data/byedpi-strategies.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[
2+
{
3+
"id": "universal",
4+
"label": "Universal (default)",
5+
"args": "-o1 -a1 -r-5+se"
6+
},
7+
{
8+
"id": "strategy-01",
9+
"label": "Strategy 1",
10+
"args": "-f-200 -Qr -s3:5+sm -a1 -As -d1 -s4+sm -s8+sh -f-300 -d6+sh -a1 -At,r,s -o2 -f-30 -As -r5 -Mh -r6+sh -f-250 -s2:7+s -s3:6+sm -a1 -At,r,s -s3:5+sm -s6+s -s7:9+s -q30+sm -a1"
11+
},
12+
{
13+
"id": "strategy-02",
14+
"label": "Strategy 2",
15+
"args": "-d1 -d3+s -s6+s -d9+s -s12+s -d15+s -s20+s -d25+s -s30+s -d35+s -r1+s -S -a1 -As -d1 -d3+s -s6+s -d9+s -s12+s -d15+s -s20+s -d25+s -s30+s -d35+s -S -a1"
16+
},
17+
{
18+
"id": "strategy-03",
19+
"label": "Strategy 3",
20+
"args": "-q2 -s2 -s3+s -r3 -s4 -r4 -s5+s -r5+s -s6 -s7+s -r8 -s9+s -Qr -Mh,d,r -a1 -At,r -s2+s -r2 -d2 -s3 -r3 -r4 -s4 -d5+s -r5 -d6 -s7+s -d7 -a1"
21+
},
22+
{
23+
"id": "strategy-04",
24+
"label": "Strategy 4",
25+
"args": "-o1 -d1 -a1 -At,r,s -s1 -d1 -s5+s -s10+s -s15+s -s20+s -r1+s -S -a1 -As -s1 -d1 -s5+s -s10+s -s15+s -s20+s -S -a1"
26+
},
27+
{
28+
"id": "strategy-05",
29+
"label": "Strategy 5",
30+
"args": "-d1+s -s50+s -a1 -As -f20 -r2+s -a1 -At -d2 -s1+s -s5+s -s10+s -s15+s -s25+s -s35+s -s50+s -s60+s -a1"
31+
},
32+
{
33+
"id": "strategy-06",
34+
"label": "Strategy 6",
35+
"args": "-d1 -s1 -q1 -Y -a1 -Ar -s5 -o1+s -d3+s -s6+s -d9+s -s12+s -d15+s -s20+s -d25+s -s30+s -d35+s -a1"
36+
},
37+
{
38+
"id": "strategy-07",
39+
"label": "Strategy 7",
40+
"args": "-s1 -o1 -a1 -Y -Ar -s5 -o1+s -a1 -At -f-1 -r1+s -a1 -As -s1 -o1+s -s-1 -a1"
41+
},
42+
{
43+
"id": "strategy-08",
44+
"label": "Strategy 8",
45+
"args": "-s1 -d1 -a1 -Y -Ar -d5 -o1+s -a1 -At -f-1 -r1+s -a1 -As -d1 -o1+s -s-1 -a1"
46+
},
47+
{
48+
"id": "strategy-09",
49+
"label": "Strategy 9",
50+
"args": "-d1 -s1+s -d3+s -s6+s -d9+s -s12+s -d15+s -s20+s -d25+s -s30+s -d35+s -a1"
51+
},
52+
{
53+
"id": "strategy-10",
54+
"label": "Strategy 10",
55+
"args": "-s1 -q1 -a1 -Y -Ar -a1 -s5 -o2 -At -f-1 -r1+s -a1 -As -s1 -o1+s -s-1 -a1"
56+
},
57+
{
58+
"id": "strategy-11",
59+
"label": "Strategy 11",
60+
"args": "-s1 -q1 -a1 -Ar -s5 -o1+s -a1 -At -f-1 -d1+s -a1 -As -s1 -o1+s -s-1 -a1"
61+
}
62+
]

lib/byedpi/generated/model.freezed.dart

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/byedpi/generated/model.g.dart

Lines changed: 13 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/byedpi/model.dart

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,40 @@
1-
import 'package:fl_clash/common/app_localizations.dart';
21
import 'package:freezed_annotation/freezed_annotation.dart';
32

43
part 'generated/model.freezed.dart';
54
part 'generated/model.g.dart';
65

76
enum ByeDpiMode { manual, auto }
87

9-
enum ByeDpiPreset {
10-
universal('--disorder 1 --auto=t,r,s --tlsrec 1+s'),
11-
mrDrone(
12-
'-Ku -a3 -An -Kt,h -s0 -o1 -d1 -r1+s -Ar -o1 -At -f-1 -r1+s -As -b+500',
13-
),
14-
mtsAggressive(
15-
'-Ku -a1 -An -Kt -V443 -H:googlevideo.com -n www.google.com -o1 -An -d0+sm -At -r1+s',
16-
),
17-
megafon2ni(
18-
'-Ku -a5 -An -Kt -V443 -H:googlevideo.com -n www.google.com -o1 -An -f-1 -T0.5 -Ars -d0+sm -At -r1+s',
19-
),
20-
tele2('--disorder 1 --auto=t,r,s --fake 2'),
21-
beelineRt(
22-
'-o1 -d1 -a1 -At,r,s -s1 -d1 -s5+s -s10+s -s15+s -s20+s -r1+s -S -a1',
23-
),
24-
antiGgc('--split 3 --oob 1 --disorder 3 --auto=t,r,s'),
25-
cascade(
26-
'-d1 -d3+s -s6+s -d9+s -s12+s -d15+s -s20+s -d25+s -s30+s -d35+s -r1+s -S -a1',
27-
),
28-
tlsOnly('-Kt -r1+s -s1+s -d3+s -a1'),
29-
ttlFixed(
30-
'-g25 -H:"googlevideo.com youtube.com discord.com" -f-1 -n www.google.com -t4 -r1+s -An -d1 -s25+s -d30+s',
31-
),
32-
custom('');
33-
34-
const ByeDpiPreset(this.args);
8+
// `custom` is not a JSON strategy: it surfaces the user's own cliArgs.
9+
const kByeDpiCustomId = 'custom';
10+
const kByeDpiDefaultId = 'universal';
11+
const kByeDpiDefaultArgs = '-o1 -a1 -r-5+se';
3512

13+
class ByeDpiStrategy {
14+
final String id;
15+
final String label;
3616
final String args;
3717

38-
String get label => switch (this) {
39-
ByeDpiPreset.universal => appLocalizations.byedpiPresetUniversal,
40-
ByeDpiPreset.mrDrone => appLocalizations.byedpiPresetMrDrone,
41-
ByeDpiPreset.mtsAggressive => appLocalizations.byedpiPresetMtsAggressive,
42-
ByeDpiPreset.megafon2ni => appLocalizations.byedpiPresetMegafon2ni,
43-
ByeDpiPreset.tele2 => appLocalizations.byedpiPresetTele2,
44-
ByeDpiPreset.beelineRt => appLocalizations.byedpiPresetBeelineRt,
45-
ByeDpiPreset.antiGgc => appLocalizations.byedpiPresetAntiGgc,
46-
ByeDpiPreset.cascade => appLocalizations.byedpiPresetCascade,
47-
ByeDpiPreset.tlsOnly => appLocalizations.byedpiPresetTlsOnly,
48-
ByeDpiPreset.ttlFixed => appLocalizations.byedpiPresetTtlFixed,
49-
ByeDpiPreset.custom => appLocalizations.byedpiPresetCustom,
50-
};
18+
const ByeDpiStrategy({
19+
required this.id,
20+
required this.label,
21+
required this.args,
22+
});
23+
24+
factory ByeDpiStrategy.fromJson(Map<String, dynamic> json) => ByeDpiStrategy(
25+
id: json['id'] as String,
26+
label: (json['label'] ?? json['id']) as String,
27+
args: json['args'] as String? ?? '',
28+
);
5129
}
5230

53-
String effectiveByeDpiCliArgs(ByeDpiSettings s) =>
54-
s.preset == ByeDpiPreset.custom ? s.cliArgs : s.preset.args;
31+
// Args resolve from the loaded strategy set (byedpi-strategies.json); `custom`
32+
// uses the user's cliArgs. Falls back to the default args if the id is absent
33+
// (e.g. asset failed to load).
34+
String effectiveByeDpiCliArgs(ByeDpiSettings s, Map<String, String> argsById) =>
35+
s.preset == kByeDpiCustomId
36+
? s.cliArgs
37+
: (argsById[s.preset] ?? kByeDpiDefaultArgs);
5538

5639
@freezed
5740
abstract class ByeDpiSettings with _$ByeDpiSettings {
@@ -61,8 +44,8 @@ abstract class ByeDpiSettings with _$ByeDpiSettings {
6144
@Default(true) bool fallbackEnabled,
6245
@Default('') String fallbackGroup,
6346
@Default(1080) int port,
64-
@Default(ByeDpiPreset.universal) ByeDpiPreset preset,
65-
@Default('--disorder 1 --auto=t,r,s --tlsrec 1+s') String cliArgs,
47+
@Default(kByeDpiDefaultId) String preset,
48+
@Default(kByeDpiDefaultArgs) String cliArgs,
6649
}) = _ByeDpiSettings;
6750

6851
factory ByeDpiSettings.fromJson(Map<String, Object?> json) =>

lib/byedpi/settings_store.dart

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,13 @@ class ByeDpiSettingsStore {
2929
_legacyCliArgs.contains(storedCli);
3030

3131
final preset = legacy
32-
? ByeDpiPreset.universal
33-
: (storedPreset != null
34-
? ByeDpiPreset.values.firstWhere(
35-
(p) => p.name == storedPreset,
36-
orElse: () => ByeDpiPreset.universal,
37-
)
38-
: ByeDpiPreset.universal);
32+
? kByeDpiDefaultId
33+
: (storedPreset ?? kByeDpiDefaultId);
3934

40-
// When migrating away from legacy cliArgs, surface the new universal
41-
// defaults so a later switch to Custom doesn't show a stale string.
35+
// When migrating away from legacy cliArgs, surface the new default args so
36+
// a later switch to Custom doesn't show a stale string.
4237
final cliArgs = (legacy || storedCli == null)
43-
? ByeDpiPreset.universal.args
38+
? kByeDpiDefaultArgs
4439
: storedCli;
4540

4641
return ByeDpiSettings(
@@ -62,7 +57,7 @@ class ByeDpiSettingsStore {
6257
await _prefs.setBool('byedpi.fallbackEnabled', s.fallbackEnabled);
6358
await _prefs.setString('byedpi.fallbackGroup', s.fallbackGroup);
6459
await _prefs.setInt('byedpi.port', s.port);
65-
await _prefs.setString('byedpi.preset', s.preset.name);
60+
await _prefs.setString('byedpi.preset', s.preset);
6661
await _prefs.setString('byedpi.cliArgs', s.cliArgs);
6762
}
6863
}

0 commit comments

Comments
 (0)