toJson method

  1. @override
JsonMap toJson()
override

Implementation

@override
JsonMap toJson() {
  if (protocol.isEmpty) {
    throw StateError('Xray inbound protocol must not be empty');
  }
  if (port <= 0 || port > 65535) {
    throw StateError('Xray inbound port is out of range: $port');
  }

  return {
    'tag': tag,
    'port': port,
    'protocol': protocol,
    'listen': listen,
    'settings': settings,
    'sniffing': sniffing?.toJson(),
    'streamSettings': streamSettings,
    'allocate': allocate,
  };
}