Documentation
¶
Overview ¶
Package grpcSimple implements grpc tunnel without importing google.golang.org/grpc.
Reference ¶
https://github.com/Dreamacro/clash/blob/master/transport/gun/gun.go, which is under MIT license
在 clash的客户端实现 的 基础上 继续用 golang的 http2包 实现了 grpc 的 基本服务端,并改进了 原代码。
Advantages ¶
grpcSimple包 比grpc包 小很多,替代grpc包的话,可以减小 4MB 左右的可执行文件大小。但是目前不支持 multiMode。
grpcSimple包 是很棒 很有用的 实现,未来可以添加 针对 grpc的ServiceName的回落。
Off Topic ¶
我们可以通过本包的代码看到,grpc实际上是 基于包的,而不是基于流的,与ws类似。
参考 https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md
Index ¶
- type Client
- type ClientConn
- func (g *ClientConn) Close() error
- func (c *ClientConn) LocalAddr() net.Addr
- func (g *ClientConn) Read(b []byte) (n int, err error)
- func (c *ClientConn) RemoteAddr() net.Addr
- func (g *ClientConn) SetDeadline(t time.Time) error
- func (g *ClientConn) SetReadDeadline(t time.Time) error
- func (g *ClientConn) SetWriteDeadline(t time.Time) error
- func (g *ClientConn) Write(b []byte) (n int, err error)
- type Config
- type Creator
- type Server
- type ServerConn
- func (g *ServerConn) Close() error
- func (c *ServerConn) LocalAddr() net.Addr
- func (c *ServerConn) Read(b []byte) (n int, err error)
- func (c *ServerConn) RemoteAddr() net.Addr
- func (g *ServerConn) SetDeadline(t time.Time) error
- func (g *ServerConn) SetReadDeadline(t time.Time) error
- func (g *ServerConn) SetWriteDeadline(t time.Time) error
- func (g *ServerConn) Write(b []byte) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Config // contains filtered or unexported fields }
func (*Client) ProcessWhenFull ¶
type ClientConn ¶
type ClientConn struct {
// contains filtered or unexported fields
}
implements net.Conn
func (*ClientConn) Close ¶
func (g *ClientConn) Close() error
func (*ClientConn) RemoteAddr ¶
func (*ClientConn) SetDeadline ¶
func (*ClientConn) SetReadDeadline ¶
func (*ClientConn) SetWriteDeadline ¶
type Creator ¶
type Creator struct{}
func (Creator) GetDefaultAlpn ¶
func (Creator) NewClientFromConf ¶
func (Creator) NewServerFromConf ¶
type Server ¶
func (*Server) StartHandle ¶
type ServerConn ¶
func (*ServerConn) Close ¶
func (g *ServerConn) Close() error
func (*ServerConn) RemoteAddr ¶
func (*ServerConn) SetDeadline ¶
func (*ServerConn) SetReadDeadline ¶
func (*ServerConn) SetWriteDeadline ¶
Click to show internal directories.
Click to hide internal directories.