| 1234567891011121314151617181920212223242526272829303132 |
- package config
- // 全局配置
- type Config struct {
- ConnectTimeout int // 没有收到数据包的连接超时时间(ms)
- PingInterval int // 发送ping包的时间间隔,前提是没有收到数据包(ms)
- WriteWait int // 写入网络数据等待最长时间(ms)
- ReadWait int // 获取命令数据超时时间 (ms)
- LongReadWait int // 长时间等待读取数据的超时时间(ms)
- CleanDeadConnectWait int // 清理异常的连接(ms)
- PrintPing bool // 打印连接ping包
- PrintMsg bool // 打印数据包
- ProxyTimeout int // 客户端检测是否使用代理连接,如果是则进行直连尝试(ms)
- ConnectCheck int // 客户端重连检测周期(ms)
- }
- // 获取实例好的配置
- func NewConfig() *Config {
- // 配置基础的数据
- return &Config{
- ConnectTimeout: 30 * 1000,
- PingInterval: 61 * 1000,
- WriteWait: 60 * 1000,
- ReadWait: 30 * 1000,
- LongReadWait: 150 * 1000,
- CleanDeadConnectWait: 3600 * 1000,
- PrintPing: false,
- PrintMsg: true,
- ProxyTimeout: 3600 * 1000,
- ConnectCheck: 600 * 1000,
- }
- }
|