-
Notifications
You must be signed in to change notification settings - Fork 2
/
reliability.go
33 lines (30 loc) · 985 Bytes
/
reliability.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
package i2ptunconf
//i2cp.messageReliability
// GetMessageReliability takes an argument and a default. If the argument differs from the
// default, the argument is always returned. If the argument and default are
// the same and the key exists, the key is returned. If the key is absent, the
// default is returned.
func (c *Conf) GetMessageReliability(arg, def string, label ...string) string {
if arg != def {
return arg
}
//if c.Config == nil {
// return arg
//}
return c.MessageReliability
}
// SetMessageReliability sets the access list type from a config file
func (c *Conf) SetMessageReliability(label ...string) {
if v, ok := c.Get("i2cp.messageReliability", label...); ok {
c.MessageReliability = v
}
if c.MessageReliability != "BestEffort" && c.MessageReliability != "none" {
c.MessageReliability = "none"
}
}
func (c *Conf) reliability() string {
if c.MessageReliability != "" {
return "i2cp.messageReliability=" + c.MessageReliability
}
return ""
}