core: Support Windows absolute paths for UDS proxy upstreams (#5114)

* added some tests for parseUpstreamDialAddress

Test 4 fails because it produces "[[::1]]:80" instead of "[::1]:80"

* support absolute windows path in unix reverse proxy address

* make IsUnixNetwork public, support +h2c and reuse it
* add new tests
This commit is contained in:
Steffen Brüheim
2023-02-08 18:05:09 +01:00
committed by GitHub
parent c77a6bea66
commit 536c28d4dc
4 changed files with 255 additions and 18 deletions

View File

@ -34,7 +34,7 @@ import (
// reuseUnixSocket copies and reuses the unix domain socket (UDS) if we already
// have it open; if not, unlink it so we can have it. No-op if not a unix network.
func reuseUnixSocket(network, addr string) (any, error) {
if !isUnixNetwork(network) {
if !IsUnixNetwork(network) {
return nil, nil
}
@ -103,7 +103,7 @@ func listenTCPOrUnix(ctx context.Context, lnKey string, network, address string,
// reusePort sets SO_REUSEPORT. Ineffective for unix sockets.
func reusePort(network, address string, conn syscall.RawConn) error {
if isUnixNetwork(network) {
if IsUnixNetwork(network) {
return nil
}
return conn.Control(func(descriptor uintptr) {