Addigy lan-cache
The Addigy lan-cache utility categorizes agent’s found on the same local subnet by peer weight. This is evaluated on a few characteristics that help determine which devices should help distribute the package. The agent connections are peered with an MD5 hash (Tells the cache client to check the check the downloaded file’s md5 hash against the md5 hash provided. If it fails, the file will be rejected.
lan-cache Example Commands
Shows all peers on the LAN in json format from the device: /Library/Addigy/lan-cache peers
Start the lan-cache server: /Library/Addigy/lan-cache host
Downloads the file specified by web_url to the local_path: /Library/Addigy/lan-cache download web_url local_path
Set a Device with an elevated weigh tto enforce it as the caching system and restart the lan-cache utility: /Library/Addigy/lan-cache -set-weight-setting -weight=100 && sudo launchctl unload /Library/LaunchDaemons/com.addigy.lan-cache.plist && sudo launchctl load /Library/LaunchDaemons/com.addigy.lan-cache.plist
Query downloaded files: sqlite3 /Library/Addigy/download-cache/download.db 'select * from downloads;'
Storage
A local sqllite database is deployed on the agents to help manage and track download actions, activities, and peers. /Library/Addigy/download-cache/download.db
lan-cache weight
Add Weight: You can run a command such as lan-cache -set-weight -weight=10
.
This will have the device share this number with its peers. Peers will sort by this number in decreasing order to determine in which order to poll its peers when searching for a file. With this setting we should be able to get a group of devices we may want to function as file servers in the network and give it higher weight than all other devices, ensuring that these servers are checked before all others.
PeerProxy: You can run a command such as lan-cache -set-peer-proxy -peer-proxy=true
.
This will make the device download and serve a file if it is not in its cache when requested by another peer. This ensures that peers don’t have to look further than this device in order to get the file, even when the file is not currently on the proxy device. This setting ensures that as long as the file servers are available, the peers in the network should not need to look further than these devices, even in cases where the files requested are not caches. This also serves as a way to populate the proxy devices caches.
Logs
Addigy lan-cache logs are located at: /Library/Addigy/logs/cache.log
LaunchDaemons
A LaunchDaemon for the Addigy lan-cache is located at: /Library/LaunchDaemons/com.addigy.lan-cache.plist
Additional Information
- lan-cache runs on port
64084
on all devices - lan-cache uses DNS Service Discovery to identify peers
- Leveraging lan-cache for downloading files: Creating Custom Software with Large Files