pong

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VER             byte   = 0
	HEADER_LEN      uint16 = 7
	FRAME_DATA      byte   = 0 //data
	FRAME_CONNECT   byte   = 1 //connect
	FRAME_ASSOCIATE byte   = 3 //udp associate
	FRAME_RELAY     byte   = 5 //udp relay
	FRAME_FINISH    byte   = 7 //finish write
	FRAME_CLOSE     byte   = 8 //close stream
	FRAME_RST       byte   = 9 //rst stream
)

Variables

View Source
var Conn_TimeOut int64 = 1 * 60 * 1000
View Source
var Data_TimeOut int64 = 10 * 1000
View Source
var FrameWriteBuffer = sync.Pool{
	New: func() interface{} {
		buf := make([]byte, Frame_Buf_Size+7)
		return &buf
	},
}
View Source
var Frame_Buf_Size uint16 = 8192
View Source
var Frames = frameCache{
	// contains filtered or unexported fields
}
View Source
var Max_Live int64 = 1 * 60 * 60 * 1000
View Source
var PayloadPool = sync.Pool{
	New: func() interface{} {
		buf := make([]byte, Frame_Buf_Size)
		return &buf
	},
}
View Source
var Peek_Time time.Duration = 30
View Source
var Per_Max_Count int = 30

Functions

func NewLocal

func NewLocal(p *proxy.Proto) proxy.Peer

func NewPong

func NewPong(p *proxy.Proto) pong

func NewRemote

func NewRemote(p *proxy.Proto) proxy.Peer

Types

type Local

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

func (Local) AfterReceive added in v0.9.3

func (l Local) AfterReceive(t *proxy.Tunnel) (err error)

func (Local) AfterSend

func (l Local) AfterSend(t *proxy.Tunnel) (err error)

func (Local) BeforeSend

func (l Local) BeforeSend(t *proxy.Tunnel) (err error)

func (*Local) ClearConn added in v0.9.2

func (p *Local) ClearConn()

func (*Local) Close

func (p *Local) Close() error

func (Local) Handle

func (p Local) Handle(src net.Conn)

func (Local) Hi

func (p Local) Hi(dst net.Conn, ver byte, clientId uuid.UUID) (err error)

*

connection header
+----+-----+-------+
| VER  | CLIENT_ID |
+----+-----+-------+
|  1   |    16     |
+----+-----+-------+

just say who am i, server no response

func (*Local) NewConn added in v0.9.4

func (p *Local) NewConn(conn net.Conn, ver byte, do proxy.Do, isLocal bool) *pconn

func (*Local) Open

func (p *Local) Open(t *proxy.Tunnel) (err error)

override

func (*Local) Stat

func (p *Local) Stat() *proxy.PointStat

func (Local) Who

func (p Local) Who(src net.Conn) (ver byte, err error)

type Remote

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

func (Remote) AfterDial

func (r Remote) AfterDial(t *proxy.Tunnel, err error) error

func (Remote) AfterReceive

func (r Remote) AfterReceive(t *proxy.Tunnel) (err error)

func (Remote) AfterSend added in v0.9.3

func (r Remote) AfterSend(t *proxy.Tunnel) (err error)

func (*Remote) ClearConn added in v0.9.2

func (p *Remote) ClearConn()

func (*Remote) Close

func (p *Remote) Close() error

func (Remote) Handle

func (p Remote) Handle(src net.Conn)

func (Remote) Hi

func (p Remote) Hi(dst net.Conn, ver byte, clientId uuid.UUID) (err error)

*

connection header
+----+-----+-------+
| VER  | CLIENT_ID |
+----+-----+-------+
|  1   |    16     |
+----+-----+-------+

just say who am i, server no response

func (*Remote) NewConn added in v0.9.4

func (p *Remote) NewConn(conn net.Conn, ver byte, do proxy.Do, isLocal bool) *pconn

func (*Remote) Open

func (p *Remote) Open(t *proxy.Tunnel) (err error)

override

func (*Remote) Stat

func (p *Remote) Stat() *proxy.PointStat

func (Remote) Who

func (p Remote) Who(src net.Conn) (ver byte, err error)

Jump to

Keyboard shortcuts

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