Categorygithub.com/Eresh-tech/smgn
modulepackage
0.0.0-20240822151632-80d3ddb3b9e9
Repository: https://github.com/eresh-tech/smgn.git
Documentation: pkg.go.dev

# README

smgn

简述

smgn是一个基于linux下epoll的网络框架,可以配置处理网络事件的goroutine数量,相比golang原生库,在海量链接下,可以减少goroutine的开销,从而减少系统资源占用。

支持功能

1.tcp拆包粘包
支持多种编解码方式,使用sync.pool申请读写使用的字节数组,减少内存申请开销以及GC压力。
2.客户端超时踢出
可以设置超时时间,smgn会定时检测超出超时的TCP连接(在指定时间内没有发送数据的连接),进行释放。

# Packages

No description provided by the author
No description provided by the author

# Functions

No description provided by the author
NewServer 创建server服务器.
No description provided by the author
No description provided by the author
WithAcceptGNum 设置建立连接的goroutine数量.
WithDecoder 设置解码器.
WithEncoder 设置解码器.
WithIOEventQueueLen 设置IO事件队列长度,默认值是1024.
WithIOGNum 设置处理IO的goroutine数量.
WithReadBufferLen 设置缓存区大小.
WithTimeout 设置TCP超时检查的间隔时间以及超时时间.

# Constants

No description provided by the author
No description provided by the author
断开连接.
数据流入.
检测到超时.

# Variables

No description provided by the author

# Structs

Conn 客户端长连接.
Server TCP 服务.

# Interfaces

No description provided by the author
Option设计模式.