mux

package
v0.19.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

This module is used for port reuse Distinguish client, web manager , HTTP and HTTPS according to the difference of protocol

Index

Constants

View Source
const (
	MUX_PING_FLAG int32 = iota
	MUX_NEW_CONN_OK
	MUX_NEW_CONN_Fail
	MUX_NEW_MSG
	MUX_MSG_SEND_OK
	MUX_NEW_CONN
	MUX_PING
	MUX_CONN_CLOSE
	MUX_PING_RETURN
)
View Source
const (
	HTTP_GET        = 716984
	HTTP_POST       = 807983
	HTTP_HEAD       = 726965
	HTTP_PUT        = 808585
	HTTP_DELETE     = 686976
	HTTP_CONNECT    = 677978
	HTTP_OPTIONS    = 798084
	HTTP_TRACE      = 848265
	CLIENT          = 848384
	ACCEPT_TIME_OUT = 10
)

Variables

This section is empty.

Functions

func NewBufNode added in v0.18.1

func NewBufNode(buf []byte, l int) *bufNode

func NewConn

func NewConn(connId int32, mux *Mux) *conn

func NewConnMap

func NewConnMap() *connMap

func NewQueue added in v0.18.1

func NewQueue() *sliceEntry

func ReadLenBytes

func ReadLenBytes(buf []byte, r io.Reader) (int, error)

read bytes by length

func WriteLenBytes

func WriteLenBytes(buf []byte, w io.Writer) (int, error)

write bytes with int32 length

Types

type Element added in v0.18.1

type Element *bufNode

type Mux

type Mux struct {
	net.Listener

	IsClose bool

	sync.Mutex
	// contains filtered or unexported fields
}

func NewMux

func NewMux(c net.Conn, connType string) *Mux

func (*Mux) Accept

func (s *Mux) Accept() (net.Conn, error)

func (*Mux) Addr

func (s *Mux) Addr() net.Addr

func (*Mux) Close

func (s *Mux) Close() error

func (*Mux) NewConn

func (s *Mux) NewConn() (*conn, error)

type PortConn added in v0.18.1

type PortConn struct {
	Conn net.Conn
	// contains filtered or unexported fields
}

func (*PortConn) Close added in v0.18.1

func (pConn *PortConn) Close() error

func (*PortConn) LocalAddr added in v0.18.1

func (pConn *PortConn) LocalAddr() net.Addr

func (*PortConn) Read added in v0.18.1

func (pConn *PortConn) Read(b []byte) (n int, err error)

func (*PortConn) RemoteAddr added in v0.18.1

func (pConn *PortConn) RemoteAddr() net.Addr

func (*PortConn) SetDeadline added in v0.18.1

func (pConn *PortConn) SetDeadline(t time.Time) error

func (*PortConn) SetReadDeadline added in v0.18.1

func (pConn *PortConn) SetReadDeadline(t time.Time) error

func (*PortConn) SetWriteDeadline added in v0.18.1

func (pConn *PortConn) SetWriteDeadline(t time.Time) error

func (*PortConn) Write added in v0.18.1

func (pConn *PortConn) Write(b []byte) (n int, err error)

type PortListener added in v0.18.1

type PortListener struct {
	net.Listener
	// contains filtered or unexported fields
}

func NewPortListener added in v0.18.1

func NewPortListener(connCh chan *PortConn, addr net.Addr) *PortListener

func (*PortListener) Accept added in v0.18.1

func (pListener *PortListener) Accept() (net.Conn, error)

func (*PortListener) Addr added in v0.18.1

func (pListener *PortListener) Addr() net.Addr

func (*PortListener) Close added in v0.18.1

func (pListener *PortListener) Close() error

type PortMux added in v0.18.1

type PortMux struct {
	net.Listener
	// contains filtered or unexported fields
}

func NewPortMux added in v0.18.1

func NewPortMux(port int, managerHost string) *PortMux

func (*PortMux) Close added in v0.18.1

func (pMux *PortMux) Close() error

func (*PortMux) GetClientListener added in v0.18.1

func (pMux *PortMux) GetClientListener() net.Listener

func (*PortMux) GetHttpListener added in v0.18.1

func (pMux *PortMux) GetHttpListener() net.Listener

func (*PortMux) GetHttpsListener added in v0.18.1

func (pMux *PortMux) GetHttpsListener() net.Listener

func (*PortMux) GetManagerListener added in v0.18.1

func (pMux *PortMux) GetManagerListener() net.Listener

func (*PortMux) Start added in v0.18.1

func (pMux *PortMux) Start() error

type Queue added in v0.18.1

type Queue interface {
	Push(e Element) //向队列中添加元素
	Pop() Element   //移除队列中最前面的元素
	Clear() bool    //清空队列
	Size() int      //获取队列的元素个数
	IsEmpty() bool  //判断队列是否是空
}

Jump to

Keyboard shortcuts

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