public string GetShareLink(Server s) { if (Global.Settings.V2RayConfig.V2rayNShareLink) { var server = (VMess)s; var vmessJson = JsonSerializer.Serialize(new V2rayNSharing { v = 2, ps = server.Remark, add = server.Hostname, port = server.Port, scy = server.EncryptMethod, id = server.UserID, aid = server.AlterID, net = server.TransferProtocol, type = server.FakeType, host = server.Host ?? "", path = server.Path ?? "", tls = server.TLSSecureType, sni = server.ServerName ?? "" }, new JsonSerializerOptions { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping }); return("vmess://" + ShareLink.URLSafeBase64Encode(vmessJson)); } return(V2rayUtils.GetVShareLink(s)); }
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.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 }); }
public IEnumerable <Server> ParseUri(string text) { return(V2rayUtils.ParseVUri(text)); }
public string GetShareLink(Server s) { return(V2rayUtils.GetVShareLink(s, "vless")); }