SuperAPI AI 工具集

tailscale

部署与运维

查看项目

更新于 10-16 08:16

技能介绍

用途

Tailscale Skill 是一个混合型技能(Hybrid skill),通过 CLI 处理本机操做,通过 API 处理整个 tailnet 范围的管理,用于在命令行和自动化脚本中管理 Tailscale 网络。

主要能力

本地操作(CLI,仅作用于当前机器)

  • 状态与诊断:tailscale status 查看对等节点与连接状态,支持 --json 输出;tailscale netcheck 检查 NAT 类型、DERP、UDP;tailscale ip -4 获取本机 Tailscale IP;tailscale whois 识别某个 Tailscale IP。
  • 连接性:tailscale ping 测试到对等节点(显示直连还是中继);tailscale up / down 连接或断开;tailscale up --exit-node=<node-name> 使用出口节点,配合 tailscale exit-node list 与 tailscale exit-node suggest。
  • 文件传输(Taildrop):tailscale file cp myfile.txt <device-name>: 发送文件;tailscale file get ~/Downloads 接收文件,tailscale file get --wait ~/Downloads 阻塞等待文件到达。
  • 暴露服务:tailscale serve 3000 或 tailscale serve https://localhost:8080 在 tailnet 内私有共享;tailscale funnel 8080 公开暴露到互联网;tailscale serve status 与 tailscale funnel status 查看当前暴露情况。
  • SSH:tailscale ssh user@hostname 通过 MagicDNS 连接;tailscale up --ssh 在本机启用 SSH 服务端。

Tailnet 范围操作(API,需要 API key)

  • 设备:./scripts/ts-api.sh devices(可加 --verbose)、device <device-id-or-name>、online 快速检查全部设备在线状态、authorize <device-id>、delete <device-id>。
  • 标签与路由:./scripts/ts-api.sh tags <device-id> tag:server,tag:prod、routes <device-id>。
  • 认证密钥:create-key 支持 --reusable --tags tag:server、--ephemeral(设备离线后自动移除)、--expiry 7d;keys 列出密钥。
  • DNS:dns 显示 DNS 配置,dns-nameservers 列出 nameserver,magic-dns on|off 切换 MagicDNS。
  • ACL:acl 获取当前 ACL,acl-validate <file> 校验 ACL 文件。

使用方式

API 配置为可选,用于 tailnet 范围操作,配置路径为 ~/.thinkfleetbot/credentials/tailscale/config.json,内容包含 apiKey 与 tailnet。tailnet 可填 -(自动检测)、组织名或邮箱域名。API key 从 Tailscale 管理控制台的 Settings → Keys → Generate API Key 获取。

适用场景

  • 询问“现在谁在线?”:./scripts/ts-api.sh online
  • “把这个文件发到我手机”:tailscale file cp document.pdf my-phone:
  • “把我的开发服务器公网暴露”:tailscale funnel 3000
  • “为新服务器创建密钥”:./scripts/ts-api.sh create-key --reusable --tags tag:server --expiry 7d
  • “连接是直连还是中继?”:tailscale ping my-server

限制

CLI 操作仅作用于当前机器;tailnet 范围操作需要 API key。资料未提供其他限制、平台范围或收费相关信息。