1
0
Fork 0
Rewriter for Squid's url_rewrite_program with out of the box support for many popular Linux distros' mirrors.
Go to file
Maurizio Porrato 8bb615b741
ci/woodpecker/push/lint Pipeline was successful Details
ci/woodpecker/push/test Pipeline was successful Details
Optionally serve rewrite requests from tcp socket
2022-09-29 08:21:35 +01:00
.woodpecker CI: add lint and test pipelines 2022-09-20 20:34:48 +01:00
config First commit 2022-09-17 09:51:33 +01:00
distro Fix archlinux mirror url regexp 2022-09-28 08:59:38 +01:00
squid Optionally serve rewrite requests from tcp socket 2022-09-29 08:21:35 +01:00
trie Add -dump flag to help troubleshooting 2022-09-28 08:49:24 +01:00
.gitignore First commit 2022-09-17 09:51:33 +01:00
README.md First commit 2022-09-17 09:51:33 +01:00
UNLICENSE First commit 2022-09-17 09:51:33 +01:00
go.mod First commit 2022-09-17 09:51:33 +01:00
go.sum First commit 2022-09-17 09:51:33 +01:00
main.go Optionally serve rewrite requests from tcp socket 2022-09-29 08:21:35 +01:00
rewrites.yaml.sample First commit 2022-09-17 09:51:33 +01:00

README.md

squid-rewriter

This is a rewrite engine for squid. It is meant to be used with the url_rewrite_program directive in your squid.conf file.

The rewrite rules are read from a yaml file. The file is expected to look like something like this:

---
rewrites:
  - name: static
    urls:
      - http://proxy/
    destination: http://127.0.0.1:9999/
  - name: fromfile
    filename: myrewrites.list
    destination: http://example.com/
  - name: alpine
    distro: alpine
    destination: https://dl-cdn.alpinelinux.org/alpine/
  - name: debian
    distro: debian
    destination: http://deb.debian.org/debian/
  - name: arch
    distro: arch
    destination: https://geo.mirror.pkgbuild.com/
  - name: fedora
    distro: fedora
    destination: https://fedora.mirrorservice.org/fedora/linux/
  - name: fedora
    distro: fedora:epel
    destination: https://fedora.mirrorservice.org/epel/
  - name: ubuntu
    distro: ubuntu
    destination: http://archive.ubuntu.com/ubuntu/
  - name: mint
    distro: mint
    destination: https://mirrors.layeronline.com/linuxmint/
  - name: slackware
    distro: slackware
    destination: https://www.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/

Each rewrite entry must contain a descriptive name (name) a destination url (destination) and one or more of the following:

  • a list of static prefixes (urls)
  • the name of a text file containing one prefix per line (filename)
  • the name of a distribution repo (distro) in the format distroname:reponame; if reponame is omitted, it defaults to main; the name of the repos depend on the distro; at the moment only the fedora distro supports repos other than main (epel, centos)

On startup, squid-rewriter will look for rewrite rules in the following files:

  • rewrites.yaml in the current directory
  • rewrites.yml in the current directory
  • /etc/squid/rewrites.yaml
  • /etc/squid/rewrites.yml

Only the first existent file from the list above will be loaded.