Skip to content

Commit b9319c0

Browse files
author
hastmu
committed
added comments to output
1 parent 5e45ed3 commit b9319c0

File tree

1 file changed

+98
-80
lines changed

1 file changed

+98
-80
lines changed

README.md

Lines changed: 98 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ What do you get?
1515
- [X] detect via avahi
1616
- [X] caching of URL specific working proxy (or none if none works)
1717
- [X] caching over reboot if possible
18+
- [X] allow mixture of allowed and non allowed urls (no need for direct declaration)
1819

1920
# How does it look?
2021

@@ -111,62 +112,78 @@ export DEBUG_APT_PROXY_DETECT=1
111112
sudo apt update
112113
```
113114

114-
looks like (first run)
115+
looks like (first run, with comments)
115116

116117
```
117118
dev@dev:~$ export DEBUG_APT_PROXY_DETECT=1
118119
dev@dev:~$ sudo apt update
119120
# INFO-TAG MS : MESSAGE
120-
[ INFO][ 1]: ===--- apt-proxy-detect ---===
121-
[ TEST-URL][ 16]: URL: http://packages.microsoft.com/repos/code/dists/stable/InRelease
122-
[ HASH][ 26]: HASH: c0b917f192fa7cccb3f536f2c01b824d of (http://packages.microsoft.com)
123-
[ AVAHI][ 33]: get cache entries for _apt_proxy._tcp
124-
[ CHECK][ 208]: Checking found proxy (http://192.168.0.27:8000) with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease)
125-
[ CHECK-PROXY][ 331]: Proxy (http://192.168.0.27:8000) works with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease).
126-
[ ADD][ 333]: add proxy to working proxy list.
121+
[ INFO][ 2]: ===--- apt-proxy-detect ---===
122+
[ TEST-URL][ 18]: URL: http://packages.microsoft.com/repos/code/dists/stable/InRelease
123+
[ HASH][ 42]: HASH: c0b917f192fa7cccb3f536f2c01b824d of (http://packages.microsoft.com)
124+
# no proxy known so search one...
125+
[ AVAHI][ 52]: get cache entries for _apt_proxy._tcp
126+
[ CHECK][ 110]: Checking found proxy (http://192.168.0.27:8000) with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease)
127+
[ CHECK-PROXY][ 150]: Proxy (http://192.168.0.27:8000) works with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease).
128+
# register working proxy
129+
[ ADD][ 161]: add proxy to working proxy list.
130+
# first proxy does work for url
127131
Service[OK][Squid deb proxy on squid-deb-proxy]@http://192.168.0.27:8000
128-
[ CHECK][ 356]: Checking found proxy (http://192.168.0.27:3142) with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease)
129-
[ CHECK-PROXY][ 367]: Proxy (http://192.168.0.27:3142) failed with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease)
132+
[ CHECK][ 209]: Checking found proxy (http://192.168.0.27:3142) with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease)
133+
[ CHECK-PROXY][ 220]: Proxy (http://192.168.0.27:3142) failed with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease)
134+
# second proxy does not work for the url
130135
Service[ER][apt-cacher-ng proxy on squid-deb-proxy]@http://192.168.0.27:3142
131-
[ PROXY][ 370]: return :http://192.168.0.27:8000:
132-
[ CACHE][ 373]: Store (http://192.168.0.27:8000) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
133-
[ CACHE][ 375]: Update cachefile.
134-
[ INFO][ 2]: ===--- apt-proxy-detect ---===
135-
[ TEST-URL][ 17]: URL: http://download.proxmox.com/debian/pve/dists/bookworm/InRelease
136-
[ HASH][ 29]: HASH: 17b43db99b56eb6355d41861f4f304d0 of (http://download.proxmox.com)
137-
[ CACHE][ 35]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
138-
[ CHECK][ 38]: once working proxy: http://192.168.0.27:8000 for http://download.proxmox.com/debian/pve/dists/bookworm/InRelease
139-
[ CHECK-PROXY][ 141]: Proxy (http://192.168.0.27:8000) works with testurl (http://download.proxmox.com/debian/pve/dists/bookworm/InRelease).
140-
[ PROXY][ 144]: return :http://192.168.0.27:8000:
141-
[ CACHE][ 146]: Store (http://192.168.0.27:8000) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
142-
[ CACHE][ 148]: Update cachefile.
136+
[ PROXY][ 223]: return :http://192.168.0.27:8000:
137+
[ CACHE][ 231]: Store (http://192.168.0.27:8000) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
138+
[ CACHE][ 235]: Update cachefile.
143139
[ INFO][ 1]: ===--- apt-proxy-detect ---===
144-
[ TEST-URL][ 15]: URL: http://local-repo.fritz.box/local-repo/dists/trunk/InRelease
145-
[ HASH][ 23]: HASH: 2bfbb1335aaf9d333a5c9498226eb208 of (http://local-repo.fritz.box)
146-
[ CACHE][ 28]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
147-
[ CHECK][ 30]: once working proxy: http://192.168.0.27:8000 for http://local-repo.fritz.box/local-repo/dists/trunk/InRelease
148-
[ CHECK-PROXY][ 49]: Proxy (http://192.168.0.27:8000) works with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease).
149-
[ PROXY][ 51]: return :http://192.168.0.27:8000:
150-
[ CACHE][ 53]: Store (http://192.168.0.27:8000) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
151-
[ CACHE][ 56]: Update cachefile.
140+
[ TEST-URL][ 18]: URL: http://download.proxmox.com/debian/pve/dists/bookworm/InRelease
141+
[ HASH][ 34]: HASH: 17b43db99b56eb6355d41861f4f304d0 of (http://download.proxmox.com)
142+
[ CACHE][ 39]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
143+
# check if the once working proxy if fine
144+
[ CHECK][ 44]: once working proxy: http://192.168.0.27:8000 for http://download.proxmox.com/debian/pve/dists/bookworm/InRelease
145+
[ CHECK-PROXY][ 70]: Proxy (http://192.168.0.27:8000) works with testurl (http://download.proxmox.com/debian/pve/dists/bookworm/InRelease).
146+
# it is so no need to search again.
147+
[ PROXY][ 72]: return :http://192.168.0.27:8000:
148+
[ CACHE][ 75]: Store (http://192.168.0.27:8000) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
149+
[ CACHE][ 77]: Update cachefile.
152150
[ INFO][ 1]: ===--- apt-proxy-detect ---===
153-
[ TEST-URL][ 27]: URL: http://security.debian.org/debian-security/dists/bookworm-security/InRelease
154-
[ HASH][ 38]: HASH: 3b68f7b6590a2da8625ff71f01d38ffb of (http://security.debian.org)
151+
[ TEST-URL][ 16]: URL: http://local-repo.fritz.box/local-repo/dists/trunk/InRelease
152+
[ HASH][ 24]: HASH: 2bfbb1335aaf9d333a5c9498226eb208 of (http://local-repo.fritz.box)
153+
[ CACHE][ 29]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
154+
[ CHECK][ 31]: once working proxy: http://192.168.0.27:8000 for http://local-repo.fritz.box/local-repo/dists/trunk/InRelease
155+
# once working proxy failed
156+
[ CHECK-PROXY][ 41]: Proxy (http://192.168.0.27:8000) failed with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
157+
# search again
158+
[ AVAHI][ 46]: get cache entries for _apt_proxy._tcp
159+
[ CHECK][ 91]: Checking found proxy (http://192.168.0.27:8000) with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
160+
[ CHECK-PROXY][ 101]: Proxy (http://192.168.0.27:8000) failed with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
161+
Service[ER][Squid deb proxy on squid-deb-proxy]@http://192.168.0.27:8000
162+
[ CHECK][ 124]: Checking found proxy (http://192.168.0.27:3142) with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
163+
[ CHECK-PROXY][ 134]: Proxy (http://192.168.0.27:3142) failed with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease)
164+
Service[ER][apt-cacher-ng proxy on squid-deb-proxy]@http://192.168.0.27:3142
165+
# none found (as local repos are not allowed on the proxies)
166+
[ PROXY][ 149]: return ::
167+
[ CACHE][ 152]: Store (NONE) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
168+
[ CACHE][ 154]: Update cachefile.
169+
[ INFO][ 2]: ===--- apt-proxy-detect ---===
170+
[ TEST-URL][ 26]: URL: http://security.debian.org/debian-security/dists/bookworm-security/InRelease
171+
[ HASH][ 41]: HASH: 3b68f7b6590a2da8625ff71f01d38ffb of (http://security.debian.org)
155172
[ CACHE][ 47]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
156-
[ CHECK][ 51]: once working proxy: http://192.168.0.27:8000 for http://security.debian.org/debian-security/dists/bookworm-security/InRelease
157-
[ CHECK-PROXY][ 102]: Proxy (http://192.168.0.27:8000) works with testurl (http://security.debian.org/debian-security/dists/bookworm-security/InRelease).
158-
[ PROXY][ 104]: return :http://192.168.0.27:8000:
159-
[ CACHE][ 106]: Store (http://192.168.0.27:8000) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
160-
[ CACHE][ 108]: Update cachefile.
161-
[ INFO][ 1]: ===--- apt-proxy-detect ---===
162-
[ TEST-URL][ 16]: URL: http://deb.debian.org/debian/dists/bookworm/InRelease
163-
[ HASH][ 24]: HASH: efbfa0e2acaaa513c457b6698de83118 of (http://deb.debian.org)
164-
[ CACHE][ 28]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
165-
[ CHECK][ 30]: once working proxy: http://192.168.0.27:8000 for http://deb.debian.org/debian/dists/bookworm/InRelease
166-
[ CHECK-PROXY][ 93]: Proxy (http://192.168.0.27:8000) works with testurl (http://deb.debian.org/debian/dists/bookworm/InRelease).
167-
[ PROXY][ 95]: return :http://192.168.0.27:8000:
168-
[ CACHE][ 97]: Store (http://192.168.0.27:8000) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
169-
[ CACHE][ 100]: Update cachefile.
173+
[ CHECK][ 50]: once working proxy: http://192.168.0.27:8000 for http://security.debian.org/debian-security/dists/bookworm-security/InRelease
174+
[ CHECK-PROXY][ 61]: Proxy (http://192.168.0.27:8000) works with testurl (http://security.debian.org/debian-security/dists/bookworm-security/InRelease).
175+
[ PROXY][ 64]: return :http://192.168.0.27:8000:
176+
[ CACHE][ 66]: Store (http://192.168.0.27:8000) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
177+
[ CACHE][ 70]: Update cachefile.
178+
[ INFO][ 2]: ===--- apt-proxy-detect ---===
179+
[ TEST-URL][ 19]: URL: http://deb.debian.org/debian/dists/bookworm/InRelease
180+
[ HASH][ 27]: HASH: efbfa0e2acaaa513c457b6698de83118 of (http://deb.debian.org)
181+
[ CACHE][ 31]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
182+
[ CHECK][ 34]: once working proxy: http://192.168.0.27:8000 for http://deb.debian.org/debian/dists/bookworm/InRelease
183+
[ CHECK-PROXY][ 45]: Proxy (http://192.168.0.27:8000) works with testurl (http://deb.debian.org/debian/dists/bookworm/InRelease).
184+
[ PROXY][ 48]: return :http://192.168.0.27:8000:
185+
[ CACHE][ 51]: Store (http://192.168.0.27:8000) in cache file (/var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt)
186+
[ CACHE][ 53]: Update cachefile.
170187
Hit:1 http://local-repo.fritz.box/local-repo trunk InRelease
171188
Hit:2 http://deb.debian.org/debian bookworm InRelease
172189
Hit:3 http://security.debian.org/debian-security bookworm-security InRelease
@@ -188,45 +205,46 @@ dev@dev:~$ export DEBUG_APT_PROXY_DETECT=1
188205
dev@dev:~$ sudo apt update
189206
# INFO-TAG MS : MESSAGE
190207
[ INFO][ 1]: ===--- apt-proxy-detect ---===
191-
[ TEST-URL][ 15]: URL: http://packages.microsoft.com/repos/code/dists/stable/InRelease
192-
[ HASH][ 23]: HASH: c0b917f192fa7cccb3f536f2c01b824d of (http://packages.microsoft.com)
193-
[ CACHE][ 28]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
194-
[ CACHE-AGE][ 30]: age: 110 sec
195-
[ CHECK-PROXY][ 138]: Proxy (http://192.168.0.27:8000) works with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease).
196-
[ WORKS][ 140]: give back cached proxy
197-
[ PROXY][ 142]: return http://192.168.0.27:8000
198-
[ INFO][ 1]: ===--- apt-proxy-detect ---===
199-
[ TEST-URL][ 16]: URL: http://download.proxmox.com/debian/pve/dists/bookworm/InRelease
200-
[ HASH][ 23]: HASH: 17b43db99b56eb6355d41861f4f304d0 of (http://download.proxmox.com)
201-
[ CACHE][ 28]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
202-
[ CACHE-AGE][ 30]: age: 110 sec
203-
[ CHECK-PROXY][ 134]: Proxy (http://192.168.0.27:8000) works with testurl (http://download.proxmox.com/debian/pve/dists/bookworm/InRelease).
204-
[ WORKS][ 136]: give back cached proxy
205-
[ PROXY][ 138]: return http://192.168.0.27:8000
208+
[ TEST-URL][ 13]: URL: http://packages.microsoft.com/repos/code/dists/stable/InRelease
209+
[ HASH][ 31]: HASH: c0b917f192fa7cccb3f536f2c01b824d of (http://packages.microsoft.com)
210+
[ CACHE][ 37]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
211+
[ CACHE-AGE][ 41]: age: 57 sec
212+
[ CHECK-PROXY][ 129]: Proxy (http://192.168.0.27:8000) works with testurl (http://packages.microsoft.com/repos/code/dists/stable/InRelease).
213+
[ WORKS][ 132]: give back cached proxy
214+
[ PROXY][ 134]: return http://192.168.0.27:8000
215+
[ INFO][ 2]: ===--- apt-proxy-detect ---===
216+
[ TEST-URL][ 17]: URL: http://download.proxmox.com/debian/pve/dists/bookworm/InRelease
217+
[ HASH][ 25]: HASH: 17b43db99b56eb6355d41861f4f304d0 of (http://download.proxmox.com)
218+
[ CACHE][ 30]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
219+
[ CACHE-AGE][ 32]: age: 57 sec
220+
[ CHECK-PROXY][ 243]: Proxy (http://192.168.0.27:8000) works with testurl (http://download.proxmox.com/debian/pve/dists/bookworm/InRelease).
221+
[ WORKS][ 246]: give back cached proxy
222+
[ PROXY][ 249]: return http://192.168.0.27:8000
206223
[ INFO][ 2]: ===--- apt-proxy-detect ---===
207224
[ TEST-URL][ 16]: URL: http://local-repo.fritz.box/local-repo/dists/trunk/InRelease
208225
[ HASH][ 24]: HASH: 2bfbb1335aaf9d333a5c9498226eb208 of (http://local-repo.fritz.box)
209-
[ CACHE][ 28]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
210-
[ CACHE-AGE][ 30]: age: 111 sec
211-
[ CHECK-PROXY][ 49]: Proxy (http://192.168.0.27:8000) works with testurl (http://local-repo.fritz.box/local-repo/dists/trunk/InRelease).
212-
[ WORKS][ 52]: give back cached proxy
213-
[ PROXY][ 54]: return http://192.168.0.27:8000
226+
[ CACHE][ 37]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
227+
[ CACHE-AGE][ 39]: age: 58 sec
228+
[ CHECK-PROXY][ 41]: NONE-cached
229+
[ WORKS][ 43]: give back cached proxy
230+
[ PROXY][ 48]: return NONE
214231
[ INFO][ 2]: ===--- apt-proxy-detect ---===
215-
[ TEST-URL][ 19]: URL: http://security.debian.org/debian-security/dists/bookworm-security/InRelease
216-
[ HASH][ 27]: HASH: 3b68f7b6590a2da8625ff71f01d38ffb of (http://security.debian.org)
217-
[ CACHE][ 32]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
218-
[ CACHE-AGE][ 34]: age: 110 sec
219-
[ CHECK-PROXY][ 44]: Proxy (http://192.168.0.27:8000) works with testurl (http://security.debian.org/debian-security/dists/bookworm-security/InRelease).
220-
[ WORKS][ 48]: give back cached proxy
221-
[ PROXY][ 50]: return http://192.168.0.27:8000
232+
[ TEST-URL][ 17]: URL: http://security.debian.org/debian-security/dists/bookworm-security/InRelease
233+
[ HASH][ 25]: HASH: 3b68f7b6590a2da8625ff71f01d38ffb of (http://security.debian.org)
234+
[ CACHE][ 30]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
235+
[ CACHE-AGE][ 32]: age: 58 sec
236+
[ CHECK-PROXY][ 43]: Proxy (http://192.168.0.27:8000) works with testurl (http://security.debian.org/debian-security/dists/bookworm-security/InRelease).
237+
[ WORKS][ 45]: give back cached proxy
238+
[ PROXY][ 48]: return http://192.168.0.27:8000
222239
[ INFO][ 2]: ===--- apt-proxy-detect ---===
223-
[ TEST-URL][ 18]: URL: http://deb.debian.org/debian/dists/bookworm/InRelease
224-
[ HASH][ 30]: HASH: efbfa0e2acaaa513c457b6698de83118 of (http://deb.debian.org)
225-
[ CACHE][ 34]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
226-
[ CACHE-AGE][ 37]: age: 110 sec
227-
[ CHECK-PROXY][ 107]: Proxy (http://192.168.0.27:8000) works with testurl (http://deb.debian.org/debian/dists/bookworm/InRelease).
228-
[ WORKS][ 110]: give back cached proxy
229-
[ PROXY][ 112]: return http://192.168.0.27:8000
240+
[ TEST-URL][ 19]: URL: http://deb.debian.org/debian/dists/bookworm/InRelease
241+
[ HASH][ 28]: HASH: efbfa0e2acaaa513c457b6698de83118 of (http://deb.debian.org)
242+
[ CACHE][ 36]: using stored under: /var/lib/apt/lists/auxfiles/.apt-proxy-detect._apt
243+
[ CACHE-AGE][ 46]: age: 58 sec
244+
[ CHECK-PROXY][ 99]: Proxy (http://192.168.0.27:8000) works with testurl (http://deb.debian.org/debian/dists/bookworm/InRelease).
245+
[ WORKS][ 102]: give back cached proxy
246+
[ PROXY][ 104]: return http://192.168.0.27:8000
247+
230248
Hit:1 http://local-repo.fritz.box/local-repo trunk InRelease
231249
Hit:2 http://deb.debian.org/debian bookworm InRelease
232250
Hit:3 http://security.debian.org/debian-security bookworm-security InRelease

0 commit comments

Comments
 (0)