feat(server/client): add windows pipe, pipe peer credentials support

Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
2025-11-23 18:08:12 +01:00
parent 6829ab5bbc
commit e6fee24f40
17 changed files with 339 additions and 16 deletions

26
client/client_test.go Normal file
View File

@@ -0,0 +1,26 @@
package client
import (
"testing"
)
func TestParseDialTarget(t *testing.T) {
tests := []struct {
input string
expectedNet string
expectedAddr string
}{
{"tcp://localhost:50051", "tcp", "localhost:50051"},
{"localhost:50051", "tcp", "localhost:50051"},
{"unix:///tmp/socket", "unix", "/tmp/socket"},
{"unix://C:/path/to/socket", "unix", "C:/path/to/socket"},
{"unix:path/to/socket", "unix", "path/to/socket"},
{`\\.\pipe\example`, "pipe", `\\.\pipe\example`},
}
for _, test := range tests {
net, addr := parseDialTarget(test.input)
if net != test.expectedNet || addr != test.expectedAddr {
t.Errorf("parseDialTarget(%q) = (%q, %q); want (%q, %q)", test.input, net, addr, test.expectedNet, test.expectedAddr)
}
}
}