Qv2ray icon indicating copy to clipboard operation
Qv2ray copied to clipboard

add trojan link & outbound support

Open dwuggh opened this issue 2 years ago • 5 comments

The v2ray-core supports the trojan editor now, this PR makes qv2ray can edit trojan outbounds, with simple link formatting.

dwuggh avatar Nov 22 '22 05:11 dwuggh

with this PR merged, can we fully sunset the Trojan plugin? If so, users have to disable that manually.

moodyhunter avatar Nov 22 '22 14:11 moodyhunter

As far as I can remember, the default port value should be zero or it would be "shaken" as if no port is specified. For share link part, you may want to take a look at https://github.com/Qv2ray/QvPlugin-Trojan/issues/18. It's better to use QUrl rather than parsing manually. TLS should be madatory but the code seems to be importing a cleartext (security type none) config.

dyhkwong avatar Nov 22 '22 15:11 dyhkwong

Defaulting the port to 443, and then use A(port) instead of F(..., port) in the JSONSTRUCT_REGISTER macro would do the trick :)

Yes, switching to QUrl is always a better idea.

moodyhunter avatar Nov 22 '22 15:11 moodyhunter

I'm not familiar with share links, is trojan://p@ss:ω[email protected]:443#evil a valid share link? As in the docmument, the password can be any string. The above url seems cannot be correctly parsed by QUrl. Can we tolerate with this type of misbehavior?

dwuggh avatar Nov 23 '22 05:11 dwuggh

Defaulting the port to 443, and then use A(port) instead of F(..., port) in the JSONSTRUCT_REGISTER macro would do the trick :)

Did you mean changing code to the following, iiuc?

    int port = 443;
    JSONSTRUCT_COMPARE(TrojanServerObject, address, password)
    JSONSTRUCT_REGISTER(TrojanServerObject, A(port), F(address, password))

dwuggh avatar Nov 23 '22 05:11 dwuggh