newAutoNAT function

Future<AutoNAT> newAutoNAT(
  1. Host h,
  2. List<AutoNATOption> options
)

Implementation

Future<AutoNAT> newAutoNAT(Host h, List<AutoNATOption> options) async {
  // Create a default config. The DialPolicy needs the host.
  final dialPolicy = DialPolicyImpl(host: h);
  final conf = AutoNATConfig(host: h, dialPolicy: dialPolicy);

  // Apply all options to the config
  applyOptions(conf, options);

  if (conf.forceReachability) {
    return StaticAutoNAT.create(h, conf.reachability, options); // Pass options for service setup
  } else {
    return AmbientAutoNAT.create(h, options);
  }
}