clash_core.dart 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. class ClashCoreVersion {
  2. ClashCoreVersion({
  3. required this.premium,
  4. required this.version,
  5. });
  6. late bool premium;
  7. late String version;
  8. ClashCoreVersion.fromJson(Map<String, dynamic> json) {
  9. premium = json['premium'];
  10. version = json['version'];
  11. }
  12. Map<String, dynamic> toJson() {
  13. final data = <String, dynamic>{};
  14. data['premium'] = premium;
  15. data['version'] = version;
  16. return data;
  17. }
  18. @override
  19. String toString() {
  20. return toJson().toString();
  21. }
  22. }
  23. class ClashCoreConfig {
  24. ClashCoreConfig({
  25. required this.port,
  26. required this.socksPort,
  27. required this.redirPort,
  28. required this.tproxyPort,
  29. required this.mixedPort,
  30. required this.authentication,
  31. required this.allowLan,
  32. required this.bindAddress,
  33. required this.mode,
  34. required this.logLevel,
  35. required this.ipv6,
  36. });
  37. late int port;
  38. late int socksPort;
  39. late int redirPort;
  40. late int tproxyPort;
  41. late int mixedPort;
  42. late List<String> authentication;
  43. late bool allowLan;
  44. late String bindAddress;
  45. late String mode;
  46. late String logLevel;
  47. late bool ipv6;
  48. ClashCoreConfig.fromJson(Map<String, dynamic> json) {
  49. port = json['port'];
  50. socksPort = json['socks-port'];
  51. redirPort = json['redir-port'];
  52. tproxyPort = json['tproxy-port'];
  53. mixedPort = json['mixed-port'];
  54. authentication = List.castFrom<dynamic, String>(json['authentication']);
  55. allowLan = json['allow-lan'];
  56. bindAddress = json['bind-address'];
  57. mode = json['mode'];
  58. logLevel = json['log-level'];
  59. ipv6 = json['ipv6'];
  60. }
  61. Map<String, dynamic> toJson() {
  62. final data = <String, dynamic>{};
  63. data['port'] = port;
  64. data['socks-port'] = socksPort;
  65. data['redir-port'] = redirPort;
  66. data['tproxy-port'] = tproxyPort;
  67. data['mixed-port'] = mixedPort;
  68. data['authentication'] = authentication;
  69. data['allow-lan'] = allowLan;
  70. data['bind-address'] = bindAddress;
  71. data['mode'] = mode;
  72. data['log-level'] = logLevel;
  73. data['ipv6'] = ipv6;
  74. return data;
  75. }
  76. @override
  77. String toString() {
  78. return toJson().toString();
  79. }
  80. }