updated apt state

This commit is contained in:
Paul 2023-07-15 19:53:46 +02:00
parent 6bbd1f9256
commit 9fbe6854f5
2 changed files with 7 additions and 2 deletions

View File

@ -17,8 +17,8 @@ apt-proxy-detect-go:
file.managed: file.managed:
- name: /usr/local/bin/apt-proxy-detect - name: /usr/local/bin/apt-proxy-detect
- source: {{ apt.fetch_url }}/apt_{{ apt.arch }} - source: {{ apt.fetch_url }}/apt_{{ apt.arch }}
- source_hash: {{ apt.fetch_url }}/hashes
- template: jinja - template: jinja
- skip_verify: true
- mode: "0755" - mode: "0755"
{% for key, value in apt.config.items() -%} {% for key, value in apt.config.items() -%}

View File

@ -17,13 +17,18 @@ type Proxy struct {
} }
func (p *Proxy) Format() string { func (p *Proxy) Format() string {
if p.PORT == 0 {
return fmt.Sprintf(TMPL_WITHOUT_PORT, p.SCHEME, p.HOSTNAME)
} else {
return fmt.Sprintf(TMPL, p.SCHEME, p.HOSTNAME, p.PORT) return fmt.Sprintf(TMPL, p.SCHEME, p.HOSTNAME, p.PORT)
} }
}
var DEFAULT_PORT = 8000 var DEFAULT_PORT = 8000
var DEFAULT_PROXY = Proxy{SCHEME: "http", HOSTNAME: "apt.paulbsd.com", PORT: 8001} var DEFAULT_PROXY = Proxy{SCHEME: "https", HOSTNAME: "apt.paulbsd.com", PORT: 0}
const TMPL = "%s://%s:%d" const TMPL = "%s://%s:%d"
const TMPL_WITHOUT_PORT = "%s://%s"
func main() { func main() {
addr, err := net.ResolveUDPAddr("udp", mdns.DefaultAddress) addr, err := net.ResolveUDPAddr("udp", mdns.DefaultAddress)