-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arp #182
Arp #182
Conversation
inputs/arp_packet/arp_packet.go
Outdated
var ( | ||
snapshot_len int32 = 1024 | ||
promiscuous bool = false | ||
timeout time.Duration = 30 * time.Second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
promiscuous、timeout 作为 instance的配置是不是好点
inputs/arp_packet/arp_packet.go
Outdated
var err error | ||
ins.EthHandle, err = pcap.OpenLive(ins.Ethdevice, snapshot_len, promiscuous, timeout) | ||
if err != nil { | ||
log.Fatal(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不能用log.Fatal(err),这个方法内部会直接panic。
inputs/arp_packet/arp_packet.go
Outdated
return types.ErrInstancesEmpty | ||
} | ||
go ins.arpStat() | ||
fmt.Println("I! start arp stat") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不用fmt打日志,用log.Println("I! start arp stat")
下面代码里打印日志的地方也是一样的问题
inputs/arp_packet/arp_packet.go
Outdated
sourceAddr := sip.String() | ||
dip = arp.DstProtAddress | ||
if sourceAddr == ins.LocalIP { | ||
fmt.Println("send req") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这行日志有点多余,可以优化一下
LGTM |
No description provided.