Beispiel #1
0
        public IEnumerable <Server> ParseUri(string text)
        {
            var data = new VMess();

            string s;

            try
            {
                s = ShareLink.URLSafeBase64Decode(text.Substring(8));
            }
            catch
            {
                return(V2rayUtils.ParseVUri(text));
            }

            V2rayNSharing vmess = JsonSerializer.Deserialize <V2rayNSharing>(s,
                                                                             new JsonSerializerOptions {
                NumberHandling = JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString
            }) !;

            data.Remark           = vmess.ps;
            data.Hostname         = vmess.add;
            data.Port             = vmess.port;
            data.UserID           = vmess.id;
            data.AlterID          = vmess.aid;
            data.TransferProtocol = vmess.net;
            data.FakeType         = vmess.type;

            if (data.TransferProtocol == "quic")
            {
                if (VMessGlobal.QUIC.Contains(vmess.host !))
                {
                    data.QUICSecure = vmess.host;
                    data.QUICSecret = vmess.path;
                }
            }
            else
            {
                data.Host = vmess.host;
                data.Path = vmess.path;
            }

            data.TLSSecureType = vmess.tls;
            data.EncryptMethod = "auto"; // V2Ray 加密方式不包括在链接中,主动添加一个

            return(new[] { data });
        }
Beispiel #2
0
    public IEnumerable <Server> ParseUri(string text)
    {
        var data = new VMessServer();

        string s;

        try
        {
            s = ShareLink.URLSafeBase64Decode(text.Substring(8));
        }
        catch
        {
            return(V2rayUtils.ParseVUri(text));
        }

        V2rayNJObject vmess = JsonSerializer.Deserialize <V2rayNJObject>(s,
                                                                         new JsonSerializerOptions {
            NumberHandling = JsonNumberHandling.WriteAsString | JsonNumberHandling.AllowReadingFromString
        }) !;

        data.Remark           = vmess.ps;
        data.Hostname         = vmess.add;
        data.EncryptMethod    = vmess.scy;
        data.Port             = vmess.port;
        data.UserID           = vmess.id;
        data.AlterID          = vmess.aid;
        data.TransferProtocol = vmess.net;
        data.FakeType         = vmess.type;
        data.ServerName       = vmess.sni;

        if (data.TransferProtocol == "quic")
        {
            data.QUICSecure = vmess.host;
            data.QUICSecret = vmess.path;
        }
        else
        {
            data.Host = vmess.host;
            data.Path = vmess.path;
        }

        data.TLSSecureType = vmess.tls;

        return(new[] { data });
    }
Beispiel #3
0
        public IEnumerable <Server> ParseUri(string text)
        {
            var data = new VMess();

            V2rayNSharing vmess;

            try
            {
                vmess = JsonSerializer.Deserialize <V2rayNSharing>(ShareLink.URLSafeBase64Decode(text.Substring(8)));
            }
            catch
            {
                return(V2rayUtils.ParseVUri(text));
            }

            data.Remark           = vmess.ps;
            data.Hostname         = vmess.add;
            data.Port             = ushort.Parse(vmess.port);
            data.UserID           = vmess.id;
            data.AlterID          = int.Parse(vmess.aid);
            data.TransferProtocol = vmess.net;
            data.FakeType         = vmess.type;

            if (data.TransferProtocol == "quic")
            {
                if (VMessGlobal.QUIC.Contains(vmess.host))
                {
                    data.QUICSecure = vmess.host;
                    data.QUICSecret = vmess.path;
                }
            }
            else
            {
                data.Host = vmess.host;
                data.Path = vmess.path;
            }

            data.TLSSecureType = vmess.tls;
            data.EncryptMethod = "auto"; // V2Ray 加密方式不包括在链接中,主动添加一个

            return(new[] { data });
        }
Beispiel #4
0
 public IEnumerable <Server> ParseUri(string text)
 {
     return(V2rayUtils.ParseVUri(text));
 }