whois method

  1. @override
Future<TailscaleNodeIdentity?> whois(
  1. String ip
)
override

Resolves a tailnet IP to the node's identity — stable node ID, owner login, hostname, and ACL tags — by querying the local LocalAPI.

Returns null if ip is not known on the current tailnet. Useful for authorization decisions on incoming connections: combine with tcp .bind(...) and check TailscaleNodeIdentity.tags before handling. See tailscale.com/kb/1068/tags for the tag model.

Implementation

@override
Future<TailscaleNodeIdentity?> whois(String ip) async {
  if (!_peerPortIndex.containsKey(ip)) {
    return null;
  }

  return TailscaleNodeIdentity(
    nodeId: 'loopback-$ip',
    hostName: 'loopback-${ip.replaceAll('.', '-')}',
    userLoginName: 'loopback@test',
    tags: const ['tag:test'],
    tailscaleIPs: [ip],
  );
}