forked from brave/zerotrace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
42 lines (39 loc) · 1.29 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package zerotrace
import "time"
// Config holds configuration options for the ZeroTrace object.
type Config struct {
// NumProbes determines the number of probes we're sending for a given TTL.
NumProbes int
// TTLStart determines the TTL at which we start sending trace packets.
TTLStart int
// TTLEnd determines the TTL at which we stop sending trace packets.
TTLEnd int
// SnapLen determines the number of bytes per frame that we want libpcap to
// capture. 500 bytes is enough for ICMP TTL exceeded packets.
SnapLen int32
// PktBufTimeout determines the time we're willing to wait for packets to
// accumulate in our receive buffer.
PktBufTimeout time.Duration
// Interface determines the network interface that we're going to use to
// listen for incoming network packets.
Interface string
}
// NewDefaultConfig returns a configuration object containing the following
// defaults. *Note* that you probably need to change the networking interface.
//
// NumProbes: 3
// TTLStart: 5
// TTLEnd: 32
// SnapLen: 500
// PktBufTimeout: time.Millisecond * 10
// Interface: "eth0"
func NewDefaultConfig() *Config {
return &Config{
NumProbes: 3,
TTLStart: 5,
TTLEnd: 32,
SnapLen: 500,
PktBufTimeout: time.Millisecond * 10,
Interface: "eth0",
}
}