mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
15 lines
400 B
Go
15 lines
400 B
Go
package grpchijack
|
|
|
|
import (
|
|
"net"
|
|
|
|
controlapi "github.com/moby/buildkit/api/services/control"
|
|
"google.golang.org/grpc/metadata"
|
|
)
|
|
|
|
// Hijack hijacks session to a connection.
|
|
func Hijack(stream controlapi.Control_SessionServer) (net.Conn, <-chan struct{}, map[string][]string) {
|
|
md, _ := metadata.FromIncomingContext(stream.Context())
|
|
c, closeCh := streamToConn(stream)
|
|
return c, closeCh, md
|
|
}
|