#ip-address #ip #address #networking #discovery #mac-address

app lookaround

在局域网中报告和查找您的 MAC 和 IP 地址

7 个版本

0.1.6 2021 年 12 月 9 日
0.1.5 2021 年 12 月 9 日

#2260命令行工具

Download history 9/week @ 2024-06-29 58/week @ 2024-07-27

67 每月下载量

AGPL-3.0

33KB
1K SLoC

LookAround

"我想通过 SSH 连接到我的笔记本电脑,但我总是忘记它的 IP!!"

这有没有发生过在你身上?

$ ping $(lookaround find-nick laptop)
PING 192.168.1.101 (192.168.1.101) 56(84) bytes of data.
...

$ lookaround client

Found 3 peers:
11:11:11:11:11:11 = 192.168.1.101 `laptop`
22:22:22:22:22:22 = 192.168.1.102 `desktop`
33:33:33:33:33:33 = 192.168.1.103 `old-laptop`

LookAround 是一个 Rust 程序,用于在局域网中查找您的计算机的 MAC 和 IP 地址。没有中央服务器,所以这不是查找,而是查找。

安装

请确保已通过 RustUp 安装了 Cargo。

# Install LookAround with Cargo
cargo install lookaround

# Find your config directory
# Prints something like `Using config dir "/home/user/.config/lookaround"`
lookaround config

在目录中创建文件 client.ini 和/或 server.ini(例如 /home/user/.config/lookaround/server.ini)

# Clients can store MAC-nickname pairs in client.ini, like a hosts file.
# This is useful if your servers are short-lived and you want the clients
# to be the source of truth for nicknames.
[nicknames]
11-11-11-11-11-11 = laptop
22-22-22-22-22-22 = desktop
# Long-lived servers can have their nickname configured in server.ini
[server]
nickname = my-computer

自动启动(Linux)

将此 systemd 单元放入 ~/.config/systemd/user/lookaround.service

[Unit]
Description=LookAround

[Service]
ExecStart=/home/user/.cargo/bin/lookaround server
Restart=always

[Install]
WantedBy=default.target

然后启动服务,检查其运行是否正常,并启用自动启动

systemctl --user start lookaround
systemctl --user status lookaround
systemctl --user enable lookaround

自动启动(Windows)

(未经测试)

  • 创建 LookAround 可执行文件的快捷方式
  • 将快捷方式的目标更改为以 lookaround.exe server 结尾,以便它将运行服务器
  • 将快捷方式复制粘贴到 C:\ProgramData\somewhere 的启动文件夹中

用法

手动运行服务器:(在安装之前测试)

lookaround server --nickname my-computer

在客户端计算机上

# Use the `find-nick` subcommnad to find an IP...
lookaround find-nick laptop
# Prints `192.168.1.101`

# Or ping it...
ping $(lookaround find-nick laptop)

# Or SSH to it...
ssh user@$(lookaround find-nick laptop)

# Or pull a file from it
# (after starting `nc -l -p 9000 < some-file` on the laptop)
nc $(lookaround find-nick laptop) 9000

# Use the `client` subcommand to find all servers in the same multicast domain
lookaround client

# Use a longer timeout if servers need more than 500 ms to respond
lookaround client --timeout-ms 1000

贡献

欢迎拉取请求。这是一个爱好项目,因此我可能会拒绝过大而难以审查的贡献。

使用 kazupon Git 提交信息约定

许可证

AGPL-3.0

此 Git 仓库

此仓库的上游是 https://six-five-six-four.com/git/reactor/lookaround。它在我的 GitHub 上进行了镜像,https://github.com/ReactorScram/lookaround

我不使用 GitHub 问题,因此问题位于仓库中的 issues.md 中。

依赖项

~3–12MB
~118K SLoC