Skip to content

Instantly share code, notes, and snippets.

@liamkinne
Created February 1, 2022 02:06
Show Gist options
  • Save liamkinne/84194ff1f00e923b308c0850ce21a19e to your computer and use it in GitHub Desktop.
Save liamkinne/84194ff1f00e923b308c0850ce21a19e to your computer and use it in GitHub Desktop.
Convert CSV of Uptime.com probe servers to Squid proxy config format
{
read # ignore first line
while IFS=, read -r name location address address_ipv6
do
printf "%-18s %-15s %-20s\n" "acl whitelist src" "$address" "# $name"
done
} < probe-servers.csv # default file name
@liamkinne
Copy link
Author

Output should look something like this

acl whitelist src  45.76.31.88     # US-Chicago(DuPontFabros)-1 (SingleLocationChecks)
acl whitelist src  96.126.127.99   # Default Test Server
acl whitelist src  198.178.224.231 # US-New York(DigitalRealty)-19
acl whitelist src  198.178.224.9   # US-New York(DigitalRealty)-20
acl whitelist src  185.209.179.215 # US-New York(DigitalRealty)-21
acl whitelist src  198.178.224.89  # US-New York(DigitalRealty)-22
acl whitelist src  66.165.229.42   # US-Los Angeles(DigitalRealty)-28
acl whitelist src  46.21.152.34    # US-Los Angeles(DigitalRealty)-29
acl whitelist src  23.227.177.154  # US-Los Angeles(DigitalRealty)-30
acl whitelist src  37.72.173.250   # US-Los Angeles(DigitalRealty)-31
acl whitelist src  2.56.188.133    # US-Dallas(Equinix)-19
acl whitelist src  2.56.188.139    # US-Dallas(Equinix)-20
acl whitelist src  2.56.188.158    # US-Dallas(Equinix)-21
acl whitelist src  2.56.188.159    # US-Dallas(Equinix)-22
acl whitelist src  5.180.211.91    # GB-London(Volta)-13
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment