Documentation
¶
Index ¶
- type Client
- func (c *Client) ConnectWait()
- func (c *Client) GetTunLocalAddrWithPortOnConn(conn *ClientConn) string
- func (c *Client) SendAllPing()
- func (c *Client) SendPacket(pkt iface.PacketIP)
- func (c *Client) SendPing(conn *ClientConn)
- func (c *Client) Start()
- func (c *Client) Stop()
- func (c *Client) Write(data []byte)
- func (c *Client) WriteNow(data []byte)
- type ClientConn
- type GrpcHandler
- type Server
- type ServerConn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(remoteAddr string, key string, threads int, handler GrpcHandler) *Client
func (*Client) ConnectWait ¶
func (c *Client) ConnectWait()
func (*Client) GetTunLocalAddrWithPortOnConn ¶
func (c *Client) GetTunLocalAddrWithPortOnConn(conn *ClientConn) string
func (*Client) SendAllPing ¶
func (c *Client) SendAllPing()
func (*Client) SendPacket ¶
func (*Client) SendPing ¶
func (c *Client) SendPing(conn *ClientConn)
type ClientConn ¶
type ClientConn struct {
// contains filtered or unexported fields
}
func NewClientConn ¶
func NewClientConn(remoteAddr, key string, index int, parentWG *sync.WaitGroup) *ClientConn
func (*ClientConn) Close ¶
func (this *ClientConn) Close()
func (*ClientConn) GetConnPort ¶
func (sc *ClientConn) GetConnPort() string
为了使用 10.4.4.3:port 这样的格式来表示一条tcp连接
func (*ClientConn) IsConnected ¶
func (this *ClientConn) IsConnected() bool
func (*ClientConn) SetHander ¶
func (this *ClientConn) SetHander(handler GrpcHandler)
func (*ClientConn) Write ¶
func (this *ClientConn) Write(data []byte)
func (*ClientConn) WriteNow ¶
func (this *ClientConn) WriteNow(data []byte) error
type GrpcHandler ¶
type Server ¶
type Server struct { Mtx *sync.Mutex //为了能够删除已经断开的连接,并能够反过来查询连接,所以有两个map Conns map[string]*ServerConn ConnsReverse map[*net.TCPConn]string // contains filtered or unexported fields }
func (*Server) GetConnsByAddr ¶
func (s *Server) GetConnsByAddr(dst string) *ServerConn
func (*Server) RemoveConnByConnPointer ¶
func (*Server) StartListen ¶
func (s *Server) StartListen()
type ServerConn ¶
type ServerConn struct {
// contains filtered or unexported fields
}
func NewServerConn ¶
func NewServerConn(conn *net.TCPConn, key string, handler GrpcHandler) *ServerConn
func (*ServerConn) ProcessWrite ¶
func (cc *ServerConn) ProcessWrite() (err error)
func (*ServerConn) SendPacket ¶
func (sc *ServerConn) SendPacket(pkt iface.PacketIP)
func (*ServerConn) Write ¶
func (cc *ServerConn) Write(data []byte)
func (*ServerConn) WriteNow ¶
func (cc *ServerConn) WriteNow(data []byte) error
Click to show internal directories.
Click to hide internal directories.