1 Star 0 Fork 0

siliworks / common-package

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
module.go 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
545403892 提交于 2023-06-06 00:08 . init
package module
import (
"gitee.com/siliworks/common-package/collector/module/client"
"gitee.com/siliworks/common-package/collector/module/server"
"time"
)
func NewClientOptions() *client.Options {
return &client.Options{
Address: "",
KeepAlive: 10 * time.Second,
AuthenticationEnable: true,
AuthenticationKey: "",
AutoReconnect: false,
ReconnectInterval: 5 * time.Second,
OnConnect: nil,
OnDisconnect: nil,
OnData: nil,
OnReconnecting: nil,
}
}
func NewServerTcpOptions() *server.Options {
return &server.Options{
Address: ":8084",
KeepAlive: 30 * time.Second,
AuthenticationEnable: true,
ClientConnectCap: 100,
ClientSameIPCap: 10,
BlacklistDuration: 60,
AuthenticationFailedCap: 3,
OnConnect: nil,
OnDisconnect: nil,
OnData: nil,
OnAuthentication: nil,
}
}
func NewServerUdpOptions() *server.Options {
return &server.Options{
Address: ":8085",
KeepAlive: 30 * time.Second,
AuthenticationEnable: true,
ClientConnectCap: 100,
ClientSameIPCap: 10,
BlacklistDuration: 60,
AuthenticationFailedCap: 3,
OnConnect: nil,
OnDisconnect: nil,
OnData: nil,
OnAuthentication: nil,
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/siliworks/common-package.git
git@gitee.com:siliworks/common-package.git
siliworks
common-package
common-package
v1.0.3

搜索帮助

344bd9b3 5694891 D2dac590 5694891