Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

controlcp

This is a vibe coded app. @fgrreloaded Support for Android coming soon.

Tiny LAN clipboard sync. Copy on one device, paste on another. Devices find each other automatically via mDNS when they're on the same Wi-Fi — no IPs to configure.

How it works

  • Every device runs the agent (or the Android app).
  • Each agent advertises _controlcp._tcp over mDNS and connects to peers it discovers (the peer with the smaller ID dials, so each pair has one TCP connection).
  • Clipboard changes are broadcast as JSON messages. Content is AES-256-GCM encrypted with a key derived from --secret; peers with a different secret are rejected at handshake.
  • A content-hash check stops sync loops (A → B → A).

Usage

Pick one secret and use it on every device:

# Mac
./controlcp -secret "my-secret-here"

# Windows (silent, no console window)
controlcp-windows.exe -secret "my-secret-here"

# Windows (with logs, for troubleshooting)
controlcp-windows-console.exe -secret "my-secret-here"

Flags: -name (device name shown to peers, defaults to hostname), -port (default 8891), -secret (required in practice — without it, traffic is unencrypted and any device on the network can join), and -peers (comma-separated host:port list to connect to directly).

Troubleshooting: devices don't connect

Discovery uses mDNS (UDP multicast on port 5353), which Windows Firewall blocks unless the app was allowed on the current network profile. Two fixes:

  1. Allow the app: Windows Security → Firewall & network protection → "Allow an app through firewall" → add the controlcp exe and tick Private (and Public if your Wi-Fi is set to public).

  2. Skip discovery entirely — point the Windows agent at the Mac:

    controlcp-windows-console.exe -secret "..." -peers 192.168.1.4:8891
    

    This only needs outbound traffic on Windows, which firewalls always allow, and it retries every 15s so it survives reboots and sleep.

Build

Requires Go (installed via mise; mise.toml pins the version).

go build -ldflags="-s -w" -o controlcp .                                        # macOS
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 \
  go build -ldflags="-s -w -H=windowsgui" -o controlcp-windows.exe .            # Windows

Run at startup

macOS — save as ~/Library/LaunchAgents/dev.nitish.controlcp.plist (fix the binary path and secret), then launchctl load it:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
  <key>Label</key><string>dev.nitish.controlcp</string>
  <key>ProgramArguments</key><array>
    <string>/Users/nitish/dev/repositories/controlcp/controlcp</string>
    <string>-secret</string><string>my-secret-here</string>
  </array>
  <key>RunAtLoad</key><true/>
  <key>KeepAlive</key><true/>
  <key>StandardErrorPath</key><string>/tmp/controlcp.log</string>
</dict></plist>

Windows — press Win+R, run shell:startup, and drop in a shortcut to controlcp-windows.exe with the -secret ... argument added to its target. Allow it on private networks when the firewall prompt appears.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages