Skip to content

Commit 2062bcd

Browse files
committed
credentials: Allow net.Pipe with credentials/local
net.Pipe is a go standard library abstraction to create in-process an in-process connected pair of net.Conn. Using a specialized net.Listener and WithContextDialier this allows to create an in-process grpc Server/Client pair without an OS based roundtrip. RELEASE NOTES: * credentials: Allow using net.Pipe basec connections with credentials/local authorization.
1 parent 7235bb7 commit 2062bcd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

credentials/local/local.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ func getSecurityLevel(network, addr string) (credentials.SecurityLevel, error) {
7474
// Windows named pipe connection
7575
case network == "pipe" && strings.HasPrefix(addr, `\\.\pipe\`):
7676
return credentials.NoSecurity, nil
77+
// Go net.Pipe connection
78+
case network == "pipe" && addr == "pip"
79+
return credentials.NoSecurity, nil
7780
// UDS connection
7881
case network == "unix":
7982
return credentials.PrivacyAndIntegrity, nil

credentials/local/local_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ func (s) TestGetSecurityLevel(t *testing.T) {
5757
testAddr: "[::1]:10000",
5858
want: credentials.NoSecurity,
5959
},
60+
{
61+
testNetwork: "pipe",
62+
testAddr: "pipe",
63+
want: credentials.NoSecurity,
64+
},
6065
{
6166
testNetwork: "unix",
6267
testAddr: "/tmp/grpc_fullstack_test",

0 commit comments

Comments
 (0)