setLocalDhtEnabled method

Future<void> setLocalDhtEnabled(
  1. bool enabled
)
inherited

Set whether DHT on the local network or localhost is allowed. By default this is false because DHT is a global discovery mechanism and finding a local peer on it is unexpected (and could indicate malice). However, is some situations it's still useful to enable it (typically for testing).

Note: this option is currently experimental and unstable (semver extempt). It's possible it will be removed in the future.

Implementation

Future<void> setLocalDhtEnabled(
  bool enabled,
) async {
  final request = RequestSessionSetLocalDhtEnabled(
    enabled: enabled,
  );
  final response = await client.invoke(request);
  switch (response) {
    case ResponseUnit(): return;
    default: throw UnexpectedResponse();
  }
}