|
@@ -27,7 +27,16 @@ class AppConfig {
|
|
|
rules: List<Rule>.from(map['rules'].map((x) => Rule.fromMap(x))),
|
|
|
);
|
|
|
}
|
|
|
-
|
|
|
+ Map<String, dynamic> toJson() {
|
|
|
+ return {
|
|
|
+ 'basic': basicConfig.toJson(),
|
|
|
+ if (dnsConfig != null) 'dns': dnsConfig!.toJson(),
|
|
|
+ if (tunConfig != null) 'tun': tunConfig!.toJson(),
|
|
|
+ if (proxies != null) 'proxies': proxies!.map((proxy) => proxy.toJson()).toList(),
|
|
|
+ if (proxyGroups != null) 'proxy-groups': proxyGroups!.map((group) => group.toJson()).toList(),
|
|
|
+ 'rules': rules.map((rule) => rule.toJson()).toList(),
|
|
|
+ };
|
|
|
+ }
|
|
|
String toYaml() {
|
|
|
var yaml = basicConfig.toYaml();
|
|
|
if (dnsConfig != null) {
|