diff --git a/ProxySU_Core/ProxySU_Core.csproj b/ProxySU_Core/ProxySU_Core.csproj
index 167bf91..1daf4c3 100644
--- a/ProxySU_Core/ProxySU_Core.csproj
+++ b/ProxySU_Core/ProxySU_Core.csproj
@@ -238,34 +238,93 @@
SettingsSingleFileGenerator
Settings.Designer.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
diff --git a/ProxySU_Core/Templates/xray/server/00_log/00_log.json b/ProxySU_Core/Templates/xray/server/00_log/00_log.json
new file mode 100644
index 0000000..6a4cf00
--- /dev/null
+++ b/ProxySU_Core/Templates/xray/server/00_log/00_log.json
@@ -0,0 +1,5 @@
+{
+ "log": {
+ "loglevel": "warning"
+ }
+}
\ No newline at end of file
diff --git a/ProxySU_Core/ViewModels/Developers/Project.cs b/ProxySU_Core/ViewModels/Developers/Project.cs
index 60e6cae..5c24a10 100644
--- a/ProxySU_Core/ViewModels/Developers/Project.cs
+++ b/ProxySU_Core/ViewModels/Developers/Project.cs
@@ -57,7 +57,7 @@ namespace ProxySU_Core.ViewModels.Developers
///
/// 执行安装命令
///
- public abstract void Execute();
+ public abstract void Install();
///
/// 配置系统基础环境
@@ -420,7 +420,7 @@ namespace ProxySU_Core.ViewModels.Developers
return true;
}
- private void ConfigurePort(bool force = true)
+ public void ConfigurePort(bool force = true)
{
if (Parameters.Port == 80 || Parameters.Port == 443)
{
@@ -429,6 +429,8 @@ namespace ProxySU_Core.ViewModels.Developers
}
else
{
+ SetPortFree(80);
+ SetPortFree(443);
SetPortFree(Parameters.Port);
}
}
diff --git a/ProxySU_Core/ViewModels/Developers/XrayProject.cs b/ProxySU_Core/ViewModels/Developers/XrayProject.cs
index 1c3e0fc..b605860 100644
--- a/ProxySU_Core/ViewModels/Developers/XrayProject.cs
+++ b/ProxySU_Core/ViewModels/Developers/XrayProject.cs
@@ -29,7 +29,7 @@ namespace ProxySU_Core.ViewModels.Developers
{
}
- public override void Execute()
+ public override void Install()
{
try
{
@@ -47,6 +47,8 @@ namespace ProxySU_Core.ViewModels.Developers
EnsureSystemEnv();
+ ConfigurePort();
+
ConfigureSoftware();
ConfigureIPv6();
diff --git a/ProxySU_Core/ViewModels/RecordViewModel.cs b/ProxySU_Core/ViewModels/RecordViewModel.cs
index 717a5f6..70f0b81 100644
--- a/ProxySU_Core/ViewModels/RecordViewModel.cs
+++ b/ProxySU_Core/ViewModels/RecordViewModel.cs
@@ -36,5 +36,11 @@ namespace ProxySU_Core.ViewModels
Notify("Settings");
}
}
+
+ public void Notify()
+ {
+ Notify("Host");
+ Notify("Settings");
+ }
}
}
diff --git a/ProxySU_Core/ViewModels/XraySettingsViewModel.cs b/ProxySU_Core/ViewModels/XraySettingsViewModel.cs
index daa09aa..9e6bbcd 100644
--- a/ProxySU_Core/ViewModels/XraySettingsViewModel.cs
+++ b/ProxySU_Core/ViewModels/XraySettingsViewModel.cs
@@ -11,82 +11,82 @@ namespace ProxySU_Core.ViewModels
{
public class XraySettingsViewModel : BaseViewModel
{
- private XraySettings p;
+ public XraySettings settings;
public XraySettingsViewModel(XraySettings parameters)
{
- this.p = parameters;
+ this.settings = parameters;
}
public string UUID
{
- get => p.UUID;
- set => p.UUID = value;
+ get => settings.UUID;
+ set => settings.UUID = value;
}
public string Domain
{
- get => p.Domain;
- set => p.Domain = value;
+ get => settings.Domain;
+ set => settings.Domain = value;
}
public string MaskDomain
{
- get => p.MaskDomain;
- set => p.MaskDomain = value;
+ get => settings.MaskDomain;
+ set => settings.MaskDomain = value;
}
public string VLESS_TCP_Path
{
- get => p.VLESS_TCP_Path;
- set => p.VLESS_TCP_Path = value;
+ get => settings.VLESS_TCP_Path;
+ set => settings.VLESS_TCP_Path = value;
}
public string VLESS_WS_Path
{
- get => p.VLESS_WS_Path;
- set => p.VLESS_WS_Path = value;
+ get => settings.VLESS_WS_Path;
+ set => settings.VLESS_WS_Path = value;
}
public string VMESS_TCP_Path
{
- get => p.VMESS_TCP_Path;
- set => p.VMESS_TCP_Path = value;
+ get => settings.VMESS_TCP_Path;
+ set => settings.VMESS_TCP_Path = value;
}
public string VMESS_WS_Path
{
- get => p.VMESS_WS_Path;
- set => p.VMESS_WS_Path = value;
+ get => settings.VMESS_WS_Path;
+ set => settings.VMESS_WS_Path = value;
}
public string Trojan_TCP_Path
{
- get => p.Trojan_TCP_Path;
- set => p.Trojan_TCP_Path = value;
+ get => settings.Trojan_TCP_Path;
+ set => settings.Trojan_TCP_Path = value;
}
public string TrojanPassword
{
- get => p.TrojanPassword;
- set => p.TrojanPassword = value;
+ get => settings.TrojanPassword;
+ set => settings.TrojanPassword = value;
}
public bool Checked_VLESS_TCP
{
get
{
- return p.Types.Contains(XrayType.VLESS_TCP_TLS);
+ return settings.Types.Contains(XrayType.VLESS_TCP_TLS);
}
set
{
if (value == true)
{
- p.Types.Add(XrayType.VLESS_TCP_TLS);
+ settings.Types.Add(XrayType.VLESS_TCP_TLS);
}
else
{
- p.Types.Remove(XrayType.VLESS_TCP_TLS);
+ settings.Types.Remove(XrayType.VLESS_TCP_TLS);
}
Notify("Checked_VLESS_TCP");
Notify("VLESS_TCP_Path_Visibility");
@@ -97,17 +97,17 @@ namespace ProxySU_Core.ViewModels
{
get
{
- return p.Types.Contains(XrayType.VLESS_TCP_XTLS);
+ return settings.Types.Contains(XrayType.VLESS_TCP_XTLS);
}
set
{
if (value == true)
{
- p.Types.Add(XrayType.VLESS_TCP_XTLS);
+ settings.Types.Add(XrayType.VLESS_TCP_XTLS);
}
else
{
- p.Types.Remove(XrayType.VLESS_TCP_XTLS);
+ settings.Types.Remove(XrayType.VLESS_TCP_XTLS);
}
Notify("Checked_VLESS_XTLS");
}
@@ -117,17 +117,17 @@ namespace ProxySU_Core.ViewModels
{
get
{
- return p.Types.Contains(XrayType.VLESS_WS_TLS);
+ return settings.Types.Contains(XrayType.VLESS_WS_TLS);
}
set
{
if (value == true)
{
- p.Types.Add(XrayType.VLESS_WS_TLS);
+ settings.Types.Add(XrayType.VLESS_WS_TLS);
}
else
{
- p.Types.Remove(XrayType.VLESS_WS_TLS);
+ settings.Types.Remove(XrayType.VLESS_WS_TLS);
}
Notify("Checked_VLESS_WS");
Notify("VLESS_WS_Path_Visibility");
@@ -138,17 +138,17 @@ namespace ProxySU_Core.ViewModels
{
get
{
- return p.Types.Contains(XrayType.VMESS_TCP_TLS);
+ return settings.Types.Contains(XrayType.VMESS_TCP_TLS);
}
set
{
if (value == true)
{
- p.Types.Add(XrayType.VMESS_TCP_TLS);
+ settings.Types.Add(XrayType.VMESS_TCP_TLS);
}
else
{
- p.Types.Remove(XrayType.VMESS_TCP_TLS);
+ settings.Types.Remove(XrayType.VMESS_TCP_TLS);
}
Notify("Checked_VMESS_TCP");
Notify("VMESS_TCP_Path_Visibility");
@@ -159,17 +159,17 @@ namespace ProxySU_Core.ViewModels
{
get
{
- return p.Types.Contains(XrayType.VMESS_WS_TLS);
+ return settings.Types.Contains(XrayType.VMESS_WS_TLS);
}
set
{
if (value == true)
{
- p.Types.Add(XrayType.VMESS_WS_TLS);
+ settings.Types.Add(XrayType.VMESS_WS_TLS);
}
else
{
- p.Types.Remove(XrayType.VMESS_WS_TLS);
+ settings.Types.Remove(XrayType.VMESS_WS_TLS);
}
Notify("Checked_VMESS_WS");
Notify("VMESS_WS_Path_Visibility");
@@ -180,17 +180,17 @@ namespace ProxySU_Core.ViewModels
{
get
{
- return p.Types.Contains(XrayType.Trojan_TCP_TLS);
+ return settings.Types.Contains(XrayType.Trojan_TCP_TLS);
}
set
{
if (value == true)
{
- p.Types.Add(XrayType.Trojan_TCP_TLS);
+ settings.Types.Add(XrayType.Trojan_TCP_TLS);
}
else
{
- p.Types.Remove(XrayType.Trojan_TCP_TLS);
+ settings.Types.Remove(XrayType.Trojan_TCP_TLS);
}
Notify("Checked_Trojan_TCP");
Notify("Trojan_TCP_Path_Visibility");
diff --git a/ProxySU_Core/Views/MainWindow.xaml.cs b/ProxySU_Core/Views/MainWindow.xaml.cs
index 5c5e4dc..ddd59fd 100644
--- a/ProxySU_Core/Views/MainWindow.xaml.cs
+++ b/ProxySU_Core/Views/MainWindow.xaml.cs
@@ -101,8 +101,13 @@ namespace ProxySU_Core
private void AddHost(object sender, RoutedEventArgs e)
{
- var hostWindow = new RecordEditorWindow(new Record());
- hostWindow.ShowDialog();
+ var newRecord = new Record();
+ var hostWindow = new RecordEditorWindow(newRecord);
+ var result = hostWindow.ShowDialog();
+ if (result == true)
+ {
+ Records.Add(new RecordViewModel(newRecord));
+ }
}
private void EditHost(object sender, RoutedEventArgs e)
@@ -110,7 +115,11 @@ namespace ProxySU_Core
if (DataGrid.SelectedItem is RecordViewModel project)
{
var hostWindow = new RecordEditorWindow(project.record);
- hostWindow.ShowDialog();
+ var result = hostWindow.ShowDialog();
+ if (result == true)
+ {
+ project.Notify();
+ }
}
}
@@ -130,13 +139,13 @@ namespace ProxySU_Core
private void Connect(object sender, RoutedEventArgs e)
{
- var project = DataGrid.SelectedItem as Record;
+ var project = DataGrid.SelectedItem as RecordViewModel;
if (project == null)
{
DialogManager.ShowMessageAsync(this, "提示", "请选择一个服务器");
}
- TerminalWindow terminalWindow = new TerminalWindow(project);
+ TerminalWindow terminalWindow = new TerminalWindow(project.record);
terminalWindow.Show();
}
}
diff --git a/ProxySU_Core/Views/RecordEditorWindow.xaml b/ProxySU_Core/Views/RecordEditorWindow.xaml
index 28f8ed0..561b6fc 100644
--- a/ProxySU_Core/Views/RecordEditorWindow.xaml
+++ b/ProxySU_Core/Views/RecordEditorWindow.xaml
@@ -136,71 +136,71 @@
Width="100"
Text="{DynamicResource ProxyType}" />
+ Margin="10,0,0,0"
+ GroupName="ProxyType"
+ Content="{DynamicResource ProxyTypeHttp}"
+ IsChecked="{
+ Binding Path=Host.Proxy.Type,
+ Converter={StaticResource ProxyTypeConverter},
+ ConverterParameter={x:Static models:LocalProxyType.Http}
+ }"/>
+ Margin="10,0,0,0"
+ GroupName="ProxyType"
+ Content="{DynamicResource ProxyTypeSocks5}"
+ IsChecked="{
+ Binding Path=Host.Proxy.Type,
+ Converter={StaticResource ProxyTypeConverter},
+ ConverterParameter={x:Static models:LocalProxyType.Socks5}
+ }"/>
+ Width="100"
+ Text="{DynamicResource ProxyHostName}"
+ VerticalAlignment="Center" />
+ Width="200"
+ Text="{Binding Path=Host.Proxy.Address}" />
+ Width="100"
+ Text="{DynamicResource ProxyHostPort}"
+ VerticalAlignment="Center"/>
+ Width="200"
+ Text="{Binding Path=Host.Proxy.Port}" />
+ Width="100"
+ Text="{DynamicResource ProxyUserName}"
+ VerticalAlignment="Center"/>
+ Width="200"
+ Text="{Binding Path=Host.Proxy.UserName}"/>
+ Width="100"
+ Text="{DynamicResource ProxyPassword}"
+ VerticalAlignment="Center"/>
+ Width="200"
+ Text="{Binding Path=Host.Proxy.Password}"/>
@@ -315,6 +315,11 @@
-
+
diff --git a/ProxySU_Core/Views/RecordEditorWindow.xaml.cs b/ProxySU_Core/Views/RecordEditorWindow.xaml.cs
index e9cd021..d62e097 100644
--- a/ProxySU_Core/Views/RecordEditorWindow.xaml.cs
+++ b/ProxySU_Core/Views/RecordEditorWindow.xaml.cs
@@ -27,6 +27,8 @@ namespace ProxySU_Core.Views
public XraySettingsViewModel Settings { get; set; }
+ public EventHandler OnSaved;
+
public RecordEditorWindow(Record record)
{
InitializeComponent();
@@ -38,5 +40,13 @@ namespace ProxySU_Core.Views
Settings = new XraySettingsViewModel(record.Settings.DeepClone());
this.DataContext = this;
}
+
+ public void Save(object sender, RoutedEventArgs e)
+ {
+ Record.Host = Host.host;
+ Record.Settings = Settings.settings;
+ DialogResult = true;
+ Close();
+ }
}
}
diff --git a/ProxySU_Core/Views/TerminalWindow.xaml b/ProxySU_Core/Views/TerminalWindow.xaml
index 8ee8744..30cb0e4 100644
--- a/ProxySU_Core/Views/TerminalWindow.xaml
+++ b/ProxySU_Core/Views/TerminalWindow.xaml
@@ -14,6 +14,7 @@
Foreground="LawnGreen"
FontSize="14"
FontFamily="Consolas"
+ x:Name="OutputTextBox"
Height="320">
diff --git a/ProxySU_Core/Views/TerminalWindow.xaml.cs b/ProxySU_Core/Views/TerminalWindow.xaml.cs
index 748fb8e..d1e4d01 100644
--- a/ProxySU_Core/Views/TerminalWindow.xaml.cs
+++ b/ProxySU_Core/Views/TerminalWindow.xaml.cs
@@ -25,16 +25,18 @@ namespace ProxySU_Core
///
public partial class TerminalWindow
{
+ private Record Record { get; set; }
private readonly Terminal _vm;
private SshClient _sshClient;
- public TerminalWindow(Record project)
+ public TerminalWindow(Record record)
{
InitializeComponent();
ResizeMode = ResizeMode.NoResize;
WindowStartupLocation = WindowStartupLocation.CenterScreen;
- _vm = new Terminal(project.Host);
+ this.Record = record;
+ _vm = new Terminal(record.Host);
DataContext = _vm;
_vm.AddOutput("Connect ...");
@@ -106,10 +108,23 @@ namespace ProxySU_Core
private void WriteShell(string outShell)
{
_vm.AddOutput(outShell);
+ Dispatcher.Invoke(() =>
+ {
+ OutputTextBox.ScrollToEnd();
+ });
}
private void Install(object sender, RoutedEventArgs e)
{
+ XrayProject project = new XrayProject(
+ _sshClient,
+ Record.Settings,
+ WriteShell);
+
+ Task.Factory.StartNew(() =>
+ {
+ project.Install();
+ });
}