pingtunnel

package
v0.0.0-...-50c35e5 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SEND_PROTO int = 8
	RECV_PROTO int = 0
)
View Source
const (
	FRAME_MAX_SIZE int = 888
	FRAME_MAX_ID   int = 1000000
)

Variables

View Source
var MyMsg_TYPE_name = map[int32]string{
	0:     "DATA",
	1:     "PING",
	2:     "KICK",
	57005: "MAGIC",
}
View Source
var MyMsg_TYPE_value = map[string]int32{
	"DATA":  0,
	"PING":  1,
	"KICK":  2,
	"MAGIC": 57005,
}

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(addr string, server string, target string, timeout int, key int,
	tcpmode int, tcpmode_buffersize int, tcpmode_maxwin int, tcpmode_resend_timems int, tcpmode_compress int,
	tcpmode_stat int, open_sock5 int, maxconn int, sock5_filter *func(addr string) bool) (*Client, error)

func (*Client) Accept

func (p *Client) Accept() error

func (*Client) AcceptDirectTcpConn

func (p *Client) AcceptDirectTcpConn(conn *net.TCPConn, targetAddr string)

func (*Client) AcceptSock5Conn

func (p *Client) AcceptSock5Conn(conn *net.TCPConn)

func (*Client) AcceptTcp

func (p *Client) AcceptTcp() error

func (*Client) AcceptTcpConn

func (p *Client) AcceptTcpConn(conn *net.TCPConn, targetAddr string)

func (*Client) Addr

func (p *Client) Addr() string

func (*Client) IPAddr

func (p *Client) IPAddr() *net.UDPAddr

func (*Client) LocalAddrToConnMapSize

func (p *Client) LocalAddrToConnMapSize() int

func (*Client) LocalIdToConnMapSize

func (p *Client) LocalIdToConnMapSize() int

func (*Client) RTT

func (p *Client) RTT() time.Duration

func (*Client) RecvPacket

func (p *Client) RecvPacket() uint64

func (*Client) RecvPacketSize

func (p *Client) RecvPacketSize() uint64

func (*Client) Run

func (p *Client) Run() error

func (*Client) SendPacket

func (p *Client) SendPacket() uint64

func (*Client) SendPacketSize

func (p *Client) SendPacketSize() uint64

func (*Client) ServerAddr

func (p *Client) ServerAddr() string

func (*Client) ServerIPAddr

func (p *Client) ServerIPAddr() *net.IPAddr

func (*Client) Stop

func (p *Client) Stop()

func (*Client) TargetAddr

func (p *Client) TargetAddr() string

type ClientConn

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

type MyMsg

