server.dart 984 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import 'package:json_annotation/json_annotation.dart';
  2. import 'package:speed_safe/app/server/server_base.dart';
  3. part 'server.g.dart';
  4. @JsonSerializable(includeIfNull: false)
  5. class TrojanServer extends ServerBase {
  6. String password;
  7. String? serverName;
  8. String? fingerPrint;
  9. bool allowInsecure;
  10. TrojanServer({
  11. required String protocol,
  12. required String address,
  13. required int port,
  14. required String remark,
  15. required this.password,
  16. this.serverName,
  17. this.fingerPrint,
  18. required this.allowInsecure,
  19. }) : super(
  20. protocol: protocol,
  21. address: address,
  22. port: port,
  23. remark: remark,
  24. );
  25. factory TrojanServer.defaults() => TrojanServer(
  26. protocol: 'trojan',
  27. address: '',
  28. port: 0,
  29. remark: '',
  30. password: '',
  31. allowInsecure: false,
  32. );
  33. factory TrojanServer.fromJson(Map<String, dynamic> json) =>
  34. _$TrojanServerFromJson(json);
  35. @override
  36. Map<String, dynamic> toJson() => _$TrojanServerToJson(this);
  37. }