Documentation
¶
Index ¶
- Constants
- Variables
- func GetSSLError(errno int) error
- func GetSSLErrorNumber(ssl *C.SSL, ret int) int
- func Write(fd int, msg []byte) (int, error)
- func WriteWithTimeout(fd int, msg []byte, timeout time.Duration) (int, error)
- type Conn
- type EP
- func (ep *EP) Add(fd int) error
- func (ep *EP) AddConnection(fd int, sequenceId int)
- func (ep *EP) AddConnectionSSL(fd int, ssl *SSL, sequenceId int)
- func (ep *EP) Close(fd int) error
- func (ep *EP) CloseAction(sequenceId int, fd int) error
- func (ep *EP) CloseAll()
- func (ep *EP) CloseFd(fd int) error
- func (ep *EP) Delete(fd int) error
- func (ep *EP) DeleteConnection(fd int) bool
- func (ep *EP) DestroyConnection(fd int) error
- func (ep *EP) DisableEpollIn(fd int) error
- func (ep *EP) DisableEpollOut(fd int) error
- func (ep *EP) EnableEpollIn(fd int) error
- func (ep *EP) EnableEpollOut(fd int) error
- func (ep *EP) EstablishConnection(fd int) error
- func (ep *EP) GetBuffer() (*[]byte, error)
- func (ep *EP) GetConnection(fd int) *Conn
- func (ep *EP) GetConnectionAndSequenceId(fd int) (*Conn, int)
- func (ep *EP) GetConnectionCount() int
- func (ep *EP) GetConnectionData(fd int) (interface{}, bool)
- func (ep *EP) GetConnectionSSL(fd int) *SSL
- func (ep *EP) GetConnectionSequenceId(fd int) int
- func (ep *EP) GetConnectionSequenceIdAndSSL(fd int) (int, *SSL)
- func (ep *EP) GetConnectionStatus(fd int) (int, bool)
- func (ep *EP) GetSequenceId() int
- func (ep *EP) InitEpoll(host string, port int) error
- func (ep *EP) InvokeAccept()
- func (ep *EP) InvokeClose(sequenceId int, fd int)
- func (ep *EP) InvokeEpollOut(fd int)
- func (ep *EP) InvokeError(sequenceId int, fd int, code ErrorCode, err error)
- func (ep *EP) InvokeReceive(sequenceId int, fd int, msg *[]byte, n int)
- func (ep *EP) Listen()
- func (ep *EP) PutBuffer(buffer *[]byte)
- func (ep *EP) SetConnectionData(fd int, data interface{}) bool
- func (ep *EP) SetConnectionStatus(fd int, status int) bool
- func (ep *EP) SetEpollEvents(n int)
- func (ep *EP) SetKeepAlive(n int)
- func (ep *EP) SetReadTimeout(n int)
- func (ep *EP) SetReuseAddr(n int)
- func (ep *EP) SetReusePort(n int)
- func (ep *EP) SetWaitTimeout(n int)
- func (ep *EP) SetWriteBuffer(n int)
- func (ep *EP) SetWriteTimeout(n int)
- func (ep *EP) Start(host string, port int)
- func (ep *EP) StartSSL(host string, port int, certFile string, keyFile string)
- func (ep *EP) Stop() error
- func (ep *EP) UpdateConnection(fd int)
- func (ep *EP) UpdateConnectionDataWithFunc(fd int, updateDataFunc UpdateDataFunc) bool
- func (ep *EP) WriteSSL(fd int, msg []byte, n int) (int, int)
- func (ep *EP) WriteSSLWithTimeout(fd int, msg []byte, n int, timeout time.Duration) (int, int)
- type ErrorCode
- type OnAcceptEvent
- type OnCloseEvent
- type OnEpollOutEvent
- type OnErrorEvent
- type OnReceiveEvent
- type OpCode
- type Request
- type SSL
- type UpdateDataFunc
Constants ¶
View Source
const ( EPOLL_EVENTS = unix.EPOLLET EPOLL_EVENTS_EPOLLIN = unix.EPOLLIN | unix.EPOLLET EPOLL_EVENTS_EPOLLOUT = unix.EPOLLIN | unix.EPOLLOUT | unix.EPOLLET )
View Source
const ( DEFAULT_EPOLL_EVENTS = 4096 DEFAULT_EPOLL_READ_TIMEOUT = 6 DEFAULT_EPOLL_WRITE_TIMEOUT = 6 DEFAULT_POOL_MULTIPLE = 6 )
View Source
const ( SSL_ERROR_TIMEOUT = -9 SSL_ERROR_NONE = int(C.SSL_ERROR_NONE) SSL_ERROR_SSL = int(C.SSL_ERROR_SSL) SSL_ERROR_WANT_READ = int(C.SSL_ERROR_WANT_READ) SSL_ERROR_WANT_WRITE = int(C.SSL_ERROR_WANT_WRITE) SSL_ERROR_SYSCALL = int(C.SSL_ERROR_SYSCALL) SSL_ERROR_ZERO_RETURN = int(C.SSL_ERROR_ZERO_RETURN) SSL_ERROR_WANT_CONNECT = int(C.SSL_ERROR_WANT_CONNECT) )
View Source
const (
DEFAULT_C_MALLOC_TRIM_INTERVAL = 5000
)
Variables ¶
View Source
var ( ErrorSSLUnableCreate = errors.New("unable to create SSL connection") ErrorSSLUnknow = errors.New("ssl error unknow") ErrorSSLWantWrite = errors.New("ssl error want write") ErrorSSLWantRead = errors.New("ssl error want read") ErrorSSLZeroReturn = errors.New("ssl error zero return") ErrorSSLWantConnect = errors.New("ssl error want connect") ErrorSSLTimeout = errors.New("ssl error timeout") ErrorSSL = errors.New("ssl error") ErrorSSLSyscall = errors.New("ssl error syscall") )
View Source
var (
ErrorGetPoolBuffer = errors.New("get pool buffer error")
)
View Source
var (
ErrorTemplateNotFound = "%d not found in the list"
)
Functions ¶
func GetSSLError ¶ added in v1.3.8
Types ¶
type EP ¶ added in v1.0.3
type EP struct { Host string Port int Epfd int Fd int Connections *hashmap.HM SSLCtx *C.SSL_CTX IsSSL bool Threads int QueueLength int ReadBuffer int WriteBuffer int EpollEvents int WaitTimeout int ReadTimeout int WriteTimeout int KeepAlive int ReuseAddr int ReusePort int OnAccept OnAcceptEvent OnReceive OnReceiveEvent OnEpollOut OnEpollOutEvent OnClose OnCloseEvent OnError OnErrorEvent // contains filtered or unexported fields }
func (*EP) AddConnection ¶ added in v1.2.0
func (*EP) AddConnectionSSL ¶ added in v1.3.0
func (*EP) DeleteConnection ¶ added in v1.2.0
func (*EP) DestroyConnection ¶ added in v1.2.1
called externally
func (*EP) DisableEpollIn ¶ added in v1.3.8
func (*EP) DisableEpollOut ¶ added in v1.3.8
func (*EP) EnableEpollIn ¶ added in v1.3.8
func (*EP) EnableEpollOut ¶ added in v1.3.8
func (*EP) EstablishConnection ¶ added in v1.2.1
called externally
func (*EP) GetConnection ¶ added in v1.3.0
func (*EP) GetConnectionAndSequenceId ¶ added in v1.3.0
func (*EP) GetConnectionCount ¶ added in v1.3.0
func (*EP) GetConnectionData ¶ added in v1.3.0
func (*EP) GetConnectionSSL ¶ added in v1.3.0
func (*EP) GetConnectionSequenceId ¶ added in v1.2.0
func (*EP) GetConnectionSequenceIdAndSSL ¶ added in v1.3.0
func (*EP) GetConnectionStatus ¶ added in v1.3.0
func (*EP) GetSequenceId ¶ added in v1.1.3
func (*EP) InvokeAccept ¶ added in v1.2.0
func (ep *EP) InvokeAccept()
func (*EP) InvokeClose ¶ added in v1.2.0
func (*EP) InvokeEpollOut ¶ added in v1.3.8
func (*EP) InvokeError ¶ added in v1.2.0
func (*EP) InvokeReceive ¶ added in v1.2.0
func (*EP) Listen ¶ added in v1.0.6
func (ep *EP) Listen()
pure EPOLL, only listening, needs to use ep.Add(fd)
func (*EP) SetConnectionData ¶ added in v1.3.0
func (*EP) SetConnectionStatus ¶ added in v1.3.0
func (*EP) SetEpollEvents ¶ added in v1.1.0
func (*EP) SetKeepAlive ¶ added in v1.0.3
func (*EP) SetReadTimeout ¶ added in v1.2.0
func (*EP) SetReuseAddr ¶ added in v1.3.0
func (*EP) SetReusePort ¶ added in v1.3.0
func (*EP) SetWaitTimeout ¶ added in v1.1.0
func (*EP) SetWriteBuffer ¶ added in v1.2.0
func (*EP) SetWriteTimeout ¶ added in v1.2.0
func (*EP) UpdateConnection ¶ added in v1.2.0
func (*EP) UpdateConnectionDataWithFunc ¶ added in v1.3.0
func (ep *EP) UpdateConnectionDataWithFunc(fd int, updateDataFunc UpdateDataFunc) bool
type ErrorCode ¶
type ErrorCode int
const ( ERROR_UNKNOW ErrorCode = -1 ERROR_ACCEPT ErrorCode = 1 ERROR_ADD_CONNECTION ErrorCode = 2 ERROR_SSL_CONNECTION_CREATE ErrorCode = 3 ERROR_CLOSE_CONNECTION ErrorCode = 4 ERROR_READ ErrorCode = 5 ERROR_SSL_READ ErrorCode = 6 ERROR_SSL_WRITE ErrorCode = 7 ERROR_EPOLL_WAIT ErrorCode = 8 ERROR_STOP ErrorCode = 9 ERROR_POOL_BUFFER ErrorCode = 10 )
type OnAcceptEvent ¶
type OnAcceptEvent func(fd int)
type OnCloseEvent ¶
type OnCloseEvent func(fd int)
type OnEpollOutEvent ¶ added in v1.3.8
type OnEpollOutEvent func(fd int)
type OnErrorEvent ¶
type OnReceiveEvent ¶
type UpdateDataFunc ¶ added in v1.3.0
type UpdateDataFunc func(data interface{})
Click to show internal directories.
Click to hide internal directories.