dev7dev / V2ray-Android

A simple Java module with sample source for implementing V2ray/Xray on Android.
37 stars 12 forks source link

vmess to json #4

Closed huonie closed 7 months ago

huonie commented 12 months ago

Hello, I want to add a vmess to json class in the app, how to do it, because it is too troublesome to convert to json every time

dev7dev commented 11 months ago

Hello Unfortunately, due to busy work, I cannot add this option to the library at the moment. But I can guide you. As you probably know, the vmess links are a base64 summary of the outbound part of JSON config. For example: this vmess uri :

vmess://eyJhZGQiOiIxLjEuMS4xIiwiYWlkIjoiMCIsImhvc3QiOiIiLCJpZCI6IjkwYTU0NGM2LTcwYjUtNDZjMC1kZGQzLTdkZWQ3ZTBmOTA3MiIsIm5ldCI6ImdycGMiLCJwYXRoIjoiIiwicG9ydCI6IjQ0NCIsInBzIjoiZXhhbXBsZS1ncnBjIiwic2N5IjoiYXV0byIsInNuaSI6IiIsInRscyI6IiIsInR5cGUiOiJub25lIiwidiI6IjIifQ==

have this information:

{ "add":"1.1.1.1", "aid":"0", "host":"", "id":"90a544c6-70b5-46c0-ddd3-7ded7e0f9072", "net":"grpc", "path":"", "port":"444", "ps":"example-grpc", "scy":"auto", "sni":"", "tls":"", "type":"none", "v":"2" }

Now you can create a complete JSON by combining a raw default JSON that has basic and default information with the same information that was in the vmess link.

If you do this, we will be happy if you push it for us so that others can use it.