2020-07-27 20:43:58 +00:00
|
|
|
import 'IPAndPort.dart';
|
|
|
|
|
|
|
|
class StaticHost {
|
|
|
|
bool lighthouse;
|
|
|
|
List<IPAndPort> destinations;
|
|
|
|
|
2022-09-21 20:27:35 +00:00
|
|
|
StaticHost({required this.lighthouse, required this.destinations});
|
2020-07-27 20:43:58 +00:00
|
|
|
|
2022-09-21 20:27:35 +00:00
|
|
|
factory StaticHost.fromJson(Map<String, dynamic> json) {
|
2020-07-27 20:43:58 +00:00
|
|
|
var list = json['destinations'] as List<dynamic>;
|
2021-04-23 17:33:28 +00:00
|
|
|
var result = <IPAndPort>[];
|
2020-07-27 20:43:58 +00:00
|
|
|
|
|
|
|
list.forEach((item) {
|
|
|
|
result.add(IPAndPort.fromString(item));
|
|
|
|
});
|
|
|
|
|
2022-09-21 20:27:35 +00:00
|
|
|
return StaticHost(
|
|
|
|
lighthouse: json['lighthouse'],
|
|
|
|
destinations: result,
|
|
|
|
);
|
2020-07-27 20:43:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
return {
|
|
|
|
'lighthouse': lighthouse,
|
|
|
|
'destinations': destinations,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|