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:
2025-11-24 09:41:29 +01:00
parent e6fee24f40
commit 9be5f6226e
6 changed files with 24 additions and 5 deletions

View File

@@ -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: