server.dart 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import 'package:json_annotation/json_annotation.dart';
  2. import 'package:speed_safe/app/server/server_base.dart';
  3. import 'package:uuid/uuid.dart';
  4. part 'server.g.dart';
  5. @JsonSerializable(includeIfNull: false)
  6. class XrayServer extends ServerBase {
  7. String uuid;
  8. int? alterId;
  9. String encryption;
  10. String? flow;
  11. String transport;
  12. String? host;
  13. String? path;
  14. String? grpcMode;
  15. String? serviceName;
  16. String tls;
  17. String? serverName;
  18. String? fingerPrint;
  19. String? publicKey;
  20. String? shortId;
  21. String? spiderX;
  22. bool allowInsecure;
  23. XrayServer({
  24. required String protocol,
  25. required String address,
  26. required int port,
  27. required String remark,
  28. required this.uuid,
  29. this.alterId,
  30. required this.encryption,
  31. this.flow,
  32. required this.transport,
  33. this.host,
  34. this.path,
  35. this.grpcMode,
  36. this.serviceName,
  37. required this.tls,
  38. this.serverName,
  39. this.fingerPrint,
  40. this.publicKey,
  41. this.shortId,
  42. this.spiderX,
  43. required this.allowInsecure,
  44. }) : super(
  45. protocol: protocol,
  46. address: address,
  47. port: port,
  48. remark: remark,
  49. );
  50. factory XrayServer.defaults() => XrayServer(
  51. protocol: '',
  52. address: '',
  53. port: 0,
  54. remark: '',
  55. uuid: const Uuid().v4(),
  56. alterId: 0,
  57. encryption: '',
  58. transport: 'tcp',
  59. tls: 'none',
  60. allowInsecure: false,
  61. );
  62. factory XrayServer.fromJson(Map<String, dynamic> json) =>
  63. _$XrayServerFromJson(json);
  64. @override
  65. Map<String, dynamic> toJson() => _$XrayServerToJson(this);
  66. }