mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-03 21:42:11 +00:00
Rename the v2ray configuration class
This commit is contained in:
parent
4fcae44fb7
commit
94cc36a08f
2 changed files with 138 additions and 117 deletions
|
@ -96,24 +96,24 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
v2rayConfig.inbounds = new List<Inbounds>();
|
v2rayConfig.inbounds = new List<Inbounds4Ray>();
|
||||||
|
|
||||||
Inbounds? inbound = GetInbound(_config.inbound[0], Global.InboundSocks, 0, true);
|
Inbounds4Ray? inbound = GetInbound(_config.inbound[0], Global.InboundSocks, 0, true);
|
||||||
v2rayConfig.inbounds.Add(inbound);
|
v2rayConfig.inbounds.Add(inbound);
|
||||||
|
|
||||||
//http
|
//http
|
||||||
Inbounds? inbound2 = GetInbound(_config.inbound[0], Global.InboundHttp, 1, false);
|
Inbounds4Ray? inbound2 = GetInbound(_config.inbound[0], Global.InboundHttp, 1, false);
|
||||||
v2rayConfig.inbounds.Add(inbound2);
|
v2rayConfig.inbounds.Add(inbound2);
|
||||||
|
|
||||||
if (_config.inbound[0].allowLANConn)
|
if (_config.inbound[0].allowLANConn)
|
||||||
{
|
{
|
||||||
if (_config.inbound[0].newPort4LAN)
|
if (_config.inbound[0].newPort4LAN)
|
||||||
{
|
{
|
||||||
Inbounds inbound3 = GetInbound(_config.inbound[0], Global.InboundSocks2, 2, true);
|
Inbounds4Ray inbound3 = GetInbound(_config.inbound[0], Global.InboundSocks2, 2, true);
|
||||||
inbound3.listen = "0.0.0.0";
|
inbound3.listen = "0.0.0.0";
|
||||||
v2rayConfig.inbounds.Add(inbound3);
|
v2rayConfig.inbounds.Add(inbound3);
|
||||||
|
|
||||||
Inbounds inbound4 = GetInbound(_config.inbound[0], Global.InboundHttp2, 3, false);
|
Inbounds4Ray inbound4 = GetInbound(_config.inbound[0], Global.InboundHttp2, 3, false);
|
||||||
inbound4.listen = "0.0.0.0";
|
inbound4.listen = "0.0.0.0";
|
||||||
v2rayConfig.inbounds.Add(inbound4);
|
v2rayConfig.inbounds.Add(inbound4);
|
||||||
|
|
||||||
|
@ -121,10 +121,10 @@ namespace v2rayN.Handler
|
||||||
if (!Utils.IsNullOrEmpty(_config.inbound[0].user) && !Utils.IsNullOrEmpty(_config.inbound[0].pass))
|
if (!Utils.IsNullOrEmpty(_config.inbound[0].user) && !Utils.IsNullOrEmpty(_config.inbound[0].pass))
|
||||||
{
|
{
|
||||||
inbound3.settings.auth = "password";
|
inbound3.settings.auth = "password";
|
||||||
inbound3.settings.accounts = new List<AccountsItem> { new AccountsItem() { user = _config.inbound[0].user, pass = _config.inbound[0].pass } };
|
inbound3.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.inbound[0].user, pass = _config.inbound[0].pass } };
|
||||||
|
|
||||||
inbound4.settings.auth = "password";
|
inbound4.settings.auth = "password";
|
||||||
inbound4.settings.accounts = new List<AccountsItem> { new AccountsItem() { user = _config.inbound[0].user, pass = _config.inbound[0].pass } };
|
inbound4.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.inbound[0].user, pass = _config.inbound[0].pass } };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -141,7 +141,7 @@ namespace v2rayN.Handler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Inbounds? GetInbound(InItem inItem, string tag, int offset, bool bSocks)
|
private Inbounds4Ray? GetInbound(InItem inItem, string tag, int offset, bool bSocks)
|
||||||
{
|
{
|
||||||
string result = Utils.GetEmbedText(Global.v2raySampleInbound);
|
string result = Utils.GetEmbedText(Global.v2raySampleInbound);
|
||||||
if (Utils.IsNullOrEmpty(result))
|
if (Utils.IsNullOrEmpty(result))
|
||||||
|
@ -149,7 +149,7 @@ namespace v2rayN.Handler
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var inbound = Utils.FromJson<Inbounds>(result);
|
var inbound = Utils.FromJson<Inbounds4Ray>(result);
|
||||||
if (inbound == null)
|
if (inbound == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -187,7 +187,8 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
if (item.enabled)
|
if (item.enabled)
|
||||||
{
|
{
|
||||||
routingUserRule(item, v2rayConfig);
|
var item2 = Utils.FromJson<RulesItem4Ray>(Utils.ToJson(item));
|
||||||
|
routingUserRule(item2, v2rayConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +201,8 @@ namespace v2rayN.Handler
|
||||||
var rules = Utils.FromJson<List<RulesItem>>(lockedItem.ruleSet);
|
var rules = Utils.FromJson<List<RulesItem>>(lockedItem.ruleSet);
|
||||||
foreach (var item in rules)
|
foreach (var item in rules)
|
||||||
{
|
{
|
||||||
routingUserRule(item, v2rayConfig);
|
var item2 = Utils.FromJson<RulesItem4Ray>(Utils.ToJson(item));
|
||||||
|
routingUserRule(item2, v2rayConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +215,7 @@ namespace v2rayN.Handler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int routingUserRule(RulesItem rules, V2rayConfig v2rayConfig)
|
private int routingUserRule(RulesItem4Ray rules, V2rayConfig v2rayConfig)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -291,13 +293,13 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Outbounds outbound = v2rayConfig.outbounds[0];
|
Outbounds4Ray outbound = v2rayConfig.outbounds[0];
|
||||||
if (node.configType == EConfigType.VMess)
|
if (node.configType == EConfigType.VMess)
|
||||||
{
|
{
|
||||||
VnextItem vnextItem;
|
VnextItem4Ray vnextItem;
|
||||||
if (outbound.settings.vnext.Count <= 0)
|
if (outbound.settings.vnext.Count <= 0)
|
||||||
{
|
{
|
||||||
vnextItem = new VnextItem();
|
vnextItem = new VnextItem4Ray();
|
||||||
outbound.settings.vnext.Add(vnextItem);
|
outbound.settings.vnext.Add(vnextItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -307,10 +309,10 @@ namespace v2rayN.Handler
|
||||||
vnextItem.address = node.address;
|
vnextItem.address = node.address;
|
||||||
vnextItem.port = node.port;
|
vnextItem.port = node.port;
|
||||||
|
|
||||||
UsersItem usersItem;
|
UsersItem4Ray usersItem;
|
||||||
if (vnextItem.users.Count <= 0)
|
if (vnextItem.users.Count <= 0)
|
||||||
{
|
{
|
||||||
usersItem = new UsersItem();
|
usersItem = new UsersItem4Ray();
|
||||||
vnextItem.users.Add(usersItem);
|
vnextItem.users.Add(usersItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -337,10 +339,10 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Shadowsocks)
|
else if (node.configType == EConfigType.Shadowsocks)
|
||||||
{
|
{
|
||||||
ServersItem serversItem;
|
ServersItem4Ray serversItem;
|
||||||
if (outbound.settings.servers.Count <= 0)
|
if (outbound.settings.servers.Count <= 0)
|
||||||
{
|
{
|
||||||
serversItem = new ServersItem();
|
serversItem = new ServersItem4Ray();
|
||||||
outbound.settings.servers.Add(serversItem);
|
outbound.settings.servers.Add(serversItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -362,10 +364,10 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Socks)
|
else if (node.configType == EConfigType.Socks)
|
||||||
{
|
{
|
||||||
ServersItem serversItem;
|
ServersItem4Ray serversItem;
|
||||||
if (outbound.settings.servers.Count <= 0)
|
if (outbound.settings.servers.Count <= 0)
|
||||||
{
|
{
|
||||||
serversItem = new ServersItem();
|
serversItem = new ServersItem4Ray();
|
||||||
outbound.settings.servers.Add(serversItem);
|
outbound.settings.servers.Add(serversItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -380,14 +382,14 @@ namespace v2rayN.Handler
|
||||||
if (!Utils.IsNullOrEmpty(node.security)
|
if (!Utils.IsNullOrEmpty(node.security)
|
||||||
&& !Utils.IsNullOrEmpty(node.id))
|
&& !Utils.IsNullOrEmpty(node.id))
|
||||||
{
|
{
|
||||||
SocksUsersItem socksUsersItem = new()
|
SocksUsersItem4Ray socksUsersItem = new()
|
||||||
{
|
{
|
||||||
user = node.security,
|
user = node.security,
|
||||||
pass = node.id,
|
pass = node.id,
|
||||||
level = 1
|
level = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
serversItem.users = new List<SocksUsersItem>() { socksUsersItem };
|
serversItem.users = new List<SocksUsersItem4Ray>() { socksUsersItem };
|
||||||
}
|
}
|
||||||
|
|
||||||
outboundMux(node, outbound, false);
|
outboundMux(node, outbound, false);
|
||||||
|
@ -397,10 +399,10 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.VLESS)
|
else if (node.configType == EConfigType.VLESS)
|
||||||
{
|
{
|
||||||
VnextItem vnextItem;
|
VnextItem4Ray vnextItem;
|
||||||
if (outbound.settings.vnext.Count <= 0)
|
if (outbound.settings.vnext.Count <= 0)
|
||||||
{
|
{
|
||||||
vnextItem = new VnextItem();
|
vnextItem = new VnextItem4Ray();
|
||||||
outbound.settings.vnext.Add(vnextItem);
|
outbound.settings.vnext.Add(vnextItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -410,10 +412,10 @@ namespace v2rayN.Handler
|
||||||
vnextItem.address = node.address;
|
vnextItem.address = node.address;
|
||||||
vnextItem.port = node.port;
|
vnextItem.port = node.port;
|
||||||
|
|
||||||
UsersItem usersItem;
|
UsersItem4Ray usersItem;
|
||||||
if (vnextItem.users.Count <= 0)
|
if (vnextItem.users.Count <= 0)
|
||||||
{
|
{
|
||||||
usersItem = new UsersItem();
|
usersItem = new UsersItem4Ray();
|
||||||
vnextItem.users.Add(usersItem);
|
vnextItem.users.Add(usersItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -447,10 +449,10 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Trojan)
|
else if (node.configType == EConfigType.Trojan)
|
||||||
{
|
{
|
||||||
ServersItem serversItem;
|
ServersItem4Ray serversItem;
|
||||||
if (outbound.settings.servers.Count <= 0)
|
if (outbound.settings.servers.Count <= 0)
|
||||||
{
|
{
|
||||||
serversItem = new ServersItem();
|
serversItem = new ServersItem4Ray();
|
||||||
outbound.settings.servers.Add(serversItem);
|
outbound.settings.servers.Add(serversItem);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -479,11 +481,11 @@ namespace v2rayN.Handler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int outboundMux(ProfileItem node, Outbounds outbound, bool enabled)
|
private int outboundMux(ProfileItem node, Outbounds4Ray outbound, bool enabled)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_config.coreBasicItem.muxEnabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
outbound.mux.enabled = true;
|
outbound.mux.enabled = true;
|
||||||
outbound.mux.concurrency = 8;
|
outbound.mux.concurrency = 8;
|
||||||
|
@ -501,7 +503,7 @@ namespace v2rayN.Handler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int boundStreamSettings(ProfileItem node, StreamSettings streamSettings)
|
private int boundStreamSettings(ProfileItem node, StreamSettings4Ray streamSettings)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -526,7 +528,7 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
streamSettings.security = node.streamSecurity;
|
streamSettings.security = node.streamSecurity;
|
||||||
|
|
||||||
TlsSettings tlsSettings = new()
|
TlsSettings4Ray tlsSettings = new()
|
||||||
{
|
{
|
||||||
allowInsecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.coreBasicItem.defAllowInsecure.ToString().ToLower() : node.allowInsecure),
|
allowInsecure = Utils.ToBool(node.allowInsecure.IsNullOrEmpty() ? _config.coreBasicItem.defAllowInsecure.ToString().ToLower() : node.allowInsecure),
|
||||||
alpn = node.GetAlpn(),
|
alpn = node.GetAlpn(),
|
||||||
|
@ -548,7 +550,7 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
streamSettings.security = node.streamSecurity;
|
streamSettings.security = node.streamSecurity;
|
||||||
|
|
||||||
TlsSettings realitySettings = new()
|
TlsSettings4Ray realitySettings = new()
|
||||||
{
|
{
|
||||||
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.coreBasicItem.defFingerprint : node.fingerprint,
|
fingerprint = node.fingerprint.IsNullOrEmpty() ? _config.coreBasicItem.defFingerprint : node.fingerprint,
|
||||||
serverName = sni,
|
serverName = sni,
|
||||||
|
@ -564,7 +566,7 @@ namespace v2rayN.Handler
|
||||||
switch (node.GetNetwork())
|
switch (node.GetNetwork())
|
||||||
{
|
{
|
||||||
case "kcp":
|
case "kcp":
|
||||||
KcpSettings kcpSettings = new()
|
KcpSettings4Ray kcpSettings = new()
|
||||||
{
|
{
|
||||||
mtu = _config.kcpItem.mtu,
|
mtu = _config.kcpItem.mtu,
|
||||||
tti = _config.kcpItem.tti
|
tti = _config.kcpItem.tti
|
||||||
|
@ -576,7 +578,7 @@ namespace v2rayN.Handler
|
||||||
kcpSettings.congestion = _config.kcpItem.congestion;
|
kcpSettings.congestion = _config.kcpItem.congestion;
|
||||||
kcpSettings.readBufferSize = _config.kcpItem.readBufferSize;
|
kcpSettings.readBufferSize = _config.kcpItem.readBufferSize;
|
||||||
kcpSettings.writeBufferSize = _config.kcpItem.writeBufferSize;
|
kcpSettings.writeBufferSize = _config.kcpItem.writeBufferSize;
|
||||||
kcpSettings.header = new Header
|
kcpSettings.header = new Header4Ray
|
||||||
{
|
{
|
||||||
type = node.headerType
|
type = node.headerType
|
||||||
};
|
};
|
||||||
|
@ -588,8 +590,8 @@ namespace v2rayN.Handler
|
||||||
break;
|
break;
|
||||||
//ws
|
//ws
|
||||||
case "ws":
|
case "ws":
|
||||||
WsSettings wsSettings = new();
|
WsSettings4Ray wsSettings = new();
|
||||||
wsSettings.headers = new Headers();
|
wsSettings.headers = new Headers4Ray();
|
||||||
string path = node.path;
|
string path = node.path;
|
||||||
if (!string.IsNullOrWhiteSpace(host))
|
if (!string.IsNullOrWhiteSpace(host))
|
||||||
{
|
{
|
||||||
|
@ -608,7 +610,7 @@ namespace v2rayN.Handler
|
||||||
break;
|
break;
|
||||||
//h2
|
//h2
|
||||||
case "h2":
|
case "h2":
|
||||||
HttpSettings httpSettings = new();
|
HttpSettings4Ray httpSettings = new();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(host))
|
if (!string.IsNullOrWhiteSpace(host))
|
||||||
{
|
{
|
||||||
|
@ -621,11 +623,11 @@ namespace v2rayN.Handler
|
||||||
break;
|
break;
|
||||||
//quic
|
//quic
|
||||||
case "quic":
|
case "quic":
|
||||||
QuicSettings quicsettings = new()
|
QuicSettings4Ray quicsettings = new()
|
||||||
{
|
{
|
||||||
security = host,
|
security = host,
|
||||||
key = node.path,
|
key = node.path,
|
||||||
header = new Header
|
header = new Header4Ray
|
||||||
{
|
{
|
||||||
type = node.headerType
|
type = node.headerType
|
||||||
}
|
}
|
||||||
|
@ -645,7 +647,7 @@ namespace v2rayN.Handler
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "grpc":
|
case "grpc":
|
||||||
GrpcSettings grpcSettings = new()
|
GrpcSettings4Ray grpcSettings = new()
|
||||||
{
|
{
|
||||||
serviceName = node.path,
|
serviceName = node.path,
|
||||||
multiMode = (node.headerType == Global.GrpcmultiMode),
|
multiMode = (node.headerType == Global.GrpcmultiMode),
|
||||||
|
@ -661,9 +663,9 @@ namespace v2rayN.Handler
|
||||||
//tcp
|
//tcp
|
||||||
if (node.headerType == Global.TcpHeaderHttp)
|
if (node.headerType == Global.TcpHeaderHttp)
|
||||||
{
|
{
|
||||||
TcpSettings tcpSettings = new()
|
TcpSettings4Ray tcpSettings = new()
|
||||||
{
|
{
|
||||||
header = new Header
|
header = new Header4Ray
|
||||||
{
|
{
|
||||||
type = node.headerType
|
type = node.headerType
|
||||||
}
|
}
|
||||||
|
@ -736,7 +738,7 @@ namespace v2rayN.Handler
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
//servers.Add("localhost");
|
//servers.Add("localhost");
|
||||||
v2rayConfig.dns = new Mode.Dns
|
v2rayConfig.dns = new Mode.Dns4Ray
|
||||||
{
|
{
|
||||||
servers = servers
|
servers = servers
|
||||||
};
|
};
|
||||||
|
@ -754,13 +756,13 @@ namespace v2rayN.Handler
|
||||||
if (_config.guiItem.enableStatistics)
|
if (_config.guiItem.enableStatistics)
|
||||||
{
|
{
|
||||||
string tag = Global.InboundAPITagName;
|
string tag = Global.InboundAPITagName;
|
||||||
API apiObj = new();
|
API4Ray apiObj = new();
|
||||||
Policy policyObj = new();
|
Policy4Ray policyObj = new();
|
||||||
SystemPolicy policySystemSetting = new();
|
SystemPolicy4Ray policySystemSetting = new();
|
||||||
|
|
||||||
string[] services = { "StatsService" };
|
string[] services = { "StatsService" };
|
||||||
|
|
||||||
v2rayConfig.stats = new Stats();
|
v2rayConfig.stats = new Stats4Ray();
|
||||||
|
|
||||||
apiObj.tag = tag;
|
apiObj.tag = tag;
|
||||||
apiObj.services = services.ToList();
|
apiObj.services = services.ToList();
|
||||||
|
@ -773,8 +775,8 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
if (!v2rayConfig.inbounds.Exists(item => item.tag == tag))
|
if (!v2rayConfig.inbounds.Exists(item => item.tag == tag))
|
||||||
{
|
{
|
||||||
Inbounds apiInbound = new();
|
Inbounds4Ray apiInbound = new();
|
||||||
Inboundsettings apiInboundSettings = new();
|
Inboundsettings4Ray apiInboundSettings = new();
|
||||||
apiInbound.tag = tag;
|
apiInbound.tag = tag;
|
||||||
apiInbound.listen = Global.Loopback;
|
apiInbound.listen = Global.Loopback;
|
||||||
apiInbound.port = Global.statePort;
|
apiInbound.port = Global.statePort;
|
||||||
|
@ -786,12 +788,13 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
if (!v2rayConfig.routing.rules.Exists(item => item.outboundTag == tag))
|
if (!v2rayConfig.routing.rules.Exists(item => item.outboundTag == tag))
|
||||||
{
|
{
|
||||||
RulesItem apiRoutingRule = new()
|
RulesItem4Ray apiRoutingRule = new()
|
||||||
{
|
{
|
||||||
inboundTag = new List<string> { tag },
|
inboundTag = new List<string> { tag },
|
||||||
outboundTag = tag,
|
outboundTag = tag,
|
||||||
type = "field"
|
type = "field"
|
||||||
};
|
};
|
||||||
|
|
||||||
v2rayConfig.routing.rules.Add(apiRoutingRule);
|
v2rayConfig.routing.rules.Add(apiRoutingRule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -891,7 +894,7 @@ namespace v2rayN.Handler
|
||||||
it.allowTest = true;
|
it.allowTest = true;
|
||||||
|
|
||||||
//inbound
|
//inbound
|
||||||
Inbounds inbound = new()
|
Inbounds4Ray inbound = new()
|
||||||
{
|
{
|
||||||
listen = Global.Loopback,
|
listen = Global.Loopback,
|
||||||
port = port,
|
port = port,
|
||||||
|
@ -923,7 +926,7 @@ namespace v2rayN.Handler
|
||||||
v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]);
|
v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]);
|
||||||
|
|
||||||
//rule
|
//rule
|
||||||
RulesItem rule = new()
|
RulesItem4Ray rule = new()
|
||||||
{
|
{
|
||||||
inboundTag = new List<string> { inbound.tag },
|
inboundTag = new List<string> { inbound.tag },
|
||||||
outboundTag = v2rayConfigCopy.outbounds[0].tag,
|
outboundTag = v2rayConfigCopy.outbounds[0].tag,
|
||||||
|
|
|
@ -11,28 +11,28 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 日志配置
|
/// 日志配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Log log { get; set; }
|
public Log4Ray log { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 传入连接配置
|
/// 传入连接配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Inbounds> inbounds { get; set; }
|
public List<Inbounds4Ray> inbounds { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 传出连接配置
|
/// 传出连接配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Outbounds> outbounds { get; set; }
|
public List<Outbounds4Ray> outbounds { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 统计需要, 空对象
|
/// 统计需要, 空对象
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Stats stats { get; set; }
|
public Stats4Ray stats { get; set; }
|
||||||
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public API api { get; set; }
|
public API4Ray api { get; set; }
|
||||||
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Policy policy;
|
public Policy4Ray policy;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DNS 配置
|
/// DNS 配置
|
||||||
|
@ -42,30 +42,30 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 路由配置
|
/// 路由配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Routing routing { get; set; }
|
public Routing4Ray routing { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Stats
|
public class Stats4Ray
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
public class API
|
public class API4Ray
|
||||||
{
|
{
|
||||||
public string tag { get; set; }
|
public string tag { get; set; }
|
||||||
public List<string> services { get; set; }
|
public List<string> services { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Policy
|
public class Policy4Ray
|
||||||
{
|
{
|
||||||
public SystemPolicy system;
|
public SystemPolicy4Ray system;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SystemPolicy
|
public class SystemPolicy4Ray
|
||||||
{
|
{
|
||||||
public bool statsOutboundUplink;
|
public bool statsOutboundUplink;
|
||||||
public bool statsOutboundDownlink;
|
public bool statsOutboundDownlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Log
|
public class Log4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -83,7 +83,7 @@ namespace v2rayN.Mode
|
||||||
public string loglevel { get; set; }
|
public string loglevel { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Inbounds
|
public class Inbounds4Ray
|
||||||
{
|
{
|
||||||
public string tag { get; set; }
|
public string tag { get; set; }
|
||||||
|
|
||||||
|
@ -105,20 +105,20 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Sniffing sniffing { get; set; }
|
public Sniffing4Ray sniffing { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Inboundsettings settings { get; set; }
|
public Inboundsettings4Ray settings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public StreamSettings streamSettings { get; set; }
|
public StreamSettings4Ray streamSettings { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Inboundsettings
|
public class Inboundsettings4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -143,7 +143,7 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<UsersItem> clients { get; set; }
|
public List<UsersItem4Ray> clients { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// VLESS
|
/// VLESS
|
||||||
|
@ -152,10 +152,10 @@ namespace v2rayN.Mode
|
||||||
|
|
||||||
public bool allowTransparent { get; set; }
|
public bool allowTransparent { get; set; }
|
||||||
|
|
||||||
public List<AccountsItem> accounts { get; set; }
|
public List<AccountsItem4Ray> accounts { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UsersItem
|
public class UsersItem4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -188,14 +188,14 @@ namespace v2rayN.Mode
|
||||||
public string flow { get; set; }
|
public string flow { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Sniffing
|
public class Sniffing4Ray
|
||||||
{
|
{
|
||||||
public bool enabled { get; set; }
|
public bool enabled { get; set; }
|
||||||
public List<string> destOverride { get; set; }
|
public List<string> destOverride { get; set; }
|
||||||
public bool routeOnly { get; set; }
|
public bool routeOnly { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Outbounds
|
public class Outbounds4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 默认值agentout
|
/// 默认值agentout
|
||||||
|
@ -210,35 +210,35 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Outboundsettings settings { get; set; }
|
public Outboundsettings4Ray settings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public StreamSettings streamSettings { get; set; }
|
public StreamSettings4Ray streamSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Mux mux { get; set; }
|
public Mux4Ray mux { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Outboundsettings
|
public class Outboundsettings4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<VnextItem> vnext { get; set; }
|
public List<VnextItem4Ray> vnext { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ServersItem> servers { get; set; }
|
public List<ServersItem4Ray> servers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Response response { get; set; }
|
public Response4Ray response { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -251,7 +251,7 @@ namespace v2rayN.Mode
|
||||||
public int? userLevel { get; set; }
|
public int? userLevel { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VnextItem
|
public class VnextItem4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -266,10 +266,10 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<UsersItem> users { get; set; }
|
public List<UsersItem4Ray> users { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ServersItem
|
public class ServersItem4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -314,10 +314,10 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<SocksUsersItem> users { get; set; }
|
public List<SocksUsersItem4Ray> users { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SocksUsersItem
|
public class SocksUsersItem4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -335,7 +335,7 @@ namespace v2rayN.Mode
|
||||||
public int level { get; set; }
|
public int level { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mux
|
public class Mux4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -348,7 +348,7 @@ namespace v2rayN.Mode
|
||||||
public int concurrency { get; set; }
|
public int concurrency { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Response
|
public class Response4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -356,7 +356,7 @@ namespace v2rayN.Mode
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Dns
|
public class Dns4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -364,7 +364,7 @@ namespace v2rayN.Mode
|
||||||
public List<string> servers { get; set; }
|
public List<string> servers { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Routing
|
public class Routing4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -379,10 +379,28 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<RulesItem> rules { get; set; }
|
public List<RulesItem4Ray> rules { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StreamSettings
|
[Serializable]
|
||||||
|
public class RulesItem4Ray
|
||||||
|
{
|
||||||
|
public string type { get; set; }
|
||||||
|
|
||||||
|
public string port { get; set; }
|
||||||
|
|
||||||
|
public List<string> inboundTag { get; set; }
|
||||||
|
|
||||||
|
public string outboundTag { get; set; }
|
||||||
|
|
||||||
|
public List<string> ip { get; set; }
|
||||||
|
|
||||||
|
public List<string> domain { get; set; }
|
||||||
|
|
||||||
|
public List<string> protocol { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class StreamSettings4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -397,45 +415,45 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TlsSettings tlsSettings { get; set; }
|
public TlsSettings4Ray tlsSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tcp传输额外设置
|
/// Tcp传输额外设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TcpSettings tcpSettings { get; set; }
|
public TcpSettings4Ray tcpSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kcp传输额外设置
|
/// Kcp传输额外设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public KcpSettings kcpSettings { get; set; }
|
public KcpSettings4Ray kcpSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ws传输额外设置
|
/// ws传输额外设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WsSettings wsSettings { get; set; }
|
public WsSettings4Ray wsSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// h2传输额外设置
|
/// h2传输额外设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HttpSettings httpSettings { get; set; }
|
public HttpSettings4Ray httpSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// QUIC
|
/// QUIC
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public QuicSettings quicSettings { get; set; }
|
public QuicSettings4Ray quicSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// VLESS only
|
/// VLESS only
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TlsSettings realitySettings { get; set; }
|
public TlsSettings4Ray realitySettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// grpc
|
/// grpc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GrpcSettings grpcSettings { get; set; }
|
public GrpcSettings4Ray grpcSettings { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TlsSettings
|
public class TlsSettings4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否允许不安全连接(用于客户端)
|
/// 是否允许不安全连接(用于客户端)
|
||||||
|
@ -460,15 +478,15 @@ namespace v2rayN.Mode
|
||||||
public string? spiderX { get; set; }
|
public string? spiderX { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TcpSettings
|
public class TcpSettings4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据包头部伪装设置
|
/// 数据包头部伪装设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Header header { get; set; }
|
public Header4Ray header { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Header
|
public class Header4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 伪装
|
/// 伪装
|
||||||
|
@ -486,7 +504,7 @@ namespace v2rayN.Mode
|
||||||
public object response { get; set; }
|
public object response { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class KcpSettings
|
public class KcpSettings4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -526,7 +544,7 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Header header { get; set; }
|
public Header4Ray header { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -534,7 +552,7 @@ namespace v2rayN.Mode
|
||||||
public string seed { get; set; }
|
public string seed { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WsSettings
|
public class WsSettings4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -544,10 +562,10 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Headers headers { get; set; }
|
public Headers4Ray headers { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Headers
|
public class Headers4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -561,7 +579,7 @@ namespace v2rayN.Mode
|
||||||
public string UserAgent { get; set; }
|
public string UserAgent { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HttpSettings
|
public class HttpSettings4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -574,7 +592,7 @@ namespace v2rayN.Mode
|
||||||
public List<string> host { get; set; }
|
public List<string> host { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class QuicSettings
|
public class QuicSettings4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -589,10 +607,10 @@ namespace v2rayN.Mode
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Header header { get; set; }
|
public Header4Ray header { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GrpcSettings
|
public class GrpcSettings4Ray
|
||||||
{
|
{
|
||||||
public string serviceName { get; set; }
|
public string serviceName { get; set; }
|
||||||
public bool multiMode { get; set; }
|
public bool multiMode { get; set; }
|
||||||
|
@ -602,7 +620,7 @@ namespace v2rayN.Mode
|
||||||
public int initial_windows_size { get; set; }
|
public int initial_windows_size { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AccountsItem
|
public class AccountsItem4Ray
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue