Documentation ¶
Overview ¶
Package grpcfd provides a TransportCredential that can wrap other TransportCredentials and cause the peer.Addr to be a FDSender or FDRecver such that it can send or receive files over unix file sockets (if available).
Index ¶
- func CaptureSender(capturer func(FDSender), dialopts ...grpc.DialOption) (opts []grpc.DialOption, ok bool)
- func FDToURL(fd uintptr) (*url.URL, error)
- func FileToURL(file SyscallConn) (u *url.URL, err error)
- func FilenameToURL(filename string) (u *url.URL, err error)
- func PerRPCCredentials(cred credentials.PerRPCCredentials) credentials.PerRPCCredentials
- func PerRPCCredentialsFromCallOptions(opts ...grpc.CallOption) credentials.PerRPCCredentials
- func TransportCredentials(cred credentials.TransportCredentials, capturers ...func(FDSender)) credentials.TransportCredentials
- func URLStringToDevIno(urlstr string) (dev, ino uint64, err error)
- func URLToDevIno(u *url.URL) (dev, ino uint64, err error)
- func WithChainStreamInterceptor() grpc.DialOption
- func WithChainUnaryInterceptor() grpc.DialOption
- func WithTransportCredentials(creds credentials.TransportCredentials, capturers ...func(FDSender)) grpc.DialOption
- type FDRecver
- type FDSender
- type FDTransceiver
- type SyscallConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureSender ¶
func CaptureSender(capturer func(FDSender), dialopts ...grpc.DialOption) (opts []grpc.DialOption, ok bool)
CaptureSender - given a list of dialopts ... if one of them is a grpcfd.TransportCredentials option... add another capturer to capture FDSenders on dial
func FileToURL ¶
func FileToURL(file SyscallConn) (u *url.URL, err error)
FileToURL converts file to URL of inode://${dev}/${ino}
func FilenameToURL ¶
FilenameToURL converts filename to URL of inode://${dev}/${ino}
func PerRPCCredentials ¶
func PerRPCCredentials(cred credentials.PerRPCCredentials) credentials.PerRPCCredentials
PerRPCCredentials - per rpc credentials that will, in addition to applying cred, invoke sendFunc Note: Must be used in concert with grpcfd.TransportCredentials
func PerRPCCredentialsFromCallOptions ¶
func PerRPCCredentialsFromCallOptions(opts ...grpc.CallOption) credentials.PerRPCCredentials
PerRPCCredentialsFromCallOptions - extract credentials.PerRPCCredentials from a list of grpc.CallOptions
func TransportCredentials ¶
func TransportCredentials(cred credentials.TransportCredentials, capturers ...func(FDSender)) credentials.TransportCredentials
TransportCredentials - transport credentials that will, in addition to applying cred, cause peer.Addr to supply the FDSender and FDRecver interfaces
func URLStringToDevIno ¶
URLStringToDevIno converts url of form inode://${dev}/${ino} to dev,ino
func URLToDevIno ¶
URLToDevIno - converts url of form inode://${dev}/${ino} url to dev,ino
func WithChainStreamInterceptor ¶
func WithChainStreamInterceptor() grpc.DialOption
WithChainStreamInterceptor returns a DialOption that specifies the chained interceptor for streaming RPCs.This interceptor combines all grpc.PerRPCCredsCallOption options into one. That allows using a few credentials.PerRPCCredentials passed from default call options and from the client call.
func WithChainUnaryInterceptor ¶
func WithChainUnaryInterceptor() grpc.DialOption
WithChainUnaryInterceptor returns a DialOption that specifies the chained interceptor for unary RPCs. This interceptor combines all grpc.PerRPCCredsCallOption options into one. That allows using a few credentials.PerRPCCredentials passed from default call options and from the client call.
func WithTransportCredentials ¶
func WithTransportCredentials(creds credentials.TransportCredentials, capturers ...func(FDSender)) grpc.DialOption
WithTransportCredentials - drop in replacement for grpc.WithTransportCredentials, that will, in addition to applying cred, cause peer.Addr to supply the FDSender and FDRecver interfaces.
Types ¶
type FDRecver ¶
type FDRecver interface { RecvFD(dev, inode uint64) <-chan uintptr RecvFile(dev, ino uint64) <-chan *os.File RecvFileByURL(urlStr string) (<-chan *os.File, error) RecvFDByURL(urlStr string) (<-chan uintptr, error) }
FDRecver - capable of Recving an fd by (dev,ino)
type FDSender ¶
type FDSender interface { SendFD(fd uintptr) <-chan error SendFile(file SyscallConn) <-chan error SendFilename(filename string) <-chan error }
FDSender - capable of Sending a file
type FDTransceiver ¶
FDTransceiver - combination of FDSender and FDRecver
func FromContext ¶
func FromContext(ctx context.Context) (transceiver FDTransceiver, ok bool)
FromContext - return grpcfd.FDTransceiver from context.Context
ok is true of successful, false otherwise
func FromPeer ¶
func FromPeer(p *peer.Peer) (transceiver FDTransceiver, ok bool)
FromPeer - return grpcfd.FDTransceiver from peer.Peer
ok is true of successful, false otherwise
func FromPerRPCCredentials ¶
func FromPerRPCCredentials(rpcCredentials credentials.PerRPCCredentials) (transceiver FDTransceiver, ok bool)
FromPerRPCCredentials - return grpcfd.FDTransceiver from credentials.PerRPCCredentials
ok is true of successful, false otherwise
type SyscallConn ¶
SyscallConn - having the SyscallConn method to access syscall.RawConn