Skip to content

Commit

Permalink
Merge pull request ipfs#150 from bigs/docs/dht_client
Browse files Browse the repository at this point in the history
Add explanation to NewDHT/NewDHTClient doc strings
  • Loading branch information
whyrusleeping committed May 30, 2018
2 parents fdb4db8 + bf3ba20 commit f9f7b87
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ type IpfsDHT struct {
plk sync.Mutex
}

// NewDHT creates a new DHT object with the given peer as the 'local' host
// NewDHT creates a new DHT object with the given peer as the 'local' host.
// IpfsDHT's initialized with this function will respond to DHT requests,
// whereas IpfsDHT's initialized with NewDHTClient will not.
func NewDHT(ctx context.Context, h host.Host, dstore ds.Batching) *IpfsDHT {
dht := NewDHTClient(ctx, h, dstore)

Expand All @@ -76,7 +78,9 @@ func NewDHT(ctx context.Context, h host.Host, dstore ds.Batching) *IpfsDHT {
return dht
}

// NewDHTClient creates a new DHT object with the given peer as the 'local' host
// NewDHTClient creates a new DHT object with the given peer as the 'local'
// host. IpfsDHT clients initialized with this function will not respond to DHT
// requests. If you need a peer to respond to DHT requests, use NewDHT instead.
func NewDHTClient(ctx context.Context, h host.Host, dstore ds.Batching) *IpfsDHT {
dht := makeDHT(ctx, h, dstore)

Expand Down

0 comments on commit f9f7b87

Please sign in to comment.