Skip to content
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

Add proxyless censorship resillience #2711

Open
fortuna opened this issue Apr 19, 2024 · 5 comments
Open

Add proxyless censorship resillience #2711

fortuna opened this issue Apr 19, 2024 · 5 comments
Assignees
Labels
bug Something isn't working correctly triage Should be triaged through the triage board

Comments

@fortuna
Copy link

fortuna commented Apr 19, 2024

My understanding is that the OONI reporting API has been blocked in China.

It seems like you may have Psiphon or Tor as fallbacks. You can add new alternatives that don't require setting up a tunnel.

For DNS-based blocking, you can use the Outline SDK dns package to create encrypted DNS resolvers and dialers that use Happy Eyeballs. You can easily implement your client.Resolver interface.

For SNI-based blocking, you can use the tlsfrag package to use TLS Record Fragmentation, which works in Russia, China and Iran.

Note that you can combine them. A Dialer can do encrypted DNS and TLS record fragmentation. You may find our FuncStreamDialer useful for creating anonymous StreamDialers that wraps behavior.

In our extensions module, we have a smart dialer, which tries different DNS and TLS strategies to find one that works for a list of domain, usually within 1-2 seconds. Here are example runs in Russia and Iran.

You can probably integrate all of that via the Client.HTTPClient. Our fetch example app illustrates how to do that.

If you'd like to integrate as a local proxy (I see you have a ProxyURL option), you can use our x/httpproxy package.

One great benefit of all of this is that you don't need any infrastructure. However, you also have the options to run Outline Servers and have them as fallback options as well.

@fortuna fortuna added bug Something isn't working correctly triage Should be triaged through the triage board labels Apr 19, 2024
@bassosimone
Copy link
Contributor

Nice, thank you for pointing this out! It seems we were working in similar directions, in that we're also doing happy eyeballs and trying different strategies and caching what works. I will take a look at your implementation and see what we can learn from it and whether there's code with can integrate (with attribution!) to improve how we're doing. I'd rather avoid adding external dependencies at this time, since we already have significant issues with finding out the right version of packages for all dependencies. Thanks again!

@fortuna
Copy link
Author

fortuna commented Apr 22, 2024

The Outline SDK is very lean. We wrote our own code for Shadowsocks, SOCKS5 and Web Proxy. We have very few, small dependencies, and don’t rewrite any dependency, so it shouldn’t give you much trouble.

@fortuna
Copy link
Author

fortuna commented Apr 22, 2024

You may want to check out our strategy finder as well:
https://github.com/Jigsaw-Code/outline-sdk/blob/main/x/smart/stream_dialer.go

@bassosimone
Copy link
Contributor

Thank you!

@fortuna
Copy link
Author

fortuna commented May 10, 2024

I did some more investigation in the OONI implementation.

The transport is injected into the http.Client in Network.NewHTTPClient

The transport is created in network.NewNetwork

This is where the TLS handshake actually happens: https://github.com/ooni/probe-cli/blob/cd2a9f7f73cd9d16ec1d8fa377bd46396afc26f9/internal/enginenetx/httpsdialer.go#L397

@hellais hellais added this to Roadmap Jan 7, 2025
@hellais hellais removed this from Roadmap Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly triage Should be triaged through the triage board
Projects
None yet
Development

No branches or pull requests

2 participants