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

fix: ss obfsParams parsing index out of range #976

Merged
merged 5 commits into from
Jan 19, 2024
Merged

fix: ss obfsParams parsing index out of range #976

merged 5 commits into from
Jan 19, 2024

Conversation

snakem982
Copy link

fix: ss obfsParams parsing index out of range
feat: support ss v2ray-plugin parsing
feat: support hy2 schema parsing

feat: support ss v2ray-plugin parsing
feat: support hy2 schema parsing
@H1JK
Copy link
Collaborator

H1JK commented Jan 13, 2024

Where is "hy2" used as the URL scheme for Hysteria 2? Any documentations?

@xream
Copy link

xream commented Jan 13, 2024

@H1JK https://v2.hysteria.network/docs/developers/URI-Scheme/

@H1JK
Copy link
Collaborator

H1JK commented Jan 13, 2024

@snakem982 Is this OK? fcdc47e
I think we should get plugin name from parsed arguments to avoid exceptions like plugin=v2ray-plugin;path=/obfs etc.

@snakem982
Copy link
Author

@snakem982 Is this OK? fcdc47e I think we should get plugin name from parsed arguments to avoid exceptions like plugin=v2ray-plugin;path=/obfs etc.

pluginInfo, _ := url.ParseQuery(strings.ReplaceAll(plugin, ";", "&"))
pluginName := pluginInfo.Get("plugin")

pluginInfo does not contain the field plugin
So it cannot be modified like this

@H1JK
Copy link
Collaborator

H1JK commented Jan 13, 2024

How about add "plugin=" to the start of the string? Or any other solution for this? 🥲

@snakem982
Copy link
Author

How about add "plugin=" to the start of the string? Or any other solution for this? 🥲

If the URL is like this plugin=urlEncode(path=/obfs;v2ray-plugin;)
This won't work

@H1JK
Copy link
Collaborator

H1JK commented Jan 13, 2024

plugin=urlEncode(path=/obfs;v2ray-plugin;)

Is this legal, anyway?

SIP002 says plugin is encoded "the similar format" as "TOR_PT_SERVER_TRANSPORT_OPTIONS". And it is:

Specifies per-PT protocol configuration directives, as a semicolon-separated list of : pairs, where is a PT name and is a k=v string value with options that are to be passed to the transport.
Colons, semicolons, and backslashes MUST be escaped with a backslash.
If there are no arguments that need to be passed to any of PT transport protocols, "TOR_PT_SERVER_TRANSPORT_OPTIONS" MAY be omitted.

Example: TOR_PT_SERVER_TRANSPORT_OPTIONS=scramblesuit:key=banana;automata:rule=110;automata:depth=3

Will pass to 'scramblesuit' the parameter 'key=banana' and to 'automata' the arguments 'rule=110' and 'depth=3'.

The plugin name, however, is a anonymous-like argument and I don't think it is possible to appear in any other positions except the head.

@snakem982
Copy link
Author

Read the document information
Adding "plugin=" at the beginning is a good choice.

@H1JK H1JK merged commit 36ea09e into MetaCubeX:Alpha Jan 19, 2024
@H1JK
Copy link
Collaborator

H1JK commented Jan 19, 2024

Merged. Thanks! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants