-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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: salt prefix support #1454
Conversation
This is working in Electron, untested on Android, and unimplemented on macOS/iOS.
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'm impressed by how quickly you got this together. Thanks!
I have some comments on how we can decouple the platform-specific code from the protocol details.
cordova-plugin-outline/android/java/org/outline/vpn/VpnTunnelService.java
Show resolved
Hide resolved
cordova-plugin-outline/android/java/org/outline/vpn/VpnTunnelService.java
Show resolved
Hide resolved
cordova-plugin-outline/android/aidl/org/outline/shadowsocks/ShadowsocksConfig.aidl
Show resolved
Hide resolved
cordova-plugin-outline/android/java/org/outline/vpn/VpnTunnelService.java
Show resolved
Hide resolved
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 are the Apple builds hitting an Android build error?
This code now builds for Mac and iOS. (I haven't been able to test yet to confirm that it works.)
It looks like this was because the |
cordova-plugin-outline/android/java/org/outline/vpn/VpnTunnelService.java
Outdated
Show resolved
Hide resolved
cordova-plugin-outline/android/java/org/outline/vpn/VpnTunnelService.java
Show resolved
Hide resolved
cordova-plugin-outline/android/java/org/outline/vpn/VpnTunnelService.java
Show resolved
Hide resolved
cordova-plugin-outline/android/java/org/outline/vpn/VpnTunnelService.java
Outdated
Show resolved
Hide resolved
@@ -23,9 +23,10 @@ class OutlineTunnel: NSObject, Codable { | |||
var port: String? | |||
var method: String? | |||
var password: String? | |||
var prefix: String? |
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.
Should this be a byte array instead?
It's usually better to parse things as soon as possible.
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, done. I was not able to see a way for this parser to fail, so the parser tolerates arbitrary codepoints and silently ignores the high byte.
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 think this is in good enough shape that we can submit and release for broader testing.
Thanks. FYI, this is blocked on Jigsaw-Code/outline-go-tun2socks#98. |
Approved the other PR as well! |
Note: This PR still has the Android APK in it. That needs to be deleted before squash-and-merge to avoid polluting |
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.
Let's remove the APK before submitting. Squashing sounds good.
This is an experimental version of Outline with "custom salt prefix" support, currently working on Windows, Linux, and Android. It has not yet been tested on macOS/iOS. A pre-built APK is available for Android.
Custom salt prefixes are experimental and are not as secure as standard Outline, so this version should be used only for testing.
To use the prefix feature with Dynamic Keys, add a
"prefix"
key to the JSON object, with a string value representing the prefix you want. (You can use escape codes like\xFF
to represent non-printable byte values.) The prefix is a freeform string of up to 32 bytes, each represented as a unicode codepoint in the U+0 to U+FF range.To use this feature with
ss://
Access Keys, add a URL parameter like&prefix=...
to the ss:// URL's query parameters, so that the URL looks like.../?outline=1&prefix=OUTLINE#Name-of-the-server
. You must use theencodeURIComponent()
function to convert your prefix into escaped form suitable for inclusion in a URL.Possible prefixes of interest (note: longer prefixes are less secure):
"POST "
POST%20
"HTTP/1.1"
HTTP%2F1.1
"POST / HTTP/1.1"
POST%20%2F%20HTTP%2F1.1
"GET / HTTP/1.1\r\n\r\n"
GET%20%2F%20HTTP%2F1.1%0D%0A%0D%0A
"\u0016\u0003\u0001\u0002\u0000"
%16%03%01%02%00
More potentially useful prefixes are mentioned here. Note that some prefixes may be more effective on specific port numbers.