From d47ff797d009451f5c2a5b8d0e2fa4e9755e41c1 Mon Sep 17 00:00:00 2001 From: Dirk McCormick Date: Wed, 28 Feb 2018 17:06:31 -0500 Subject: [PATCH] Document namesys options License: MIT Signed-off-by: Dirk McCormick --- namesys/opts/opts.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/namesys/opts/opts.go b/namesys/opts/opts.go index ff7b44c51..63491d683 100644 --- a/namesys/opts/opts.go +++ b/namesys/opts/opts.go @@ -39,26 +39,32 @@ func DefaultResolveOpts() *ResolveOpts { } } +// ResolveOpt is used to set an option type ResolveOpt func(*ResolveOpts) +// Depth is the recursion depth limit func Depth(depth uint) ResolveOpt { return func(o *ResolveOpts) { o.Depth = depth } } +// DhtRecordCount is the number of IPNS records to retrieve from the DHT func DhtRecordCount(count uint) ResolveOpt { return func(o *ResolveOpts) { o.DhtRecordCount = count } } +// DhtTimeout is the amount of time to wait for DHT records to be fetched +// and verified. A zero value indicates that there is no explicit timeout func DhtTimeout(timeout time.Duration) ResolveOpt { return func(o *ResolveOpts) { o.DhtTimeout = timeout } } +// ProcessOpts converts an array of ResolveOpt into a ResolveOpts object func ProcessOpts(opts []ResolveOpt) *ResolveOpts { rsopts := DefaultResolveOpts() for _, option := range opts {