Document namesys options
License: MIT Signed-off-by: Dirk McCormick <dirkmdev@gmail.com>
Dirk McCormick committed
Feb 28, 2018 at 17:06 UTC
d47ff797d009451f5c2a5b8d0e2fa4e9755e41c1
1 file changed
+6
namesys/opts/opts.go
+6
@@ -39,26 +39,32 @@ func DefaultResolveOpts() *ResolveOpts {
39
}
40
}
41
42
+// ResolveOpt is used to set an option
43
type ResolveOpt func(*ResolveOpts)
44
45
+// Depth is the recursion depth limit
46
func Depth(depth uint) ResolveOpt {
47
return func(o *ResolveOpts) {
48
o.Depth = depth
49
}
50
}
51
52
+// DhtRecordCount is the number of IPNS records to retrieve from the DHT
53
func DhtRecordCount(count uint) ResolveOpt {
54
return func(o *ResolveOpts) {
55
o.DhtRecordCount = count
56
}
57
}
58
59
+// DhtTimeout is the amount of time to wait for DHT records to be fetched
60
+// and verified. A zero value indicates that there is no explicit timeout
61
func DhtTimeout(timeout time.Duration) ResolveOpt {
62
return func(o *ResolveOpts) {
63
o.DhtTimeout = timeout
64
}
65
}
66
67
+// ProcessOpts converts an array of ResolveOpt into a ResolveOpts object
68
func ProcessOpts(opts []ResolveOpt) *ResolveOpts {
69
rsopts := DefaultResolveOpts()
70
for _, option := range opts {