newHolePunchService function
Future<HolePunchService>
newHolePunchService(
- Host host,
- IDService ids,
- List<
MultiAddr> listenAddrs(), { - HolePunchOptions? options,
Creates a new holepunch service.
The Service runs on all hosts that support the DCUtR protocol, no matter if they are behind a NAT / firewall or not. The Service handles DCUtR streams (which are initiated from the node behind a NAT / Firewall once we establish a connection to them through a relay.
listenAddrs MUST only return public addresses.
Implementation
Future<HolePunchService> newHolePunchService(
Host host,
IDService ids,
List<MultiAddr> Function() listenAddrs, {
HolePunchOptions? options,
}) async {
if (ids == null) {
throw ArgumentError('identify service can\'t be null');
}
final service = HolePunchServiceImpl(host, ids, listenAddrs, options: options);
await service.start();
return service;
}