mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-22 13:16:09 +03:00
brook complated
This commit is contained in:
parent
399c852857
commit
0859efb2dd
@ -10,6 +10,8 @@ namespace ProxySuper.Core.Models.Projects
|
|||||||
{
|
{
|
||||||
public string Domain { get; set; }
|
public string Domain { get; set; }
|
||||||
|
|
||||||
|
public string IP { get; set; }
|
||||||
|
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
public BrookType BrookType { get; set; }
|
public BrookType BrookType { get; set; }
|
||||||
|
@ -94,6 +94,7 @@
|
|||||||
<Compile Include="Services\TrojanGoProject.cs" />
|
<Compile Include="Services\TrojanGoProject.cs" />
|
||||||
<Compile Include="Services\XrayConfigBuilder.cs" />
|
<Compile Include="Services\XrayConfigBuilder.cs" />
|
||||||
<Compile Include="Services\XrayProject.cs" />
|
<Compile Include="Services\XrayProject.cs" />
|
||||||
|
<Compile Include="ViewModels\BrookConfigViewModel.cs" />
|
||||||
<Compile Include="ViewModels\BrookEditorViewModel.cs" />
|
<Compile Include="ViewModels\BrookEditorViewModel.cs" />
|
||||||
<Compile Include="ViewModels\BrookInstallerViewModel.cs" />
|
<Compile Include="ViewModels\BrookInstallerViewModel.cs" />
|
||||||
<Compile Include="ViewModels\HomeViewModel.cs" />
|
<Compile Include="ViewModels\HomeViewModel.cs" />
|
||||||
|
@ -109,7 +109,8 @@ namespace ProxySuper.Core.Services
|
|||||||
|
|
||||||
if (Parameters.BrookType == BrookType.socks5)
|
if (Parameters.BrookType == BrookType.socks5)
|
||||||
{
|
{
|
||||||
return $"/usr/bin/brook socks5 --socks5 :{Parameters.Port}";
|
var ip = OnlyIpv6 ? IPv6 : IPv4;
|
||||||
|
return $"/usr/bin/brook socks5 --socks5 {ip}:{Parameters.Port}";
|
||||||
}
|
}
|
||||||
|
|
||||||
return runBrookCmd;
|
return runBrookCmd;
|
||||||
@ -117,12 +118,15 @@ namespace ProxySuper.Core.Services
|
|||||||
|
|
||||||
public void Uninstall()
|
public void Uninstall()
|
||||||
{
|
{
|
||||||
RunCmd("killall brook");
|
RunCmd("systemctl stop brook");
|
||||||
|
RunCmd("systemctl disable brook");
|
||||||
|
RunCmd("rm -rf /etc/systemd/system/brook.service");
|
||||||
|
RunCmd("rm -rf /usr/bin/brook");
|
||||||
|
|
||||||
Console.WriteLine("关闭端口");
|
Console.WriteLine("关闭端口");
|
||||||
ClosePort(Parameters.FreePorts.ToArray());
|
ClosePort(Parameters.FreePorts.ToArray());
|
||||||
|
|
||||||
Console.WriteLine("******卸载完成******");
|
WriteOutput("******卸载完成******");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,37 @@ namespace ProxySuper.Core.Services
|
|||||||
{
|
{
|
||||||
public class ShareLink
|
public class ShareLink
|
||||||
{
|
{
|
||||||
|
public static string BuildBrook(BrookSettings settings)
|
||||||
|
{
|
||||||
|
var password = HttpUtility.UrlEncode(settings.Password);
|
||||||
|
|
||||||
|
if (settings.BrookType == BrookType.server)
|
||||||
|
{
|
||||||
|
var address = HttpUtility.UrlEncode($"{settings.IP}:{settings.Port}");
|
||||||
|
return $"brook://server?password={password}&server={address}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.BrookType == BrookType.wsserver)
|
||||||
|
{
|
||||||
|
var address = HttpUtility.UrlEncode($"ws://{settings.IP}:{settings.Port}");
|
||||||
|
return $"brook://wsserver?password={password}&ws={address}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.BrookType == BrookType.wssserver)
|
||||||
|
{
|
||||||
|
var address = HttpUtility.UrlEncode($"wss://{settings.Domain}:{settings.Port}");
|
||||||
|
return $"brook://wssserver?password={password}&wss={address}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings.BrookType == BrookType.socks5)
|
||||||
|
{
|
||||||
|
var address = HttpUtility.UrlEncode($"socks5://{settings.IP}:{settings.Port}");
|
||||||
|
return $"brook://socks5?password={password}&socks5={address}";
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
public static string BuildNaiveProxy(NaiveProxySettings settings)
|
public static string BuildNaiveProxy(NaiveProxySettings settings)
|
||||||
{
|
{
|
||||||
StringBuilder strBuilder = new StringBuilder();
|
StringBuilder strBuilder = new StringBuilder();
|
||||||
|
29
ProxySuper.Core/ViewModels/BrookConfigViewModel.cs
Normal file
29
ProxySuper.Core/ViewModels/BrookConfigViewModel.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using MvvmCross.ViewModels;
|
||||||
|
using ProxySuper.Core.Models.Projects;
|
||||||
|
using ProxySuper.Core.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProxySuper.Core.ViewModels
|
||||||
|
{
|
||||||
|
public class BrookConfigViewModel : MvxViewModel<BrookSettings>
|
||||||
|
{
|
||||||
|
public BrookSettings Settings { get; set; }
|
||||||
|
|
||||||
|
public override void Prepare(BrookSettings parameter)
|
||||||
|
{
|
||||||
|
Settings = parameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Link
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ShareLink.BuildBrook(Settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -58,6 +58,7 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
}
|
}
|
||||||
RaisePropertyChanged("EnablePort");
|
RaisePropertyChanged("EnablePort");
|
||||||
RaisePropertyChanged("EnableDomain");
|
RaisePropertyChanged("EnableDomain");
|
||||||
|
RaisePropertyChanged("EnableIP");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +66,8 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
|
|
||||||
public bool EnableDomain => Settings.BrookType == BrookType.wssserver;
|
public bool EnableDomain => Settings.BrookType == BrookType.wssserver;
|
||||||
|
|
||||||
|
public bool EnableIP => Settings.BrookType != BrookType.wssserver;
|
||||||
|
|
||||||
public IMvxCommand SaveCommand => new MvxCommand(() => Save());
|
public IMvxCommand SaveCommand => new MvxCommand(() => Save());
|
||||||
|
|
||||||
public override void Prepare(Record parameter)
|
public override void Prepare(Record parameter)
|
||||||
|
@ -210,6 +210,10 @@ namespace ProxySuper.Core.ViewModels
|
|||||||
{
|
{
|
||||||
await _navigationService.Navigate<NaiveProxyConfigViewModel, NaiveProxySettings>(record.NaiveProxySettings);
|
await _navigationService.Navigate<NaiveProxyConfigViewModel, NaiveProxySettings>(record.NaiveProxySettings);
|
||||||
}
|
}
|
||||||
|
if (record.Type == ProjectType.Brook)
|
||||||
|
{
|
||||||
|
await _navigationService.Navigate<BrookConfigViewModel, BrookSettings>(record.BrookSettings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task GoToInstall(string id)
|
public async Task GoToInstall(string id)
|
||||||
|
@ -111,12 +111,18 @@
|
|||||||
<Compile Include="MainWindow.xaml.cs">
|
<Compile Include="MainWindow.xaml.cs">
|
||||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\BrookConfigView.xaml.cs">
|
||||||
|
<DependentUpon>BrookConfigView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\BrookEditorView.xaml.cs">
|
<Compile Include="Views\BrookEditorView.xaml.cs">
|
||||||
<DependentUpon>BrookEditorView.xaml</DependentUpon>
|
<DependentUpon>BrookEditorView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Views\BrookInstallerView.xaml.cs">
|
<Compile Include="Views\BrookInstallerView.xaml.cs">
|
||||||
<DependentUpon>BrookInstallerView.xaml</DependentUpon>
|
<DependentUpon>BrookInstallerView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\EnableRootView.xaml.cs">
|
||||||
|
<DependentUpon>EnableRootView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\HomeView.xaml.cs">
|
<Compile Include="Views\HomeView.xaml.cs">
|
||||||
<DependentUpon>HomeView.xaml</DependentUpon>
|
<DependentUpon>HomeView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -207,6 +213,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\BrookConfigView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\BrookEditorView.xaml">
|
<Page Include="Views\BrookEditorView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@ -215,6 +225,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\EnableRootView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\HomeView.xaml">
|
<Page Include="Views\HomeView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
40
ProxySuper.WPF/Views/BrookConfigView.xaml
Normal file
40
ProxySuper.WPF/Views/BrookConfigView.xaml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<views:MvxWindow x:Class="ProxySuper.WPF.Views.BrookConfigView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
|
||||||
|
xmlns:local="clr-namespace:ProxySuper.WPF.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Icon="/Resources/ProxySU.ico"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Title="NaiveProxyConfigView" Height="450" Width="800">
|
||||||
|
<Grid Margin="10">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="140" />
|
||||||
|
<ColumnDefinition Width="300" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
<RowDefinition Height="36" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Label Grid.Row="0" Grid.Column="0" Content="地址IP" />
|
||||||
|
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Settings.IP}" IsReadOnly="True" />
|
||||||
|
|
||||||
|
<Label Grid.Row="1" Grid.Column="0" Content="端口(Port)" />
|
||||||
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Settings.Port}" IsReadOnly="True" />
|
||||||
|
|
||||||
|
<Label Grid.Row="2" Grid.Column="0" Content="域名(Domain)" />
|
||||||
|
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Settings.Domain}" IsReadOnly="True" />
|
||||||
|
|
||||||
|
<Label Grid.Row="3" Grid.Column="0" Content="密码(Password)" />
|
||||||
|
<TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Settings.Password}" IsReadOnly="True" />
|
||||||
|
|
||||||
|
<Label Grid.Row="4" Grid.Column="0" Content="链接(ShareLink)" />
|
||||||
|
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Link, Mode=OneTime}" IsReadOnly="True" />
|
||||||
|
</Grid>
|
||||||
|
</views:MvxWindow>
|
28
ProxySuper.WPF/Views/BrookConfigView.xaml.cs
Normal file
28
ProxySuper.WPF/Views/BrookConfigView.xaml.cs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
using MvvmCross.Platforms.Wpf.Views;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace ProxySuper.WPF.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// BrookConfigView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class BrookConfigView : MvxWindow
|
||||||
|
{
|
||||||
|
public BrookConfigView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -48,14 +48,17 @@
|
|||||||
SelectedValue="{Binding CheckedBrookType,Mode=TwoWay}">
|
SelectedValue="{Binding CheckedBrookType,Mode=TwoWay}">
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
|
|
||||||
<Label Content="端口" Grid.Row="1" Grid.Column="0" />
|
<Label Content="端口" Grid.Row="1" Grid.Column="0" IsEnabled="{Binding EnablePort}" />
|
||||||
<TextBox IsEnabled="{Binding EnablePort}" Text="{Binding Settings.Port}" Grid.Row="1" Grid.Column="1" />
|
<TextBox IsEnabled="{Binding EnablePort}" Text="{Binding Settings.Port}" Grid.Row="1" Grid.Column="1" />
|
||||||
|
|
||||||
<Label Content="密码" Grid.Row="2" Grid.Column="0" />
|
<Label Content="密码" Grid.Row="2" Grid.Column="0" />
|
||||||
<TextBox Text="{Binding Settings.Password}" Grid.Row="2" Grid.Column="1" />
|
<TextBox Text="{Binding Settings.Password}" Grid.Row="2" Grid.Column="1" />
|
||||||
|
|
||||||
<Label Content="域名" Grid.Row="3" Grid.Column="0" />
|
<Label Content="IP" Grid.Row="3" Grid.Column="0" IsEnabled="{Binding EnableIP}" />
|
||||||
<TextBox IsEnabled="{Binding EnableDomain}" Text="{Binding Settings.Domain}" Grid.Row="3" Grid.Column="1" />
|
<TextBox IsEnabled="{Binding EnableIP}" Text="{Binding Settings.IP}" Grid.Row="3" Grid.Column="1" />
|
||||||
|
|
||||||
|
<Label Content="域名" Grid.Row="4" Grid.Column="0" IsEnabled="{Binding EnableDomain}" />
|
||||||
|
<TextBox IsEnabled="{Binding EnableDomain}" Text="{Binding Settings.Domain}" Grid.Row="4" Grid.Column="1" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Border BorderBrush="#eee" BorderThickness="0,1,0,0">
|
<Border BorderBrush="#eee" BorderThickness="0,1,0,0">
|
||||||
|
15
ProxySuper.WPF/Views/EnableRootView.xaml
Normal file
15
ProxySuper.WPF/Views/EnableRootView.xaml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<views:MvxWindow x:Class="ProxySuper.WPF.Views.EnableRootView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:views="clr-namespace:MvvmCross.Platforms.Wpf.Views;assembly=MvvmCross.Platforms.Wpf"
|
||||||
|
xmlns:local="clr-namespace:ProxySuper.WPF.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Icon="/Resources/ProxySU.ico"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
Title="NaiveProxyConfigView" Height="450" Width="800">
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</views:MvxWindow>
|
27
ProxySuper.WPF/Views/EnableRootView.xaml.cs
Normal file
27
ProxySuper.WPF/Views/EnableRootView.xaml.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace ProxySuper.WPF.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// EnableRootView.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class EnableRootView : Window
|
||||||
|
{
|
||||||
|
public EnableRootView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user