This commit is contained in:
quantulr
2023-02-06 23:45:56 +08:00
commit ac65c1dec0
147 changed files with 5605 additions and 0 deletions

54
lib/models/configs.dart Normal file
View File

@ -0,0 +1,54 @@
import 'package:json_annotation/json_annotation.dart';
/// This allows the `User` class to access private members in
/// the generated file. The value for this is *.g.dart, where
/// the star denotes the source file name.
part 'configs.g.dart';
/// An annotation for the code generator to know that this class needs the
/// JSON serialization logic to be generated.
@JsonSerializable()
class Configs {
Configs(
this.port,
this.socksPort,
this.tproxyPort,
this.redirPort,
this.mixedPort,
this.authentication,
this.allowLan,
this.bindAddress,
this.mode,
this.logLevel,
this.ipv6);
int port;
@JsonKey(name: 'socks-port')
int socksPort;
@JsonKey(name: 'redir-port')
int redirPort;
@JsonKey(name: 'tproxy-port')
int tproxyPort;
@JsonKey(name: 'mixed-port')
int mixedPort;
List authentication;
@JsonKey(name: 'allow-lan')
bool allowLan;
@JsonKey(name: 'bind-address')
String bindAddress;
String mode;
@JsonKey(name: 'log-level')
String logLevel;
bool ipv6;
/// A necessary factory constructor for creating a new Configs instance
/// from a map. Pass the map to the generated `_$ConfigsFromJson()` constructor.
/// The constructor is named after the source class, in this case, Configs.
factory Configs.fromJson(Map<String, dynamic> json) =>
_$ConfigsFromJson(json);
/// `toJson` is the convention for a class to declare support for serialization
/// to JSON. The implementation simply calls the private, generated
/// helper method `_$ConfigsToJson`.
Map<String, dynamic> toJson() => _$ConfigsToJson(this);
}

35
lib/models/configs.g.dart Normal file
View File

@ -0,0 +1,35 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'configs.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Configs _$ConfigsFromJson(Map<String, dynamic> json) => Configs(
json['port'] as int,
json['socks-port'] as int,
json['tproxy-port'] as int,
json['redir-port'] as int,
json['mixed-port'] as int,
json['authentication'] as List<dynamic>,
json['allow-lan'] as bool,
json['bind-address'] as String,
json['mode'] as String,
json['log-level'] as String,
json['ipv6'] as bool,
);
Map<String, dynamic> _$ConfigsToJson(Configs instance) => <String, dynamic>{
'port': instance.port,
'socks-port': instance.socksPort,
'redir-port': instance.redirPort,
'tproxy-port': instance.tproxyPort,
'mixed-port': instance.mixedPort,
'authentication': instance.authentication,
'allow-lan': instance.allowLan,
'bind-address': instance.bindAddress,
'mode': instance.mode,
'log-level': instance.logLevel,
'ipv6': instance.ipv6,
};