Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidMsg = errors.New("invalid message") ErrMsgRead = errors.New("error reading from connection") ErrMsgLength = errors.New("invalid message length") ErrInvalidToken = errors.New("invalid token") ErrMsgUnmarshal = errors.New("error unmarshalling message") )
View Source
var ( PacketUnknown = PacketType(0x00) PacketLogin = PacketType(0x01) PacketHeartbeat = PacketType(0x02) PacketProxyReq = PacketType(0x03) PacketProxyResp = PacketType(0x04) PacketProxyCancel = PacketType(0x05) PacketExchange = PacketType(0x06) PacketUDPDatagram = PacketType(0x07) )
Functions ¶
Types ¶
type Msg ¶
type Msg interface {
Type() PacketType
}
type MsgExchange ¶
func NewMsgExchange ¶
func NewMsgExchange(connId, typ string) *MsgExchange
func (*MsgExchange) Type ¶
func (m *MsgExchange) Type() PacketType
type MsgHeartbeat ¶
type MsgHeartbeat struct{}
func NewMsgHeartbeat ¶
func NewMsgHeartbeat() *MsgHeartbeat
func (*MsgHeartbeat) Type ¶
func (m *MsgHeartbeat) Type() PacketType
type MsgLogin ¶
type MsgLogin struct { Token string `json:"token"` Version string `json:"version"` Timestamp int64 `json:"timestamp"` }
func NewMsgLogin ¶
func (*MsgLogin) Type ¶
func (m *MsgLogin) Type() PacketType
type MsgProxyReq ¶
type MsgProxyReq struct { RemotePort int `json:"remote_port"` ProxyName string `json:"proxy_name"` Subdomain string `json:"subdomain"` ProxyType string `json:"proxy_type"` }
func NewMsgProxy ¶
func NewMsgProxy(proxyName, subdomain, proxyType string, remotePort int) *MsgProxyReq
func (*MsgProxyReq) Type ¶
func (m *MsgProxyReq) Type() PacketType
type MsgProxyResp ¶
func NewMsgProxyResp ¶
func NewMsgProxyResp(domain, status string) *MsgProxyResp
func (*MsgProxyResp) Type ¶
func (m *MsgProxyResp) Type() PacketType
type MsgUDPDatagram ¶
func NewMsgUDPDatagram ¶
func NewMsgUDPDatagram(addr *net.UDPAddr, payload []byte) *MsgUDPDatagram
func (*MsgUDPDatagram) Type ¶
func (m *MsgUDPDatagram) Type() PacketType
type NewProxyCancel ¶
type NewProxyCancel struct { ProxyName string `json:"proxy_name"` RemotePort int `json:"remote_port"` }
func NewMsgCancel ¶
func NewMsgCancel(token, proxyName string, remotePort int) *NewProxyCancel
func (*NewProxyCancel) Type ¶
func (m *NewProxyCancel) Type() PacketType
type PacketType ¶
type PacketType byte
func (PacketType) String ¶
func (p PacketType) String() string
Click to show internal directories.
Click to hide internal directories.