Skip to content

Commit

Permalink
Improve VmessQRCode json
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Feb 2, 2024
1 parent 57d9d8d commit e1cadc8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 52 deletions.
6 changes: 3 additions & 3 deletions v2rayN/v2rayN/Handler/ShareHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ private static string ShareVmess(ProfileItem item)

VmessQRCode vmessQRCode = new()
{
v = item.configVersion.ToString(),
v = item.configVersion,
ps = item.remarks.TrimEx(),
add = item.address,
port = item.port.ToString(),
port = item.port,
id = item.id,
aid = item.alterId.ToString(),
aid = item.alterId,
scy = item.security,
net = item.network,
type = item.headerType,
Expand Down
58 changes: 9 additions & 49 deletions v2rayN/v2rayN/Mode/VmessQRCode.cs
Original file line number Diff line number Diff line change
@@ -1,84 +1,44 @@
namespace v2rayN.Mode
using System.Text.Json.Serialization;

namespace v2rayN.Mode
{
/// <summary>
/// https://github.com/2dust/v2rayN/wiki/
/// </summary>
[Serializable]
internal class VmessQRCode
{
/// <summary>
///
/// </summary>
public string v { get; set; } = string.Empty;
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
public int v { get; set; } = 2;

/// <summary>
///
/// </summary>
public string ps { get; set; } = string.Empty;

/// <summary>
///
/// </summary>
public string add { get; set; } = string.Empty;

/// <summary>
///
/// </summary>
public string port { get; set; } = string.Empty;
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
public int port { get; set; } = 0;

/// <summary>
///
/// </summary>
public string id { get; set; } = string.Empty;

/// <summary>
///
/// </summary>
public string aid { get; set; } = string.Empty;
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
public int aid { get; set; } = 0;

/// <summary>
///
/// </summary>
public string scy { get; set; } = string.Empty;

/// <summary>
///
/// </summary>
public string net { get; set; } = string.Empty;

/// <summary>
///
/// </summary>
public string type { get; set; } = string.Empty;

/// <summary>
///
/// </summary>
public string host { get; set; } = string.Empty;

/// <summary>
///
/// </summary>
public string path { get; set; } = string.Empty;

/// <summary>
/// TLS
/// </summary>
public string tls { get; set; } = string.Empty;

/// <summary>
/// TLS SNI
/// </summary>
public string sni { get; set; } = string.Empty;

/// <summary>
/// TLS alpn
/// </summary>
public string alpn { get; set; } = string.Empty;

/// <summary>
/// TLS fingerprint
/// </summary>
public string fp { get; set; } = string.Empty;
}
}

0 comments on commit e1cadc8

Please sign in to comment.