This commit is contained in:
cxc
2023-02-07 17:28:01 +08:00
parent ac65c1dec0
commit 06ff4a41f4
25 changed files with 537 additions and 184 deletions

View File

@ -1,54 +0,0 @@
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);
}

View File

@ -1,35 +0,0 @@
// 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,
};

View File

@ -0,0 +1,27 @@
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 'login_resp.g.dart';
/// An annotation for the code generator to know that this class needs the
/// JSON serialization logic to be generated.
@JsonSerializable()
class LoginResp {
LoginResp(this.token, this.msg);
String token;
String msg;
/// 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 LoginResp.fromJson(Map<String, dynamic> json) =>
_$LoginRespFromJson(json);
/// `toJson` is the convention for a class to declare support for serialization
/// to JSON. The implementation simply calls the private, generated
/// helper method `_$LoginRespToJson`.
Map<String, dynamic> toJson() => _$LoginRespToJson(this);
}

View File

@ -0,0 +1,17 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'login_resp.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
LoginResp _$LoginRespFromJson(Map<String, dynamic> json) => LoginResp(
json['token'] as String,
json['msg'] as String,
);
Map<String, dynamic> _$LoginRespToJson(LoginResp instance) => <String, dynamic>{
'token': instance.token,
'msg': instance.msg,
};