-
Notifications
You must be signed in to change notification settings - Fork 61
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
feat: introduce address override #155
Conversation
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.
Code looks good, but the naming is a little bit confusing because override
can mean a lot of things. Maybe domain-name-override
, or resolve-host
, or replace-target-domain
would sound better?
return func(address string) (string, error) { | ||
host, port, err := net.SplitHostPort(address) | ||
if err != nil { | ||
return "", fmt.Errorf("address is not valid host:port: %w", err) |
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.
Instead of returning an error, we may also return hostOverride + ":" + portOverride
here if hostOverride != "" && portOverride != ""
.
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
Co-authored-by: J. Yi <[email protected]>
Comments addressed. On the naming, it means "address override". We can override the host or the port, so names with "domain" or "host" are not the right scope. "Resolve" also doesn't apply, since we can override the host with a domain. I thought about using "map", but there's no key to lookup. Perhaps
|
return func(address string) (string, error) { | ||
host, port, err := net.SplitHostPort(address) | ||
if err != nil { | ||
return "", fmt.Errorf("address is not valid host:port: %w", err) |
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
@@ -143,7 +145,7 @@ The [`fetch` tool](https://pkg.go.dev/github.com/Jigsaw-Code/outline-sdk/x/examp | |||
a URL, similar to `curl`. The example below would bypass blocking of `meduza.io` in Russia: | |||
|
|||
```console | |||
$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/fetch@latest -transport "tlsfrag:1" -method HEAD -v -address "cloudflare.net" https://meduza.io/ | |||
$ go run github.com/Jigsaw-Code/outline-sdk/x/examples/fetch@latest -transport "override:host=cloudflare.net|tlsfrag:1" -method HEAD -v https://meduza.io/ |
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 updated the examples to show that we don't need an application change anymore with override
.
What I'm worried about the naming |
This is a Dialer specification. The only thing a Dialer sees is an address, so there won't be a need to specify other overrides, unless we introduce some sort of modifier, but that's a whole can of worms. We could use |
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.
Thanks for the contribution! Let's use override
for now.
This is a feature I've been wanting for a while that helps with debugging and can be used to bypass DNS censorship.