TailTalk:一个基于 Rust 和 Tokio 的现代异步用户空间 AppleTalk 协议栈
TailTalk: A modern async user space AppleTalk stack with Rust and Tokio

原始链接: https://github.com/FeralFirmware/TailTalk/

TailTalk 是一款零依赖、用户空间的 AppleTalk 工具包,旨在连接现代系统(Linux、macOS、Windows)与经典 Macintosh 硬件。它使用 Rust 从零构建,提供了一套完整的 AppleTalk 协议栈,包括对 AARP、DDP、NBP、ATP、PAP、ASP 和 AFP 的支持。 该项目使现代计算机能够通过 EtherTalk 或 LocalTalk(使用 TashTalk 硬件)与老式 Mac 进行通信。其主要功能包括:通过 AFP 服务器共享文件、促进经典 Mac 与现代网络打印机之间的打印(包括对 AirPrint/IPP 的支持),以及管理保留资源分支(resource fork)的磁盘/软盘镜像。 TailTalk 专为实现“零配置”的易用性而设计,旨在复刻经典 Apple 网络无缝的连接体验。虽然目前主要专注于无需路由器的设置,但该项目也包含了一个图形界面、一个共享守护进程(tailtalkd)以及各种用于测试和集成的命令行工具。作为一项活跃的开发原型,它仍处于进展之中,并欢迎社区参与贡献。详细的设置说明(包括所需的驱动程序和原始套接字访问权限)可在项目的文档及 GitHub 仓库中查阅。

“TailTalk” 是一个全新的、现代化的、支持异步的 AppleTalk 协议栈,使用 Rust 和 Tokio 编写。该项目旨在帮助用户将现代计算环境与老式 Macintosh 硬件连接起来,从而实现与 80 和 90 年代的老式 Mac 进行文件共享等操作。 该项目作为复古计算爱好者的现代解决方案,在 Hacker News 上引起了关注,特别是在 Linux 内核移除了对 AppleTalk 的原生支持之后。除了软件栈之外,开发者还正在研发定制硬件,以将现代机器连接到传统的 LocalTalk 网络,并模拟已淘汰的苹果打印机适配器。 社区讨论强调了该项目在替代树莓派上老旧“Netatalk”方案的实用性,并引发了人们对使用用户空间实现(如 FUSE 或 LKL)以保留那些被主线内核弃用的传统协议和文件系统的更广泛兴趣。用户们还在探索“GlobalTalk”计划,旨在通过互联网桥接这些复古的 AppleTalk 网络。
相关文章

原文

Crates.io docs.rs

TailTalk is designed as a "toolkit" for building fully userspace AppleTalk implementations on Linux, Mac OS and Windows systems via EtherTalk or LocalTalk networks. It is built from scratch with zero dependencies on Netatalk or any kernel drivers - All it needs is a raw socket and/or TashTalk compatible device (for LocalTalk) and patience for grumpy old computers. It provides a complete AppleTalk stack, with multiple copies of it able to run on the same machine at the same time.

I started this project to be able to copy files to/from my old Macs, print to LaserWriters, ImageWriters and networked StyleWriters, and be able to write modern async software to communicate with them. Currently TailTalk only works in a routerless setup - work is in progress to make it gracefully join router present networks but it is not yet in the mainline code.

Each part of the stack is meant to be as "zero config" as possible, just like running on a Mac of the era. Just plug it in, launch and things should just work without any fuss.

This project is very much a work in progress prototype, so expect bugs and missing features.

This is the current user facing program for use with TashTalk USB. It includes an AFP server which should work with just about every Mac that shipped with a LocalTalk port. It also can import Stuff-It archives and floppy disk images and load them in to the share path preserving the resource forks and make them available to remote clients.

It additionally supports sharing LocalTalk capable LaserWriters, ImageWriters and StyleWriters to modern networks as AirPrint / IPP printers, and sharing modern printers to classic Macs. The latest release can be found here:

https://github.com/FeralFirmware/TailTalk/releases/latest

Packet parsers and fully async APIs for almost all the major AppleTalk protocols.

  • AppleTalk Address Resolution Protocol (AARP)
  • Datagram Delivery Protocol (DDP)
  • Name Binding Protocol (NBP)
  • AppleTalk Transaction Protocol (ATP)
  • Printer Access Protocol (PAP)
  • AppleTalk Session Protocol (ASP)
  • AppleTalk Filing Protocol (AFP)
  • AppleTalk Data Stream Protocol

It additionally supports running with TashTalk for LocalTalk Macs.

The AARP/DDP underlay can run either in-process (the default) or in a shared daemon, tailtalkd, which owns the interfaces and serves DDP sockets, addressing, and routing rules to multiple clients over a protobuf protocol on a Unix or UDP socket — usable from TailTalk (TalkStack::builder().daemon_unix(..)) or plain C clients. See docs/daemon-protocol.md.

This project requires Rust 1.90 or above, which can be installed from rustup.rs. This should install a matching compiler for your OS and CPU architecture by default.

This project uses cargo-packager for building AppImage for Linux, and App bundles for macOS and installers for Windows. Install it with cargo install cargo-packager.

Ensure you have the Windows MSVC prerequisites installed as specified in the rustup book.

Windows requires the npcap SDK to be saved somewhere on your machine. It is available at npcap.com. Point a LIB environment variable to the folder where you unzipped the SDK, such as: C:\npcap-sdk-1.13\Lib\x64

Once the prerequisites are installed, run cargo build --release from the root of this repository to build everything, or for just the TailTail GUI run cargo build -p tailtalk-gui --release.

After building the binaries should be located at target/release/.

Then run the following based on your OS:

# Linux
cargo packager --release -f appimage -p tailtalk-gui
# macOS
cargo packager --release -p tailtalk-gui
# Windows 
cargo packager --release -f nsis -p tailtalk-gui

The resulting bundle will be placed in dist/.

Quick start guide: Setup.md

TashTalk USB uses a Silicon Labs CP210x USB-to-UART bridge (VID 10c4, PID ea60).

The cp210x kernel module is likely installed already but by default the device node is only accessible by root. To grant your user access without requiring root, create a udev rule:

echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", TAG+="uaccess"' \
  | sudo tee /etc/udev/rules.d/99-tashtalk-usb.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

After running these commands, unplug and re-plug the TashTalk USB device. It will appear as /dev/ttyUSB0 (or similar) and be accessible without root.

Install the CP210x VCP Windows driver from Silicon Labs.

Install npcap 1.88 from npcap.com

macOS 11 and later includes support for the CP2102N USB chip out of the box. For 10.12 through 10.15 the driver from Silicon Labs is required for the device to be recognised: https://www.silabs.com/software-and-tools/usb-to-uart-bridge-vcp-drivers?tab=downloads

EtherTalk is compiled into the GUI by default on macOS, where libpcap ships with the OS. On Linux and Windows it is opt-in: build with cargo build -p tailtalk-gui --features ethertalk once libpcap (libpcap-dev) or the npcap SDK is installed.

Packet capture and injection go through /dev/bpf*, which is root-only out of the box. To use EtherTalk as a regular user, install the ChmodBPF package that ships inside the Wireshark disk image (or run brew install --cask wireshark-chmodbpf). It creates an access_bpf group, hands the BPF devices to it, and adds you to the group.

Group membership only applies to new login sessions, so log out and back in afterwards. Until then, and if ChmodBPF is not installed at all, the GUI hides the Ethernet Interface picker rather than offering a transport that would fail to start.

There are 4 demo programs I have written to verify the functionality of this software as I have developed it:

  • aep-echo - A simple echo program that sends an echo request to a target address and prints the response time.
  • afp-server - An AFP 1.0, 1.1 and 2.0 compatible AFP server. Very much a work in progress but is capable of reading and writing files to classic Mac systems. Basic directory browsing and file operations are supported.
  • nbp-lookup - Performs an NBP lookup based on the provided request string and returns the results
  • pap-print - Sends a PostScript file to a PAP printer. Aimed at LaserWriters, and have only tested on my own 4/600 PS.
  • tailtalkd - The TailTalk underlay daemon. Owns the physical AppleTalk interfaces and serves DDP sockets, addressing, and routing to client applications over a Unix/UDP socket.
  • tailtalk-gui - A simple GUI for sharing a folder as a volume over EtherTalk and/or LocalTalk (via TashTalk).

All of the examples run a complete copy of the stack using a raw socket (if EtherTalk is enabled) and thus need to be run as root, or the appropriate setcap applied to the compiled binary (on macOS, ChmodBPF instead, see EtherTalk). If only using TashTalk then this is not required.

Beyond unit tests I have found the best way to test this software is with real hardware. My current test setup consists of:

  • Linux machine running TailTalk
  • PowerBook G3 running Mac OS 9.2 via Ethernet
  • LaserWriter 4/600 PS via AsanteTalk
  • Color StyleWriter 2200 via EtherTalk adapter
  • ImageWriter II with the LocalTalk Option Card
  • Macintosh SE/30 running System 7.1 via AsanteTalk
  • Macintosh Classic running System 6.0.8 via AsanteTalk

When the AsanteTalk is first powered on it "listens" for incoming packets on the Ethernet side before choosing what EtherTalk phase to operate under. If it doesn't see any EtherTalk Phase 2 packets it will default to Phase 1. TailTalk supports Phase 1 and this works just fine for LaserWriters, NBP and some basic operations but does not work with AFP (The Mac will discover the AFP TailTalk server but our responses appear to be dropped).

I'd love to see this project grow into something that can be used to build more complete AppleTalk implementations. All contributions are welcome, but please open an issue first to discuss the changes you'd like to make. Additionally Pull Requests should mention what systems the change was verified against. This project has made me realise how quirky old systems are.

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

联系我们 contact @ memedata.com