mirror of
https://github.com/linka-cloud/grpc.git
synced 2025-12-18 00:43:13 +00:00
feat(pipe): use wireguard-go pipe implementation until CL299009 is resolved
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
@@ -18,7 +18,7 @@ func Get(conn net.Conn) (*Creds, error) {
|
||||
return nil, ErrUnsupportedConnType
|
||||
}
|
||||
|
||||
h, err := winioPipeHandle(conn)
|
||||
h, err := pipeHandle(conn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -59,6 +59,18 @@ func Get(conn net.Conn) (*Creds, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
type handle interface {
|
||||
Handle() windows.Handle
|
||||
}
|
||||
|
||||
func pipeHandle(conn net.Conn) (windows.Handle, error) {
|
||||
if c, ok := conn.(handle); ok {
|
||||
return c.Handle(), nil
|
||||
}
|
||||
return winioPipeHandle(conn)
|
||||
}
|
||||
|
||||
// winioPipeHandle digs the underlying syscall HANDLE out of a go-winio
|
||||
// pipe connection using reflect + unsafe. This depends on the current
|
||||
// internal layout of github.com/Microsoft/go-winio:
|
||||
|
||||
Reference in New Issue
Block a user