-
Notifications
You must be signed in to change notification settings - Fork 12
Conversation
This is an option to instruct the swarm not to dial when opening a new stream. Essential for (non-active) relays that should never attempt any dials in hop streams.
|
||
func WithNoDial(ctx context.Context, src string) { | ||
context.WithValue(ctx, NoDial, src) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, personally, I'd not expose the NoDial
var but instead expose a GetNoDial(ctx) (nodial bool, why string)
function. That way, we can change how we implement all this internally.
For example, we may want to "lift" all of our options into an option struct if we end up chaining contexts too much (searching for a value in a context is O(n)).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I mean, this just comes down to "patterns" but I believe this is the more common pattern.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an option to instruct the swarm not to dial when opening a new stream.
Essential for (non-active) relays that should never attempt any dials in hop streams.