WireGuardConfig.fromJson constructor

WireGuardConfig.fromJson(
  1. Object? json
)

Implementation

factory WireGuardConfig.fromJson(Object? json) {
  final map = asJsonMap(json, 'wireguard');
  return WireGuardConfig(
    noKernelTun: map['noKernelTun'] as bool?,
    secretKey: map['secretKey'] as String,
    address: (map['address'] as List?)?.cast<String>(),
    peers: map['peers'] == null
        ? null
        : asJsonList(map['peers'], WireGuardPeerConfig.fromJson),
    mtu: map['mtu'] as int?,
    numWorkers: map['workers'] as int?,
    reserved: (map['reserved'] as List?)?.cast<int>(),
    domainStrategy: map['domainStrategy'] == null
        ? null
        : XrayTargetStrategyJson.fromJson(map['domainStrategy']),
  );
}