From c501429612293b3edb4d42372166f848cf8351d9 Mon Sep 17 00:00:00 2001 From: database64128 Date: Sat, 6 Mar 2021 17:49:30 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=8B=20Interop:=20throw=20exception=20w?= =?UTF-8?q?hen=20creating=20v2ray=20outbound=20from=20SIP003=20plugins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Shadowsocks.Interop/V2Ray/OutboundObject.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Shadowsocks.Interop/V2Ray/OutboundObject.cs b/Shadowsocks.Interop/V2Ray/OutboundObject.cs index 8366601e..e7357d47 100644 --- a/Shadowsocks.Interop/V2Ray/OutboundObject.cs +++ b/Shadowsocks.Interop/V2Ray/OutboundObject.cs @@ -1,6 +1,7 @@ using Shadowsocks.Interop.V2Ray.Outbound; using Shadowsocks.Interop.V2Ray.Transport; using Shadowsocks.Models; +using System; using System.Net; namespace Shadowsocks.Interop.V2Ray @@ -38,16 +39,22 @@ namespace Shadowsocks.Interop.V2Ray /// /// Gets the for the Shadowsocks server. - /// Plugins are not supported. Plugin information is silently discarded. + /// Plugins are not supported. /// /// /// - public static OutboundObject GetShadowsocks(IServer server) => new() + public static OutboundObject GetShadowsocks(IServer server) { - Tag = server.Name, - Protocol = "shadowsocks", - Settings = new Protocols.Shadowsocks.OutboundConfigurationObject(server.Host, server.Port, server.Method, server.Password), - }; + if (!string.IsNullOrEmpty(server.Plugin)) + throw new InvalidOperationException("V2Ray doesn't support SIP003 plugins."); + + return new() + { + Tag = server.Name, + Protocol = "shadowsocks", + Settings = new Protocols.Shadowsocks.OutboundConfigurationObject(server.Host, server.Port, server.Method, server.Password), + }; + } /// /// Gets the for the Trojan server.