11# clipx
22
3+ [ ![ CI] ( https://github.com/gomantics/clipx/actions/workflows/ci.yml/badge.svg )] ( https://github.com/gomantics/clipx/actions/workflows/ci.yml )
4+ [ ![ Go Report Card] ( https://goreportcard.com/badge/github.com/gomantics/clipx )] ( https://goreportcard.com/report/github.com/gomantics/clipx )
5+ [ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-blue.svg )] ( LICENSE )
6+ [ ![ Release] ( https://img.shields.io/github/v/release/gomantics/clipx )] ( https://github.com/gomantics/clipx/releases/latest )
7+
38LAN clipboard sync for macOS. Copy on one Mac, paste on another. Instantly.
49
510No cloud. No account. No Apple ID. No flaky Universal Clipboard.
@@ -19,25 +24,37 @@ Each Mac runs `clipx`. When you copy something, it sends the clipboard content d
1924- ** UDP unicast** — reliable, fast, no firewall issues with multicast
2025- ** Explicit pairing** — ` clipx pair <ip> ` , no flaky auto-discovery
2126- ** SHA-256 dedup** — prevents infinite ping-pong loops between nodes
22- - ** 10MB max** — large content is automatically chunked into 16KB UDP packets
27+ - ** 10 MB max** — large content is automatically chunked into ~ 1300-byte UDP packets
2328
24- ## Setup
29+ ## Install
2530
26- ### 1. Install on both Macs
31+ ### Homebrew (recommended)
32+
33+ ``` bash
34+ brew install gomantics/tap/clipx
35+ ```
36+
37+ ### Go install
2738
2839``` bash
2940go install github.com/gomantics/clipx/cmd/clipx@latest
3041```
3142
32- Or from source:
43+ ### From source
3344
3445``` bash
3546git clone https://github.com/gomantics/clipx.git
3647cd clipx
3748make build # binary at ./clipx-bin
3849```
3950
40- ### 2. Pair them
51+ ### Download binary
52+
53+ Pre-built binaries for macOS (Intel & Apple Silicon) are available on the [ releases page] ( https://github.com/gomantics/clipx/releases/latest ) .
54+
55+ ## Quick start
56+
57+ ### 1. Pair your Macs
4158
4259On ** Mac A** (e.g. 192.168.0.5):
4360
@@ -51,7 +68,7 @@ On **Mac B** (e.g. 192.168.0.6):
5168clipx pair 192.168.0.5 # IP of Mac A
5269```
5370
54- ### 3 . Install and run
71+ ### 2 . Install and run
5572
5673On ** both Macs** :
5774
@@ -144,29 +161,39 @@ One port, UDP only. If you run a firewall, `clipx install` handles it automatica
144161
145162### Protocol
146163
147- All communication is UDP unicast on port 9877. Three message types:
164+ All communication is UDP unicast on port 9877. Four message types:
148165
149166| Type | Byte | Purpose |
150167| ---| ---| ---|
151- | Clipboard | ` C ` | Carries clipboard content to peers |
168+ | Clipboard | ` C ` | Carries clipboard content (≤1300 bytes) |
169+ | Chunk | ` K ` | Carries a chunk of large clipboard content |
152170| Ping | ` P ` | Health check request |
153171| Pong | ` A ` | Health check response |
154172
155173Wire format: ` [6B magic "CLIPX2"] [1B type] [8B nodeID] [payload] `
156174
157175Clipboard payload: ` [64B SHA-256 hex hash] [clipboard data] `
158176
177+ Chunk payload: ` [64B SHA-256 hex hash] [2B chunk index] [2B total chunks] [chunk data] `
178+
159179### Loop prevention
160180
1611811 . Every clipboard write is hashed (SHA-256)
1621822 . When content arrives from a peer, its hash is recorded
1631833 . When the local clipboard watcher detects a change, it checks if the hash matches a recently received peer hash — if so, it skips broadcasting
164184
185+ ### Reliability
186+
187+ - Small clipboard content (≤1300 bytes) is sent 3 times for UDP reliability
188+ - Large content is automatically chunked and reassembled on the receiver
189+ - Incomplete chunk transfers are cleaned up after 30 seconds
190+ - Persistent UDP connections to peers with automatic reconnection
191+
165192### Limits
166193
167- - Max clipboard: ** 10MB ** (content >16KB is automatically chunked)
194+ - Max clipboard: ** 10 MB ** (content >1300 bytes is automatically chunked)
168195- Text only (uses ` pbcopy ` /` pbpaste ` )
169- - macOS only (for now)
196+ - macOS only
170197- Peers must be on the same LAN
171198
172199## Troubleshooting
@@ -188,6 +215,10 @@ Clipboard payload: `[64B SHA-256 hex hash] [clipboard data]`
188215- LaunchAgent logs: ` ~/Library/Logs/clipx.log `
189216- Live tail: ` tail -f ~/Library/Logs/clipx.log `
190217
218+ ## Contributing
219+
220+ Contributions are welcome! Please see [ CONTRIBUTING.md] ( CONTRIBUTING.md ) for guidelines.
221+
191222## License
192223
193224MIT — see [ LICENSE] ( LICENSE ) .
0 commit comments