Documentation
¶
Index ¶
- func Addr2UCred(str string) (pid, uid int)
- func DuplexConnCtrlFd(conn net.Conn) error
- func DuplexConnDataRpc(conn net.Conn) error
- func GetInjectKey() string
- func GetInjectValue() string
- func GetUCred(c *net.UnixConn) (int, int, error)
- func ListenFile(network, address string) (*os.File, string, error)
- func ListenSocket(network, address string) (net.Listener, net.PacketConn, error)
- func RecvFile(via *net.UnixConn) (*os.File, error)
- func ResolveAddress(network, address string) (net.Addr, error)
- func SendFile(via *net.UnixConn, file *os.File) error
- func TLSClientConn(raw *net.UnixConn) *tls.Conn
- func TLSServerConn(raw *net.UnixConn) *tls.Conn
- func UCred2Addr(pid, uid int) string
- type UnixConn
- type UnixListener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Addr2UCred ¶
Addr2UCred 从字符串地址中解码出UCred2Addr编码的pid和uid
func ListenFile ¶
ListenFile 将Listen给定的地址,并将得到的Listenr或者PacketConn的提取*os.File返回
func ListenSocket ¶
ListenSocket 统一Listener和PacketConn的Listen方式
func ResolveAddress ¶
ResolveAddress 解析全部支持的协议地址
Types ¶
type UnixConn ¶
UnixConn 包装了原始的tls.Conn,目标是为了能够将连接对端的pid和uid给拿到,并能传递给到grpc的业务功能
func (*UnixConn) RemoteAddr ¶
type UnixListener ¶
type UnixListener struct {
*net.UnixListener
// HijackCtrlFd 允许从连接中分类控制信道
HijackCtrlFd func(*net.UnixConn)
}
UnixListener 包装了标准库的UnixListener,主要是为了能在grpc场景中,能拦截grpc创建的连接。 grpc对连接的包装层次较深,无法简单的得到请求归属的原始连接,只能出此下策
Click to show internal directories.
Click to hide internal directories.