Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
define Resolver type #83
define Resolver type #83
Changes from 4 commits
5c774e7
8fcde7c
d8fa58d
0997a79
fd39c68
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
A function is unmodifiable. Think about the following scenario:
Unless we decide that all our Resolver implementations are immutable, I would prefer to define it as an interface:
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.
Why would they need to be modifiable? I guess I don't see a reason it shouldn't be immutable
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.
For example Intra allows to you change the DoH server on the fly (without reconnecting).
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.
And switching out the one resolver function with another wouldn't work in that case?
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.
Sure it does. But it also means we will create a new
interface
in the app that wraps around thisfunc
.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.
Do we? Why can't it be a property on an existing
struct
?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.
Well yes, defining a
struct
that wraps around the function, which is OK for a single app.My concern is whether a "stateful"
Resolver
is common across all apps, and how it interacts withStreamDialer
andPacketProxy
.For example, some implementation might maintain a connection to a remote server, then we need to have
Close()
function in theResolver
to prevent resource leak.We can discuss them in the brainstorm meeting, it all depends on the use cases we would like to cover. We might need to consider more stuffs than the
LocalResolver
orshadowsocks.StreamDialer
.Another thing I can think of is the two
Resolve
methods, one withcontext.Context
and one without (similar to GoDialer
'sDial
andDialContext
)? We can discuss whether we should support it too.