type MyMsg struct {
	Id                   string   `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Type                 int32    `protobuf:"varint,2,opt,name=type,proto3" json:"type,omitempty"`
	Target               string   `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"`
	Data                 []byte   `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"`
	Rproto               int32    `protobuf:"zigzag32,5,opt,name=rproto,proto3" json:"rproto,omitempty"`
	Magic                int32    `protobuf:"zigzag32,6,opt,name=magic,proto3" json:"magic,omitempty"`
	Key                  int32    `protobuf:"zigzag32,7,opt,name=key,proto3" json:"key,omitempty"`
	Timeout              int32    `protobuf:"varint,8,opt,name=timeout,proto3" json:"timeout,omitempty"`
	Tcpmode              int32    `protobuf:"varint,9,opt,name=tcpmode,proto3" json:"tcpmode,omitempty"`
	TcpmodeBuffersize    int32    `protobuf:"varint,10,opt,name=tcpmode_buffersize,json=tcpmodeBuffersize,proto3" json:"tcpmode_buffersize,omitempty"`
	TcpmodeMaxwin        int32    `protobuf:"varint,11,opt,name=tcpmode_maxwin,json=tcpmodeMaxwin,proto3" json:"tcpmode_maxwin,omitempty"`
	TcpmodeResendTimems  int32    `protobuf:"varint,12,opt,name=tcpmode_resend_timems,json=tcpmodeResendTimems,proto3" json:"tcpmode_resend_timems,omitempty"`
	TcpmodeCompress      int32    `protobuf:"varint,13,opt,name=tcpmode_compress,json=tcpmodeCompress,proto3" json:"tcpmode_compress,omitempty"`
	TcpmodeStat          int32    `protobuf:"varint,14,opt,name=tcpmode_stat,json=tcpmodeStat,proto3" json:"tcpmode_stat,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*MyMsg) Descriptor

func (*MyMsg) Descriptor() ([]byte, []int)

func (*MyMsg) GetData

func (m *MyMsg) GetData() []byte

func (*MyMsg) GetId

func (m *MyMsg) GetId() string

func (*MyMsg) GetKey

func (m *MyMsg) GetKey() int32

func (*MyMsg) GetMagic

func (m *MyMsg) GetMagic() int32

func (*MyMsg) GetRproto

func (m *MyMsg) GetRproto() int32

func (*MyMsg) GetTarget

func (m *MyMsg) GetTarget() string

func (*MyMsg) GetTcpmode

func (m *MyMsg) GetTcpmode() int32

func (*MyMsg) GetTcpmodeBuffersize

func (m *MyMsg) GetTcpmodeBuffersize() int32

func (*MyMsg) GetTcpmodeCompress

func (m *MyMsg) GetTcpmodeCompress() int32

func (*MyMsg) GetTcpmodeMaxwin

func (m *MyMsg) GetTcpmodeMaxwin() int32

func (*MyMsg) GetTcpmodeResendTimems

func (m *MyMsg) GetTcpmodeResendTimems() int32

func (*MyMsg) GetTcpmodeStat

func (m *MyMsg) GetTcpmodeStat() int32

func (*MyMsg) GetTimeout

func (m *MyMsg) GetTimeout() int32

func (*MyMsg) GetType

func (m *MyMsg) GetType() int32

func (*MyMsg) ProtoMessage

func (*MyMsg) ProtoMessage()

func (*MyMsg) Reset

func (m *MyMsg) Reset()

func (*MyMsg) String

func (m *MyMsg) String() string

func (*MyMsg) XXX_DiscardUnknown

func (m *MyMsg) XXX_DiscardUnknown()

func (*MyMsg) XXX_Marshal

func (m *MyMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MyMsg) XXX_Merge

func (m *MyMsg) XXX_Merge(src proto.Message)

func (*MyMsg) XXX_Size

func (m *MyMsg) XXX_Size() int

func (*MyMsg) XXX_Unmarshal

func (m *MyMsg) XXX_Unmarshal(b []byte) error

type MyMsg_TYPE

type MyMsg_TYPE int32
const (
	MyMsg_DATA  MyMsg_TYPE = 0
	MyMsg_PING  MyMsg_TYPE = 1
	MyMsg_KICK  MyMsg_TYPE = 2
	MyMsg_MAGIC MyMsg_TYPE = 57005
)

func (MyMsg_TYPE) EnumDescriptor

func (MyMsg_TYPE) EnumDescriptor() ([]byte, []int)

func (MyMsg_TYPE) String

func (x MyMsg_TYPE) String() string

type Packet

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

type Server

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

func NewServer

func NewServer(key int, maxconn int, maxprocessthread int, maxprocessbuffer int, connecttmeout int) (*Server, error)

func (*Server) Recv

func (p *Server) Recv(conn *ServerConn, id string, src *net.IPAddr)

func (*Server) RecvTCP

func (p *Server) RecvTCP(conn *ServerConn, id string, src *net.IPAddr)

func (*Server) Run

func (p *Server) Run() error

func (*Server) Stop

func (p *Server) Stop()

type ServerConn

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

Jump to

Keyboard shortcuts

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