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:
- name: /usr/local/bin/apt-proxy-detect
- source: {{ apt.fetch_url }}/apt_{{ apt.arch }}
- source_hash: {{ apt.fetch_url }}/hashes
- template: jinja
- skip_verify: true
- mode: "0755"
{% for key, value in apt.config.items() -%}

View File

@ -17,13 +17,18 @@ type Proxy struct {
}
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)
}
}
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_WITHOUT_PORT = "%s://%s"
func main() {
addr, err := net.ResolveUDPAddr("udp", mdns.DefaultAddress)