-
Notifications
You must be signed in to change notification settings - Fork 0
/
parameters.go
59 lines (51 loc) · 2.07 KB
/
parameters.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// SPDX-FileCopyrightText: 2023-2024 Steffen Vogel <[email protected]>
// SPDX-License-Identifier: Apache-2.0
package babel
import (
"net/netip"
"time"
)
// Appendix B. Protocol Parameters
// https://datatracker.ietf.org/doc/html/rfc8966#section-appendix.b
type Parameters struct {
IHUHoldTimeFactor float32
IHUInterval time.Duration
InitialRequestTimeout time.Duration
MulticastHelloInterval time.Duration
RouteExpiryTime time.Duration
SourceGCTime time.Duration
UnicastHelloInterval time.Duration
UpdateInterval time.Duration
UrgentTimeout time.Duration
NominalLinkCost uint16
}
const (
DefaultIHUInterval = 12 * time.Second // 3 * DefaultMulticastHelloInterval
DefaultInitialRequestTimeout = 2 * time.Second
DefaultMulticastHelloInterval = 4 * time.Second
DefaultRouteExpiryTime = 56 // 3.5 * DefaultUpdateInterval
DefaultSourceGCTime = 3 * time.Minute
DefaultUnicastHelloInterval = 0 // infinitive, no Hellos are send
DefaultUpdateInterval = 16 * time.Second // 4 * DefaultMulticastHelloInterval
DefaultUrgentTimeout = 200 * time.Millisecond
DefaultIHUHoldTimeFactor = 3.5 // times the advertised IHU interval
DefaultWiredLinkCost = 96
)
var DefaultParameters = Parameters{
MulticastHelloInterval: DefaultMulticastHelloInterval,
UnicastHelloInterval: DefaultUnicastHelloInterval,
UpdateInterval: DefaultUpdateInterval,
IHUInterval: DefaultIHUInterval,
RouteExpiryTime: DefaultRouteExpiryTime,
InitialRequestTimeout: DefaultInitialRequestTimeout,
UrgentTimeout: DefaultUrgentTimeout,
SourceGCTime: DefaultSourceGCTime,
NominalLinkCost: DefaultWiredLinkCost, // TODO: estimated using ETX on wireless links; 2-out-of-3 with C=96 on wired links.
}
// 5. IANA Considerations
// https://datatracker.ietf.org/doc/html/rfc8966#name-iana-considerations
var (
Port = 6697
MulticastGroupIPv6 = netip.MustParseAddr("ff02::1:6")
MulticastGroupIPv4 = netip.MustParseAddr("224.0.0.111")
)