tunnel

package
v0.0.0-...-965f49c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteChat

func DeleteChat(conn *gtcp.Conn, chatID string)

DeleteChat 删除临时通信channel

func DeleteConn

func DeleteConn(conn *gtcp.Conn)

DeleteConn 客户端断开,删除全部临时通信channel

func GetChat

func GetChat(conn *gtcp.Conn, chatID string) options.BuffIterator

GetChat 获取通信channel

func NewBuffWithPrefix

func NewBuffWithPrefix(p options.NetType, length int) (buff []byte, uuid string)

NewBuffWithPrefix NewBuffWithPrefix p 前缀 length 预分配buff内存

func NewUID

func NewUID() []byte

NewUID uuid

func PackBuff

func PackBuff(chatID string, buf []byte) (buff []byte)

PackBuff 打包隧道数据

func ProxyHTTP

func ProxyHTTP(ctx context.Context, proxy *gtcp.Conn, bridge *gtcp.Conn) (recvByte, sendByte int, err error)

ProxyHTTP 读取http

func ReadConn

func ReadConn(ctx context.Context, src *gtcp.Conn, buf []byte, ticker *time.Ticker) options.BuffIterator

ReadConn 读取

func SetChat

func SetChat(conn *gtcp.Conn, chatID string, ch options.BuffIterator)

SetChat 保存临时通信channel

func SetDeadLine

func SetDeadLine(conn *gtcp.Conn) error

SetDeadLine 设置超时时间点

func UnpackBuff

func UnpackBuff(buf []byte) (chatID string, data []byte, ok bool)

UnpackBuff 解隧道包

func WriteConn

func WriteConn(conn *gtcp.Conn, ch options.BuffIterator, sendB int) (err error)

WriteConn 不带超时,read关闭则关闭

Types

type BalanceHTTP

type BalanceHTTP struct {
	BridgeConns map[string]*HTTPConn
}

BalanceHTTP 负载均衡

func (*BalanceHTTP) Add

func (b *BalanceHTTP) Add(ident *auth.Identity, cc *gtcp.Conn) error

Add 新增连接

func (*BalanceHTTP) Balance

func (b *BalanceHTTP) Balance(c string) (cc *HTTPConn, err error)

Balance 负载均衡

func (*BalanceHTTP) Write

func (b *BalanceHTTP) Write(c string, buf []byte) (bs *HTTPConn, n int, err error)

Send 转发请求

type BalanceTCP

type BalanceTCP struct {
	BridgeConns    map[string]*TCPConn
	BridgeReadChan map[string]chan []byte
}

BalanceTCP 负载均衡

func (*BalanceTCP) Add

func (b *BalanceTCP) Add(ident *auth.Identity, cc *gtcp.Conn) error

Add 添加

type BalanceUDP

type BalanceUDP struct {
	BridgeConns    map[string]*UDPConn
	BridgeReadChan map[string]chan []byte
}

BalanceUDP 负载均衡

func (*BalanceUDP) Add

func (b *BalanceUDP) Add(ident *auth.Identity, cc *gtcp.Conn) error

Add 添加

type HTTPChannel

type HTTPChannel struct {
	// contains filtered or unexported fields
}

HTTPChannel Http 连接

func NewHTTPChanel

func NewHTTPChanel(unionID string, proxy net.TCPListener, bridge net.Conn) *HTTPChannel

NewHTTPChanel 新建HTTP代理服务

func (*HTTPChannel) Close

func (c *HTTPChannel) Close()

Close 关闭通道

func (*HTTPChannel) ListenProxy

func (c *HTTPChannel) ListenProxy()

ListenProxy 监听代理端口

func (*HTTPChannel) PrintInfo

func (c *HTTPChannel) PrintInfo()

PrintInfo 打印

type HTTPConn

type HTTPConn struct {
	Identity   *auth.Identity
	BridgeConn *gtcp.Conn
}

HTTPConn clients

func NewHTTPConn

func NewHTTPConn(ident *auth.Identity, cc *gtcp.Conn) *HTTPConn

NewHTTPConn 新建

type TCPChannel

type TCPChannel struct {
	// contains filtered or unexported fields
}

TCPChannel TCP 连接

type TCPConn

type TCPConn struct {
	Identity   *auth.Identity
	BridgeConn *gtcp.Conn
}

TCPConn clients

func NewTCPConn

func NewTCPConn(ident *auth.Identity, cc *gtcp.Conn) *TCPConn

NewTCPConn 新建

type UDPConn

type UDPConn struct {
	Identity   *auth.Identity
	BridgeConn *gtcp.Conn
}

UDPConn clients

func NewUDPConn

func NewUDPConn(ident *auth.Identity, cc *gtcp.Conn) *UDPConn

NewUDPConn 新建

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL