server.dart 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 HysteriaServer extends ServerBase {
  6. String hysteriaProtocol;
  7. String? obfs;
  8. String? alpn;
  9. String authType;
  10. String? authPayload;
  11. @JsonKey(name: 'server_name')
  12. String? serverName;
  13. bool insecure;
  14. @JsonKey(name: 'up_mbps')
  15. int upMbps;
  16. @JsonKey(name: 'down_mbps')
  17. int downMbps;
  18. @JsonKey(name: 'recv_window_conn')
  19. int? recvWindowConn;
  20. @JsonKey(name: 'recv_window')
  21. int? recvWindow;
  22. @JsonKey(name: 'disable_mtu_discovery')
  23. bool disableMtuDiscovery;
  24. HysteriaServer({
  25. required String protocol,
  26. required String address,
  27. required int port,
  28. required String remark,
  29. required this.hysteriaProtocol,
  30. this.obfs,
  31. this.alpn,
  32. required this.authType,
  33. this.authPayload,
  34. this.serverName,
  35. required this.insecure,
  36. required this.upMbps,
  37. required this.downMbps,
  38. this.recvWindowConn,
  39. this.recvWindow,
  40. required this.disableMtuDiscovery,
  41. }) : super(
  42. protocol: protocol,
  43. address: address,
  44. port: port,
  45. remark: remark,
  46. );
  47. factory HysteriaServer.defaults() => HysteriaServer(
  48. protocol: 'hysteria',
  49. address: '',
  50. port: 0,
  51. remark: '',
  52. hysteriaProtocol: 'udp',
  53. authType: 'none',
  54. insecure: false,
  55. upMbps: 10,
  56. downMbps: 50,
  57. recvWindowConn: 15728640,
  58. recvWindow: 67108864,
  59. disableMtuDiscovery: false,
  60. );
  61. factory HysteriaServer.fromJson(Map<String, dynamic> json) =>
  62. _$HysteriaServerFromJson(json);
  63. @override
  64. Map<String, dynamic> toJson() => _$HysteriaServerToJson(this);
  65. }