1 Star 0 Fork 0

zhangjungang/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
config.go 1.02 KB
一键复制 编辑 原始数据 按行查看 历史
package tcp
import (
"errors"
"time"
"github.com/elastic/beats/libbeat/outputs"
"github.com/elastic/beats/libbeat/outputs/transport"
"github.com/elastic/beats/heartbeat/monitors"
)
type Config struct {
Name string `config:"name"`
// check all ports if host does not contain port
Hosts []string `config:"hosts" validate:"required"`
Ports []uint16 `config:"ports"`
Mode monitors.IPSettings `config:",inline"`
Socks5 transport.ProxyConfig `config:",inline"`
// configure tls
TLS *outputs.TLSConfig `config:"ssl"`
Timeout time.Duration `config:"timeout"`
// validate connection
SendString string `config:"check.send"`
ReceiveString string `config:"check.receive"`
}
var DefaultConfig = Config{
Name: "tcp",
Timeout: 16 * time.Second,
Mode: monitors.DefaultIPSettings,
}
func (c *Config) Validate() error {
if c.Socks5.URL != "" {
if c.Mode.Mode != monitors.PingAny && !c.Socks5.LocalResolve {
return errors.New("ping all ips only supported if proxy_use_local_resolver is enabled`")
}
}
return nil
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangjungang/beats.git
git@gitee.com:zhangjungang/beats.git
zhangjungang
beats
beats
v6.1.0

搜索帮助

0d507c66 1850385 C8b1a773 1850385