mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-14 19:45:45 +00:00
Compare commits
3 commits
7329dbae11
...
fce86e1434
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fce86e1434 | ||
|
|
70003e8a81 | ||
|
|
e19b000081 |
4 changed files with 29 additions and 5 deletions
|
|
@ -253,11 +253,14 @@ download_xray() {
|
|||
}
|
||||
|
||||
download_singbox() {
|
||||
local outdir="$1" rid="$2" ver="${SING_VER:-}" url tmp tarname="singbox.tar.gz" bin
|
||||
# Download sing-box
|
||||
local outdir="$1" rid="$2" ver="${SING_VER:-}" url tmp tarname="singbox.tar.gz" bin cronet
|
||||
mkdir -p "$outdir"
|
||||
if [[ -z "$ver" ]]; then
|
||||
ver="$(curl -fsSL https://api.github.com/repos/SagerNet/sing-box/releases/latest \
|
||||
| grep -Eo '"tag_name":\s*"v[^"]+"' | sed -E 's/.*"v([^"]+)".*/\1/' | head -n1)" || true
|
||||
| grep -Eo '"tag_name":\s*"v[^"]+"' \
|
||||
| sed -E 's/.*"v([^"]+)".*/\1/' \
|
||||
| head -n1)" || true
|
||||
fi
|
||||
[[ -n "$ver" ]] || { echo "[sing-box] Failed to get version"; return 1; }
|
||||
if [[ "$rid" == "linux-arm64" ]]; then
|
||||
|
|
@ -272,6 +275,8 @@ download_singbox() {
|
|||
bin="$(find "$tmp" -type f -name 'sing-box' | head -n1 || true)"
|
||||
[[ -n "$bin" ]] || { echo "[!] sing-box unpack failed"; rm -rf "$tmp"; return 1; }
|
||||
install -m 755 "$bin" "$outdir/sing-box"
|
||||
cronet="$(find "$tmp" -type f -name 'libcronet*.so*' | head -n1 || true)"
|
||||
[[ -n "$cronet" ]] && install -m 644 "$cronet" "$outdir/libcronet.so"
|
||||
rm -rf "$tmp"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -232,11 +232,13 @@ download_xray() {
|
|||
|
||||
download_singbox() {
|
||||
# Download sing-box
|
||||
local outdir="$1" rid="$2" ver="${SING_VER:-}" url tmp tarname="singbox.tar.gz" bin
|
||||
local outdir="$1" rid="$2" ver="${SING_VER:-}" url tmp tarname="singbox.tar.gz" bin cronet
|
||||
mkdir -p "$outdir"
|
||||
if [[ -z "$ver" ]]; then
|
||||
ver="$(curl -fsSL https://api.github.com/repos/SagerNet/sing-box/releases/latest \
|
||||
| grep -Eo '"tag_name":\s*"v[^"]+"' | sed -E 's/.*"v([^"]+)".*/\1/' | head -n1)" || true
|
||||
| grep -Eo '"tag_name":\s*"v[^"]+"' \
|
||||
| sed -E 's/.*"v([^"]+)".*/\1/' \
|
||||
| head -n1)" || true
|
||||
fi
|
||||
[[ -n "$ver" ]] || { echo "[sing-box] Failed to get version"; return 1; }
|
||||
if [[ "$rid" == "linux-arm64" ]]; then
|
||||
|
|
@ -251,6 +253,8 @@ download_singbox() {
|
|||
bin="$(find "$tmp" -type f -name 'sing-box' | head -n1 || true)"
|
||||
[[ -n "$bin" ]] || { echo "[!] sing-box unpack failed"; rm -rf "$tmp"; return 1; }
|
||||
install -m 755 "$bin" "$outdir/sing-box"
|
||||
cronet="$(find "$tmp" -type f -name 'libcronet*.so*' | head -n1 || true)"
|
||||
[[ -n "$cronet" ]] && install -m 644 "$cronet" "$outdir/libcronet.so"
|
||||
rm -rf "$tmp"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ServiceLib.Handler.Builder;
|
||||
|
||||
public record CoreConfigContextBuilderResult(CoreConfigContext Context, NodeValidatorResult ValidatorResult)
|
||||
|
|
@ -309,6 +311,11 @@ public class CoreConfigContextBuilder
|
|||
}
|
||||
|
||||
var nodeValidatorResult = NodeValidator.Validate(node, context.RunCoreType);
|
||||
var msgs = new List<string>([.. nodeValidatorResult.Errors, .. nodeValidatorResult.Warnings]);
|
||||
if (msgs.Count > 0)
|
||||
{
|
||||
Logging.SaveLog($"{node.Remarks}: {string.Join("; ", msgs)}");
|
||||
}
|
||||
if (!nodeValidatorResult.Success)
|
||||
{
|
||||
return nodeValidatorResult;
|
||||
|
|
|
|||
|
|
@ -143,11 +143,19 @@ public class NodeValidator
|
|||
|
||||
if (item.Network == nameof(ETransport.xhttp) && !item.Extra.IsNullOrEmpty())
|
||||
{
|
||||
if (JsonUtils.ParseJson(item.Extra) is null)
|
||||
if (JsonUtils.ParseJson(item.Extra) is not JsonObject)
|
||||
{
|
||||
v.Error(string.Format(ResUI.MsgInvalidProperty, "XHTTP Extra"));
|
||||
}
|
||||
}
|
||||
|
||||
if (!item.Finalmask.IsNullOrEmpty())
|
||||
{
|
||||
if (JsonUtils.ParseJson(item.Finalmask) is not JsonObject)
|
||||
{
|
||||
v.Error(string.Format(ResUI.MsgInvalidProperty, "Finalmask"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string? ValidateSingboxTransport(EConfigType configType, string net)
|
||||
|
|
|
|||
Loading…
Reference in a new issue