config.dart 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import 'package:json_annotation/json_annotation.dart';
  2. part 'config.g.dart';
  3. @JsonSerializable(includeIfNull: false)
  4. class HysteriaConfig {
  5. String server;
  6. String protocol;
  7. String? obfs;
  8. String? alpn;
  9. String? auth;
  10. @JsonKey(name: 'auth_str')
  11. String? authStr;
  12. @JsonKey(name: 'server_name')
  13. String? serverName;
  14. bool insecure;
  15. @JsonKey(name: 'up_mbps')
  16. int upMbps;
  17. @JsonKey(name: 'down_mbps')
  18. int downMbps;
  19. @JsonKey(name: 'recv_window_conn')
  20. int? recvWindowConn;
  21. @JsonKey(name: 'recv_window')
  22. int? recvWindow;
  23. @JsonKey(name: 'disable_mtu_discovery')
  24. bool disableMtuDiscovery;
  25. Socks5 socks5;
  26. HysteriaConfig({
  27. required this.server,
  28. required this.protocol,
  29. this.obfs,
  30. this.alpn,
  31. this.auth,
  32. this.authStr,
  33. this.serverName,
  34. required this.insecure,
  35. required this.upMbps,
  36. required this.downMbps,
  37. this.recvWindowConn,
  38. this.recvWindow,
  39. required this.disableMtuDiscovery,
  40. required this.socks5,
  41. });
  42. factory HysteriaConfig.fromJson(Map<String, dynamic> json) =>
  43. _$HysteriaConfigFromJson(json);
  44. Map<String, dynamic> toJson() => _$HysteriaConfigToJson(this);
  45. }
  46. @JsonSerializable(includeIfNull: false)
  47. class Socks5 {
  48. String listen;
  49. int? timeout;
  50. @JsonKey(name: 'disable_udp')
  51. bool disableUdp;
  52. Socks5({
  53. required this.listen,
  54. this.timeout,
  55. required this.disableUdp,
  56. });
  57. factory Socks5.fromJson(Map<String, dynamic> json) => _$Socks5FromJson(json);
  58. Map<String, dynamic> toJson() => _$Socks5ToJson(this);
  59. }