VictoriaMetrics/lib/netutil
LHHDZ 41e4135371
app/vmauth: fix discovering backend IPs when url_prefix contains hostname with srv+ prefix (#6401)
This change fixes the following panic:
```
2024-06-04T11:16:52.899Z        warn    app/vmauth/auth_config.go:353   cannot discover backend SRV records for http://srv+localhost:8080: lookup localhost on 10.100.10.4:53: server misbehaving; use it literally
panic: runtime error: integer divide by zero

goroutine 9 [running]:
github.com/VictoriaMetrics/VictoriaMetrics/lib/httpserver.handlerWrapper.func1()
        /Users/lhhdz/wd/projects/go/VictoriaMetrics/lib/httpserver/httpserver.go:291 +0x58
panic({0x103115100?, 0x10338d700?})
        /Users/lhhdz/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.3.darwin-arm64/src/runtime/panic.go:770 +0x124
main.getLeastLoadedBackendURL({0x0?, 0x22?, 0x1400014757b?}, 0x1400013c120?)
        /Users/lhhdz/wd/projects/go/VictoriaMetrics/app/vmauth/auth_config.go:473 +0x210
main.(*URLPrefix).getBackendURL(0x140000aa080)
        /Users/lhhdz/wd/projects/go/VictoriaMetrics/app/vmauth/auth_config.go:312 +0xb8
```

---------

Co-authored-by: Haley Wang <haley@victoriametrics.com>
2024-06-12 11:47:44 +02:00
..
conn.go lib: consistently use atomic.* types instead of atomic.* functions 2024-02-24 02:10:04 +02:00
conn_pool.go app/{vminsert,vmselect}: follow-up after 2b7b3293c1 2023-08-29 12:17:39 +02:00
conn_pool_test.go Add vmstorageUserTimeout flags to configure TCP user timeout (Linux) (#4423) 2023-08-29 11:46:39 +02:00
dns.go app/vmselect: add support for vmstorage groups with independent -replicationFactor per group 2023-12-13 00:14:34 +02:00
dns_test.go app/{vminsert,vmselect}: support for srv+addr scheme for specifying DNS SRV addresses at -storageNode flag 2024-04-17 23:15:05 +02:00
netutil.go app/vmauth: fix discovering backend IPs when url_prefix contains hostname with srv+ prefix (#6401) 2024-06-12 11:47:44 +02:00
proxyprotocol.go all: consistently use %w instead of %s in when error is passed to fmt.Errorf() 2023-10-26 09:44:40 +02:00
proxyprotocol_test.go app,lib: fix typos in comments (#3804) 2023-02-13 09:32:35 -08:00
tcpdialer.go all: fix golangci-lint(revive) warnings after 0c0ed61ce7 2024-04-03 03:00:45 +03:00
tcpdialer_default.go all: cleanup: remove // +build ... lines, since they are no longer needed after Go1.17, and the minimum supported Go version for VictoriaMetrics source code is Go1.20 2023-11-13 19:15:42 +01:00
tcpdialer_linux.go app/{vminsert,vmselect}: follow-up after 2b7b3293c1 2023-08-29 12:17:39 +02:00
tcplistener.go docs: follow-up after aec4b5db81 (#4638) 2023-07-19 14:48:17 -07:00
tls.go lib/netutil: move creation of GetCertificate callback into a separate function 2024-04-17 22:11:10 +02:00
tls_test.go all: upgrade Go builder from Go1.21.7 to Go1.22.0 2024-02-12 22:14:00 +02:00