mirror of
https://github.com/openziti/desktop-edge-win.git
synced 2026-10-13 16:21:25 +00:00
merge latest UI into the service release branch
This commit is contained in:
+23
-3
@@ -20,6 +20,26 @@
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="MyButton" TargetType="Button">
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="Cursor" Value="Hand" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border Name="border" BorderThickness="0" BorderBrush="Black" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Opacity" Value="0.8" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!--Scrollbar Thumbs-->
|
||||
<Style x:Key="ScrollThumbs" TargetType="{x:Type Thumb}">
|
||||
<Setter Property="Template">
|
||||
@@ -27,7 +47,7 @@
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
<Grid x:Name="Grid">
|
||||
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent" />
|
||||
<Border x:Name="Rectangle1" CornerRadius="10" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="{TemplateBinding Background}" />
|
||||
<Border x:Name="Rectangle1" CornerRadius="4" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="{TemplateBinding Background}" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Tag" Value="Horizontal">
|
||||
@@ -43,8 +63,8 @@
|
||||
<!--ScrollBars-->
|
||||
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="true" />
|
||||
<Setter Property="Foreground" Value="LightGray" />
|
||||
<Setter Property="Background" Value="#000F0F23" />
|
||||
<Setter Property="Foreground" Value="#d4d9e2" />
|
||||
<Setter Property="Background" Value="#000F0F23" /> <!-- invalid on purpose -->
|
||||
<Setter Property="Width" Value="3" />
|
||||
<Setter Property="Opacity" Value="0.6"/>
|
||||
<Setter Property="Template">
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -7,7 +7,7 @@
|
||||
mc:Ignorable="d"
|
||||
x:Name="IdentityArea"
|
||||
d:DesignHeight="500" d:DesignWidth="350">
|
||||
<Grid>
|
||||
<Grid MaxWidth="350">
|
||||
<Canvas>
|
||||
<Rectangle Name="Arrow" HorizontalAlignment="Center" Height="20" Fill="White" Width="20" Canvas.Left="165" ClipToBounds="True" Canvas.Bottom="-10">
|
||||
<Rectangle.LayoutTransform>
|
||||
@@ -22,7 +22,7 @@
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Column="0" Orientation="Vertical" HorizontalAlignment="Stretch" Margin="10,10,10,10">
|
||||
<Grid Margin="0,0,0,20">
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="70"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -36,18 +36,29 @@
|
||||
</Grid>
|
||||
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
|
||||
<Grid>
|
||||
<ScrollViewer Name="MainDetailScroll" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
|
||||
<StackPanel>
|
||||
<local:MenuEditItem x:Name="IdentityName" HorizontalAlignment="Stretch" Label="Name" IsLocked="True"></local:MenuEditItem>
|
||||
<local:MenuEditItem x:Name="IdentityNetwork" HorizontalAlignment="Stretch" Label="Network" IsLocked="True"></local:MenuEditItem>
|
||||
<local:MenuEditItem x:Name="IdentityStatus" HorizontalAlignment="Stretch" Label="Status" IsLocked="True"></local:MenuEditItem>
|
||||
<local:MenuEditItem x:Name="IdentityEnrollment" HorizontalAlignment="Stretch" Label="Enrollment Status" IsLocked="True"></local:MenuEditItem>
|
||||
<Label Content="SERVICES" Foreground="Gray" FontWeight="SemiBold" />
|
||||
<StackPanel Name="ServiceList" Orientation="Vertical"></StackPanel>
|
||||
<Label Name="ForgetIdentityButton" Margin="0,10,0,10" Content="Forget This Identity" Cursor="Hand" Foreground="#F4044D" HorizontalAlignment="Center" Mouse.MouseUp="ForgetIdentity"></Label>
|
||||
<Image Source="/Assets/Images/identity.png" Height="100" Width="100" Opacity="0.3" HorizontalAlignment="Stretch"></Image>
|
||||
</StackPanel>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="39"></RowDefinition>
|
||||
<RowDefinition Height="39"></RowDefinition>
|
||||
<RowDefinition Height="39"></RowDefinition>
|
||||
<RowDefinition Height="39"></RowDefinition>
|
||||
<RowDefinition Height="40"></RowDefinition>
|
||||
<RowDefinition x:Name="ServiceRow" Height="160"></RowDefinition>
|
||||
<RowDefinition Height="40"></RowDefinition>
|
||||
<RowDefinition Height="0"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<local:MenuEditItem x:Name="IdentityName" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Stretch" Label="Name" IsLocked="True"></local:MenuEditItem>
|
||||
<local:MenuEditItem x:Name="IdentityNetwork" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Stretch" Label="Network" IsLocked="True"></local:MenuEditItem>
|
||||
<local:MenuEditItem x:Name="IdentityStatus" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Stretch" Label="Status" IsLocked="True"></local:MenuEditItem>
|
||||
<local:MenuEditItem x:Name="IdentityEnrollment" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Stretch" Label="Enrollment Status" IsLocked="True"></local:MenuEditItem>
|
||||
<Label Name="ServiceTitle" Content="SERVICES" Grid.Column="0" Grid.Row="4" Foreground="Gray" Padding="0,10,0,10" FontWeight="SemiBold" />
|
||||
<ScrollViewer Name="MainDetailScroll" Grid.Column="0" MaxHeight="160" Grid.Row="5" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
|
||||
<StackPanel Name="ServiceList" Orientation="Vertical"></StackPanel>
|
||||
</ScrollViewer>
|
||||
<Label Name="ForgetIdentityButton" Grid.Column="0" Grid.Row="6" Padding="0,10,0,10" Margin="0,0,0,0" Content="Forget This Identity" Cursor="Hand" Foreground="#F4044D" HorizontalAlignment="Center" Mouse.MouseUp="ForgetIdentity"></Label>
|
||||
<Image Name="ForgetIdentityImage" Visibility="Collapsed" Source="/Assets/Images/identity.png" Grid.Column="0" Grid.Row="7" Height="80" Width="80" Opacity="0.3" HorizontalAlignment="Stretch"></Image>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
@@ -55,12 +66,19 @@
|
||||
<Grid x:Name="ConfirmView" Visibility="Collapsed" Width="350">
|
||||
<Rectangle RadiusX="10" RadiusY="10">
|
||||
<Rectangle.Fill>
|
||||
<SolidColorBrush Color="Black" Opacity="0.9"/>
|
||||
<SolidColorBrush Color="Black"/>
|
||||
</Rectangle.Fill>
|
||||
</Rectangle>
|
||||
<Canvas>
|
||||
<Rectangle Name="ConfirmArrow" HorizontalAlignment="Center" Height="20" Fill="Black" Width="20" Canvas.Left="165" ClipToBounds="True" Canvas.Bottom="-10">
|
||||
<Rectangle.LayoutTransform>
|
||||
<RotateTransform Angle="-45"/>
|
||||
</Rectangle.LayoutTransform>
|
||||
</Rectangle>
|
||||
</Canvas>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="200"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
<Grid>
|
||||
@@ -79,8 +97,20 @@
|
||||
<ColumnDefinition Width="160"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Name="CancelConfirmButton" Grid.Column="0" Foreground="#CCCCCC" FontWeight="SemiBold" Content="Close" Cursor="Hand" MouseUp="CancelConfirm" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
|
||||
<Label Name="ConfirmButton" Grid.Column="1" Foreground="#F4044D" FontWeight="SemiBold" Content="Confirm" Cursor="Hand" MouseUp="ConfirmForget" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
|
||||
<Button x:Name="CancelConfirmButton" Grid.Column="0" Margin="40,0,20,0" Cursor="Hand" BorderThickness="0" Foreground="#FFFFFF" Background="#0068F9" Content="Close" Click="CancelConfirmButton_Click" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans">
|
||||
<Button.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="CornerRadius" Value="5"/>
|
||||
</Style>
|
||||
</Button.Resources>
|
||||
</Button>
|
||||
<Button x:Name="ConfirmButton" Grid.Column="1" Margin="20,0,40,0" Cursor="Hand" BorderThickness="0" Foreground="#FFFFFF" Background="#F4044D" Content="Confirm" Click="ConfirmButton_Click" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans">
|
||||
<Button.Resources>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="CornerRadius" Value="5"/>
|
||||
</Style>
|
||||
</Button.Resources>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -57,8 +58,13 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
set {
|
||||
_isAttached = value;
|
||||
if (_isAttached) Arrow.Visibility = Visibility.Visible;
|
||||
else Arrow.Visibility = Visibility.Collapsed;
|
||||
if (_isAttached) {
|
||||
Arrow.Visibility = Visibility.Visible;
|
||||
ConfirmArrow.Visibility = Visibility.Visible;
|
||||
} else {
|
||||
Arrow.Visibility = Visibility.Collapsed;
|
||||
ConfirmArrow.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,13 +76,25 @@ namespace ZitiDesktopEdge {
|
||||
IdentityEnrollment.Value = _identity.Status;
|
||||
IdentityStatus.Value = _identity.IsEnabled ? "active" : "disabled";
|
||||
ServiceList.Children.Clear();
|
||||
for (int i=0; i<_identity.Services.Count; i++) {
|
||||
ServiceInfo editor = new ServiceInfo();
|
||||
editor.Label = _identity.Services[i].Name;
|
||||
editor.Value = _identity.Services[i].Url;
|
||||
editor.Warning = _identity.Services[i].Warning;
|
||||
editor.IsLocked = true;
|
||||
ServiceList.Children.Add(editor);
|
||||
if (_identity.Services.Count>0) {
|
||||
for (int i = 0; i < _identity.Services.Count; i++) {
|
||||
ServiceInfo editor = new ServiceInfo();
|
||||
editor.Label = _identity.Services[i].Name;
|
||||
editor.Value = _identity.Services[i].Url;
|
||||
editor.Warning = _identity.Services[i].Warning;
|
||||
editor.IsLocked = true;
|
||||
ServiceList.Children.Add(editor);
|
||||
}
|
||||
int sHeight = 36 * _identity.Services.Count;
|
||||
if (sHeight > 200) sHeight = 200;
|
||||
Debug.WriteLine("Height: " + ServiceRow.Height.Value.ToString());
|
||||
ServiceRow.Height = new GridLength((double)sHeight);
|
||||
MainDetailScroll.Visibility = Visibility.Visible;
|
||||
ServiceTitle.Content = _identity.Services.Count + " SERVICES";
|
||||
} else {
|
||||
ServiceRow.Height = new GridLength((double)0.0);
|
||||
MainDetailScroll.Visibility = Visibility.Collapsed;
|
||||
ServiceTitle.Content = "NO SERVICES AVAILABLE";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,11 +117,15 @@ namespace ZitiDesktopEdge {
|
||||
MainDetailScroll.Height = height;
|
||||
}
|
||||
|
||||
private void CancelConfirm(object sender, MouseButtonEventArgs e) {
|
||||
private void ForgetIdentity(object sender, MouseButtonEventArgs e) {
|
||||
ConfirmView.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void CancelConfirmButton_Click(object sender, RoutedEventArgs e) {
|
||||
ConfirmView.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void ConfirmForget(object sender, MouseButtonEventArgs e) {
|
||||
private void ConfirmButton_Click(object sender, RoutedEventArgs e) {
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
ServiceClient.Client client = (ServiceClient.Client)Application.Current.Properties["ServiceClient"];
|
||||
try {
|
||||
@@ -127,9 +149,5 @@ namespace ZitiDesktopEdge {
|
||||
OnError(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void ForgetIdentity(object sender, MouseButtonEventArgs e) {
|
||||
ConfirmView.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@
|
||||
<TextBox Name="LicensesItems" Height="400" Width="{Binding ActualWidth, ElementName=MainStack}" TextWrapping="Wrap" Visibility="Collapsed"></TextBox>
|
||||
<TextBox Name="LogsItems" Height="400" Width="{Binding ActualWidth, ElementName=MainStack}" TextWrapping="Wrap" Visibility="Collapsed" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto"></TextBox>
|
||||
|
||||
<StackPanel Name="AboutItemsButton" Orientation="Vertical" HorizontalAlignment="Stretch" Visibility="Collapsed">
|
||||
<Label Name="ServiceVersion" HorizontalAlignment="Center" FontSize="10" Foreground="#638190" Margin="0,-20,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"></Label>
|
||||
<StackPanel Name="AboutItemsArea" Orientation="Vertical" HorizontalAlignment="Stretch" Visibility="Collapsed">
|
||||
<Label Name="VersionInfo" HorizontalAlignment="Center" FontSize="10" Height="50" Padding="0,30,0,0" Foreground="#638190" Margin="0,-20,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans"></Label>
|
||||
</StackPanel>
|
||||
<Label Name="MainItemsButton" Margin="0,30,0,0" Foreground="#F4044D" FontWeight="SemiBold" Content="Quit Ziti Desktop Edge" Cursor="Hand" MouseUp="CloseApp" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" HorizontalAlignment="Center"></Label>
|
||||
</StackPanel>
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace ZitiDesktopEdge
|
||||
MainItems.Visibility = Visibility.Collapsed;
|
||||
AboutItems.Visibility = Visibility.Collapsed;
|
||||
MainItemsButton.Visibility = Visibility.Collapsed;
|
||||
AboutItemsButton.Visibility = Visibility.Collapsed;
|
||||
AboutItemsArea.Visibility = Visibility.Collapsed;
|
||||
BackArrow.Visibility = Visibility.Collapsed;
|
||||
AdvancedItems.Visibility = Visibility.Collapsed;
|
||||
LicensesItems.Visibility = Visibility.Collapsed;
|
||||
@@ -78,9 +78,17 @@ namespace ZitiDesktopEdge
|
||||
|
||||
if (menuState=="About") {
|
||||
MenuTitle.Content = "About";
|
||||
AboutItemsButton.Visibility = Visibility.Visible;
|
||||
AboutItemsArea.Visibility = Visibility.Visible;
|
||||
AboutItems.Visibility = Visibility.Visible;
|
||||
BackArrow.Visibility = Visibility.Visible;
|
||||
|
||||
// Service Version - Lose the snapshot
|
||||
string version = File.ReadAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "OpenZiti", "Service", "Version.txt"));
|
||||
if (version.IndexOf("-") > 0) version = version.Split('-')[0];
|
||||
|
||||
// Interface Version
|
||||
VersionInfo.Content = "App: " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()+" Service: "+ version;
|
||||
|
||||
} else if (menuState=="Advanced") {
|
||||
MenuTitle.Content = "Advanced Settings";
|
||||
AdvancedItems.Visibility = Visibility.Visible;
|
||||
@@ -190,6 +198,13 @@ namespace ZitiDesktopEdge
|
||||
}
|
||||
MainMenuArea.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
public void Detach() {
|
||||
Application.Current.MainWindow.ShowInTaskbar = true;
|
||||
DetachButton.Visibility = Visibility.Collapsed;
|
||||
AttachButton.Visibility = Visibility.Visible;
|
||||
Arrow.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
private void RetachWindow(object sender, MouseButtonEventArgs e) {
|
||||
Application.Current.MainWindow.ShowInTaskbar = false;
|
||||
DetachButton.Visibility = Visibility.Visible;
|
||||
|
||||
@@ -85,7 +85,6 @@
|
||||
<EventTrigger RoutedEvent="Window.Loaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard Name="FormFade">
|
||||
<!-- <DoubleAnimation From="0" To="-505" Duration="00:00:4" Storyboard.TargetProperty="X" Storyboard.TargetName="MainUI" /> -->
|
||||
<DoubleAnimation Name="FormFadeAnimation" Storyboard.TargetName="MainUI" Storyboard.TargetProperty="(Window.Opacity)" From="0.0" To="1.0" Duration="0:0:0.5" AutoReverse="False" RepeatBehavior="1x" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
@@ -93,7 +92,7 @@
|
||||
<EventTrigger RoutedEvent="Window.Unloaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard Name="FormFadeOut" Completed="FormFadeOut_Completed">
|
||||
<DoubleAnimation Name="FormFadeOutAnimation" Storyboard.TargetName="MainUI" Storyboard.TargetProperty="(Window.Opacity)" From="1.0" To="0.0" Duration="0:0:0.5" AutoReverse="False" RepeatBehavior="1x" />
|
||||
<DoubleAnimation Name="FormFadeOutAnimation" Storyboard.TargetName="MainUI" Storyboard.TargetProperty="(Window.Opacity)" From="1.0" To="0.0" Duration="0:0:0.5" AutoReverse="False" RepeatBehavior="1x" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
@@ -112,9 +111,9 @@
|
||||
</Rectangle.LayoutTransform>
|
||||
</Rectangle>
|
||||
</Canvas>
|
||||
<Border Name="UIBorder" BorderBrush="Black" BorderThickness="3" CornerRadius="10">
|
||||
<Border Name="UIBorder" BorderBrush="Black" BorderThickness="3" CornerRadius="10">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="15" Direction="2" RenderingBias="Quality" ShadowDepth="4" Opacity="1"/>
|
||||
<DropShadowEffect BlurRadius="1" Direction="1" RenderingBias="Quality" ShadowDepth="1" Opacity="1"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
<Rectangle Name="BgColor" Stroke="Black" RadiusY="10" RadiusX="10" ClipToBounds="True">
|
||||
@@ -194,7 +193,7 @@
|
||||
<Label Name="UploadSpeedLabel" Foreground="White" Margin="0,-20,0,30" Content="KBps" FontSize="11" HorizontalAlignment="Center" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
|
||||
<ScrollViewer Name="IdListScroller" ScrollViewer.HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Auto" CanContentScroll="True">
|
||||
<StackPanel Name="IdList" Orientation="Vertical"></StackPanel>
|
||||
</ScrollViewer>
|
||||
<Grid HorizontalAlignment="Stretch" Margin="0,20,0,10" Width="Auto">
|
||||
|
||||
@@ -35,7 +35,6 @@ namespace ZitiDesktopEdge {
|
||||
private int _right = 75;
|
||||
private int _bottom = 0;
|
||||
private double _maxHeight = 800d;
|
||||
private string _serviceVersion = "0.0.8";
|
||||
private string[] suffixes = { "bps", "kbps", "mbps", "gbps", "tbps", "pbps" };
|
||||
|
||||
private List<ZitiIdentity> identities {
|
||||
@@ -75,7 +74,6 @@ namespace ZitiDesktopEdge {
|
||||
|
||||
LaunchOrInstall();
|
||||
|
||||
MainMenu.ServiceVersion.Content = _serviceVersion;
|
||||
SetNotifyIcon("white");
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -111,7 +109,13 @@ namespace ZitiDesktopEdge {
|
||||
}
|
||||
|
||||
private void Window_MouseDown(object sender, MouseButtonEventArgs e) {
|
||||
if (!_isAttached&&e.ChangedButton == MouseButton.Left) this.DragMove();
|
||||
if (e.ChangedButton == MouseButton.Left) {
|
||||
_isAttached = false;
|
||||
IdentityMenu.Arrow.Visibility = Visibility.Collapsed;
|
||||
Arrow.Visibility = Visibility.Collapsed;
|
||||
MainMenu.Detach();
|
||||
this.DragMove();
|
||||
}
|
||||
}
|
||||
|
||||
private void TargetNotifyIcon_Click(object sender, EventArgs e) {
|
||||
@@ -345,7 +349,6 @@ namespace ZitiDesktopEdge {
|
||||
ZitiIdentity[] ids = identities.ToArray();
|
||||
double height = 460 + (ids.Length * 60);
|
||||
if (height > _maxHeight) height = _maxHeight;
|
||||
Debug.WriteLine("Set Height: " + height);
|
||||
this.Height = height;
|
||||
IdentityMenu.SetHeight(this.Height-160);
|
||||
for (int i=0; i<ids.Length; i++) {
|
||||
@@ -360,7 +363,6 @@ namespace ZitiDesktopEdge {
|
||||
IdList.Children.Add(id);
|
||||
IdList.Height += 60;
|
||||
}
|
||||
Debug.WriteLine("Ids Loaded "+ ids.Length);
|
||||
if (this._isAttached&&repaint) Placement();
|
||||
}
|
||||
|
||||
@@ -368,9 +370,11 @@ namespace ZitiDesktopEdge {
|
||||
var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
|
||||
if (_isAttached) {
|
||||
Arrow.Visibility = Visibility.Visible;
|
||||
IdentityMenu.Arrow.Visibility = Visibility.Visible;
|
||||
this.Left = desktopWorkingArea.Right - this.Width - _right;
|
||||
this.Top = desktopWorkingArea.Bottom - this.Height - _bottom;
|
||||
} else {
|
||||
IdentityMenu.Arrow.Visibility = Visibility.Collapsed;
|
||||
Arrow.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
Debug.WriteLine("Placement: " + this.Left + " " + desktopWorkingArea.Right + " " + this.Width + " " + _right);
|
||||
@@ -434,11 +438,9 @@ namespace ZitiDesktopEdge {
|
||||
_timer.Enabled = true;
|
||||
_timer.Start();
|
||||
}
|
||||
private void Connect(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Dispatcher.Invoke(() =>
|
||||
{
|
||||
ShowLoad();
|
||||
private void Connect(object sender, RoutedEventArgs e) {
|
||||
ShowLoad();
|
||||
this.Dispatcher.Invoke(() => {
|
||||
//Dispatcher.Invoke(new Action(() => { }), System.Windows.Threading.DispatcherPriority.ContextIdle);
|
||||
DoConnect();
|
||||
HideLoad();
|
||||
@@ -494,6 +496,7 @@ namespace ZitiDesktopEdge {
|
||||
private void ShowLoad() {
|
||||
LoadProgress.IsIndeterminate = true;
|
||||
LoadingScreen.Visibility = Visibility.Visible;
|
||||
((MainWindow)System.Windows.Application.Current.MainWindow).UpdateLayout();
|
||||
}
|
||||
|
||||
private void HideLoad() {
|
||||
|
||||
@@ -14,7 +14,11 @@ namespace ZitiDesktopEdge.Models {
|
||||
}
|
||||
|
||||
public static string GetLogs() {
|
||||
return File.ReadAllText(_logDirectory);
|
||||
string logs = "";
|
||||
if (File.Exists(_logDirectory)) {
|
||||
logs = File.ReadAllText(_logDirectory);
|
||||
}
|
||||
return logs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,4 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ZitiDesktopEdge">
|
||||
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ZitiDesktopEdge"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="60" d:DesignWidth="375" Height="60">
|
||||
d:DesignHeight="64" d:DesignWidth="375" Height="64">
|
||||
<Canvas MouseEnter="Canvas_MouseEnter" MouseLeave="Canvas_MouseLeave">
|
||||
<Rectangle Fill="#0F0C28" HorizontalAlignment="Left" Stroke="Black" VerticalAlignment="Top" ClipToBounds="True"></Rectangle>
|
||||
<Rectangle Name="OverState" Fill="#FFFFFF" Height="60" Width="375" Opacity="0" ClipToBounds="True"></Rectangle>
|
||||
<Rectangle Name="OverState" Fill="#FFFFFF" Height="64" Width="375" Opacity="0" ClipToBounds="True" Cursor="Hand"></Rectangle>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -25,20 +25,20 @@
|
||||
<RowDefinition Height="20"/>
|
||||
</Grid.RowDefinitions>
|
||||
<local:Toggler x:Name="ToggleSwitch" Grid.Column="0" Grid.Row="0" Margin="0,10,0,0"></local:Toggler>
|
||||
<Label Name="ToggleStatus" Grid.Column="0" Grid.Row="1" Margin="0,-5,0,0" Content="Enabled" Foreground="White" FontSize="11" Typography.Capitals="AllSmallCaps" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"></Label>
|
||||
<Label Name="IdName" MouseDown="OpenDetails" MaxWidth="180" Grid.Column="1" Margin="0,6,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" FontSize="18" Foreground="White" HorizontalAlignment="Left">
|
||||
<Label Name="ToggleStatus" Cursor="Hand" Grid.Column="0" Grid.Row="1" Margin="0,-5,0,0" Content="Enabled" Foreground="White" FontSize="11" Typography.Capitals="AllSmallCaps" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center"></Label>
|
||||
<Label Name="IdName" Cursor="Hand" MouseUp="OpenDetails" MaxWidth="180" Grid.Column="1" Margin="0,6,0,0" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" FontSize="18" Foreground="White" HorizontalAlignment="Left">
|
||||
<TextBlock TextTrimming="CharacterEllipsis">Identity Name</TextBlock>
|
||||
</Label>
|
||||
<Label Name="IdUrl" MouseDown="OpenDetails" MaxWidth="180" MinWidth="180" Grid.Column="1" Grid.Row="1" FontSize="11" Margin="0,-5,0,0" Typography.Capitals="AllSmallCaps" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="White" HorizontalAlignment="Left">
|
||||
<Label Name="IdUrl" Cursor="Hand" MouseUp="OpenDetails" MaxWidth="180" MinWidth="180" Grid.Column="1" Grid.Row="1" FontSize="11" Margin="0,-5,0,0" Typography.Capitals="AllSmallCaps" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="White" HorizontalAlignment="Left">
|
||||
<TextBlock TextTrimming="CharacterEllipsis">https://serverUrlThisShouldTrimIfItsLong:8080</TextBlock>
|
||||
</Label>
|
||||
<Canvas Grid.Column="2" Grid.Row="0" Width="50" Height="40" MouseDown="OpenDetails">
|
||||
<Canvas Grid.Column="2" Grid.Row="0" Width="50" Height="40" MouseUp="OpenDetails" Cursor="Hand">
|
||||
<Border Width="44" Height="26" Background="#0068F9" CornerRadius="12" Canvas.Top="10" Canvas.Left="3"></Border>
|
||||
<Label Name="ServiceCount" Width="50" Height="26" Canvas.Top="9" Padding="0,0,0,0" FontSize="17" Content="23" Foreground="White" HorizontalAlignment="Center" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"></Label>
|
||||
</Canvas>
|
||||
<Label Grid.Column="3" MouseDown="OpenDetails" Grid.Row="1" Margin="0,-5,0,0" Content="Services" Foreground="White" FontSize="11" HorizontalAlignment="Stretch" Typography.Capitals="AllSmallCaps" HorizontalContentAlignment="Center"></Label>
|
||||
<Label Grid.Column="3" MouseUp="OpenDetails" Grid.Row="1" Margin="0,-5,0,0" Content="Services" Cursor="Hand" Foreground="White" FontSize="11" HorizontalAlignment="Stretch" Typography.Capitals="AllSmallCaps" HorizontalContentAlignment="Center"></Label>
|
||||
</Grid>
|
||||
<Image Grid.Column="1" Source="/Assets/Images/next.png" Width="12" MouseDown="OpenDetails"></Image>
|
||||
<Image Grid.Column="1" Source="/Assets/Images/next.png" Width="12" MouseUp="OpenDetails" Cursor="Hand"></Image>
|
||||
</Grid>
|
||||
</Canvas>
|
||||
</UserControl>
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ZitiDesktopEdge"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="50" HorizontalAlignment="Stretch" d:DesignWidth="350" Cursor="Hand">
|
||||
d:DesignHeight="40" Height="40" HorizontalAlignment="Stretch" d:DesignWidth="350" Cursor="Hand">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Grid Height="49">
|
||||
<StackPanel Orientation="Vertical" Height="40">
|
||||
<Grid Height="39">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Name="MainLabel" MaxWidth="150" BorderThickness="0" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
|
||||
<TextBox Name="MainEdit" GotFocus="MainEdit_GotFocus" MaxWidth="200" Grid.Column="1" HorizontalAlignment="Right" BorderThickness="0" Background="White" TextAlignment="Right" Padding="12,12,12,12" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" ></TextBox>
|
||||
<TextBox Name="MainLabel" MaxWidth="150" Height="39" FontWeight="Bold" BorderThickness="0" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" Padding="12,12,12,0" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
|
||||
<TextBox Name="MainEdit" GotFocus="MainEdit_GotFocus" Height="39" MaxWidth="140" Grid.Column="1" HorizontalAlignment="Right" BorderThickness="0" Background="White" TextAlignment="Right" Padding="12,12,12,0" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" ></TextBox>
|
||||
</Grid>
|
||||
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
|
||||
</StackPanel>
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
<ColumnDefinition Width="150"/>
|
||||
<ColumnDefinition x:Name="WarningColumn" Width="0"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Name="MainLabel" BorderThickness="0" MinWidth="100" MaxWidth="140" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
|
||||
<TextBox Name="MainEdit" TextAlignment="Right" BorderThickness="0" MinWidth="100" MaxWidth="140" Background="White" ClipToBounds="True" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
|
||||
<TextBox Name="MainLabel" Padding="12,0,12,0" BorderThickness="0" MinWidth="100" MaxWidth="140" Background="White" ClipToBounds="True" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
|
||||
<TextBox Name="MainEdit" Padding="12,0,12,0" TextAlignment="Right" BorderThickness="0" MinWidth="100" MaxWidth="160" Background="White" ClipToBounds="True" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right" FontSize="12" FontFamily="pack://application:,,,/Assets/Fonts/#Open Sans" Foreground="Black"></TextBox>
|
||||
<Image x:Name="WarnIcon" Visibility="Collapsed" Source="/Assets/Images/Warning.png" Grid.Column="2" Width="20" Height="20"/>
|
||||
</Grid>
|
||||
<Rectangle HorizontalAlignment="Stretch" Height="1" Fill="#7d8faf" Opacity="0.2"></Rectangle>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
@@ -32,7 +33,7 @@
|
||||
<PublisherName>NetFoundry</PublisherName>
|
||||
<SuiteName>Ziti</SuiteName>
|
||||
<AutorunEnabled>true</AutorunEnabled>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationRevision>5</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<CreateDesktopShortcut>true</CreateDesktopShortcut>
|
||||
@@ -349,5 +350,8 @@
|
||||
<ItemGroup>
|
||||
<Resource Include="Assets\Images\Warning.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="Assets\Images\No_Services.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -14,7 +14,7 @@
|
||||
-->
|
||||
<add key="UpdateTimer" value="0:1:0"/><!--default to look for updates once a minute-->
|
||||
|
||||
<add key="Version" value="latest"/>
|
||||
<add key="Version" value="release"/>
|
||||
|
||||
<!--
|
||||
Format for ServiceTimer is "hours:minutes:seconds" - none of the values can exceed the normal range of each tuple.
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace ZitiUpdateService {
|
||||
} catch (Exception e) {
|
||||
Log(e.ToString());
|
||||
}
|
||||
_rootDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "NetFoundry");
|
||||
_rootDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "OpenZiti");
|
||||
if (!Directory.Exists(_rootDirectory)) Directory.CreateDirectory(_rootDirectory);
|
||||
_logDirectory = Path.Combine(_rootDirectory, "Logs");
|
||||
if (!Directory.Exists(_logDirectory)) Directory.CreateDirectory(_logDirectory);
|
||||
@@ -223,7 +223,7 @@ namespace ZitiUpdateService {
|
||||
|
||||
private void StartZiti() {
|
||||
controller = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == "ziti");
|
||||
if (controller != null && controller.Status != ServiceControllerStatus.Running) {
|
||||
if (controller != null && controller.Status != ServiceControllerStatus.Running && controller.Status != ServiceControllerStatus.StartPending && controller.Status != ServiceControllerStatus.ContinuePending) {
|
||||
try {
|
||||
Log("Starting Service");
|
||||
controller.Start();
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
# Release 1.0.4
|
||||
|
||||
* What's New
|
||||
|
||||
* [#94](https://github.com/openziti/desktop-edge-win/issues/94) - Added support for 'hosted' services
|
||||
|
||||
* Bug fixes
|
||||
|
||||
* [#102](https://github.com/openziti/desktop-edge-win/pull/102) - DNS requests with "connection-specific local domain" would not resolve
|
||||
|
||||
# Release 0.0.20
|
||||
|
||||
* What's New
|
||||
|
||||
@@ -100,6 +100,7 @@ func HookupTun(dev tun.Device, dns []net.IP) (Tunnel, error) {
|
||||
opts.ziti_dial = C.ziti_sdk_dial_cb(C.ziti_sdk_c_dial)
|
||||
opts.ziti_close = C.ziti_sdk_close_cb(C.ziti_sdk_c_close)
|
||||
opts.ziti_write = C.ziti_sdk_write_cb(C.ziti_sdk_c_write)
|
||||
opts.ziti_host_v1 = C.ziti_sdk_host_v1_cb(C.ziti_sdk_c_host_v1)
|
||||
|
||||
t.tunCtx = C.ziti_tunneler_init(opts, _impl.libuvCtx.l)
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@ import (
|
||||
"github.com/openziti/desktop-edge-win/service/cziti/windns"
|
||||
)
|
||||
|
||||
var domains []string // get any connection-specific local domains
|
||||
|
||||
func processDNSquery(packet []byte, p *net.UDPAddr, s *net.UDPConn) {
|
||||
q := &dns.Msg{}
|
||||
if err := q.Unpack(packet); err != nil {
|
||||
@@ -46,8 +48,24 @@ func processDNSquery(packet []byte, p *net.UDPAddr, s *net.UDPConn) {
|
||||
|
||||
var ip net.IP
|
||||
// fmt.Printf("query: Type(%d) name(%s)\n", query.Qtype, query.Name)
|
||||
dnsName := strings.TrimSpace(query.Name)
|
||||
ip = DNS.Resolve(dnsName)
|
||||
|
||||
ip = DNS.Resolve(query.Name)
|
||||
// never proxy hostnames that we know about regardless of type
|
||||
if ip == nil {
|
||||
// no direct hit. need to now check to see if the dns query used a connection-specific local domain
|
||||
for _, d := range domains {
|
||||
if strings.HasSuffix(dnsName, d) {
|
||||
dnsNameTrimmed := strings.Trim(dnsName, d)
|
||||
// dns request has domain appended - removing and resolving
|
||||
ip = DNS.Resolve(dnsNameTrimmed)
|
||||
if ip != nil {
|
||||
log.Debugf("DNS %s failed at first but succeeded by looking up %s", dnsName, dnsNameTrimmed)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// never proxy hostnames that we know about regardless of type
|
||||
if ip != nil {
|
||||
@@ -167,6 +185,7 @@ func dnsPanicRecover() {
|
||||
}
|
||||
|
||||
func runDNSproxy(dnsServers []string) {
|
||||
domains = windns.GetConnectionSpecificDomains()
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
log.Errorf("Recovered in f. %v", err)
|
||||
|
||||
@@ -43,7 +43,7 @@ var DNS = &dnsImpl{}
|
||||
|
||||
type dnsImpl struct {
|
||||
cidr uint32
|
||||
counter uint32
|
||||
ipCount uint32
|
||||
|
||||
serviceMap map[string]ctxService
|
||||
|
||||
@@ -67,12 +67,13 @@ type ctxService struct {
|
||||
}
|
||||
|
||||
func normalizeDnsName(dnsName string) string {
|
||||
if strings.HasSuffix(dnsName, ".") {
|
||||
return dnsName
|
||||
} else {
|
||||
dnsName = strings.TrimSpace(dnsName)
|
||||
if !strings.HasSuffix(dnsName, ".") {
|
||||
// append a period to the dnsName - forcing it to be a FQDN
|
||||
return dnsName + "."
|
||||
dnsName += "."
|
||||
}
|
||||
|
||||
return strings.ToLower(dnsName) //normalize the casing
|
||||
}
|
||||
|
||||
// RegisterService will return the next ip address in the configured range. If the ip address is not
|
||||
@@ -115,7 +116,7 @@ func (dns *dnsImpl) RegisterService(svcId string, dnsNameToReg string, port uint
|
||||
}
|
||||
} else {
|
||||
// if not used at all - map it
|
||||
nextAddr := dns.cidr | atomic.AddUint32(&dns.counter, 1)
|
||||
nextAddr := dns.cidr | atomic.AddUint32(&dns.ipCount, 1)
|
||||
ip = make(net.IP, 4)
|
||||
binary.BigEndian.PutUint32(ip, nextAddr)
|
||||
|
||||
@@ -145,7 +146,7 @@ func (dns *dnsImpl) DeregisterService(ctx *CZitiCtx, name string) {
|
||||
for k, sc := range dns.serviceMap {
|
||||
if sc.ctx == ctx && sc.name == name {
|
||||
if sc.count < 1 {
|
||||
log.Infof("removing %s from DNS mapping", name)
|
||||
log.Infof("removing service named %s from DNS mapping known as %s", name, k)
|
||||
delete(dns.serviceMap, k)
|
||||
} else {
|
||||
// another service is using the mapping - can't remove it yet so decrement
|
||||
@@ -182,6 +183,6 @@ func DnsInit(ip string, maskBits int) {
|
||||
i := net.ParseIP(ip).To4()
|
||||
mask := net.CIDRMask(maskBits, 32)
|
||||
DNS.cidr = binary.BigEndian.Uint32(i) & binary.BigEndian.Uint32(mask)
|
||||
DNS.counter = 2
|
||||
DNS.ipCount = 2
|
||||
})
|
||||
}
|
||||
|
||||
+19
-2
@@ -21,6 +21,7 @@ package cziti
|
||||
#cgo windows LDFLAGS: -l libziti.imp -luv -lws2_32 -lpsapi
|
||||
|
||||
#include <ziti/ziti.h>
|
||||
#include "ziti/ziti_tunneler.h"
|
||||
|
||||
#include "sdk.h"
|
||||
extern void initCB(ziti_context nf, int status, void *ctx);
|
||||
@@ -136,8 +137,8 @@ func (c *CZitiCtx) Controller() string {
|
||||
var tunCfgName = C.CString("ziti-tunneler-client.v1")
|
||||
|
||||
//export serviceCB
|
||||
func serviceCB(_ C.ziti_context, service *C.ziti_service, status C.int, data unsafe.Pointer) {
|
||||
ctx := (*CZitiCtx)(data)
|
||||
func serviceCB(ziti_ctx C.ziti_context, service *C.ziti_service, status C.int, tnlr_ctx unsafe.Pointer) {
|
||||
ctx := (*CZitiCtx)(tnlr_ctx)
|
||||
|
||||
if ctx.Services == nil {
|
||||
m := sync.Map{} //make(map[string]Service)
|
||||
@@ -162,6 +163,22 @@ func serviceCB(_ C.ziti_context, service *C.ziti_service, status C.int, data uns
|
||||
log.Warnf("could not find a service with id: %s, name: %s", service.id, service.name)
|
||||
}
|
||||
} else if status == C.ZITI_OK {
|
||||
|
||||
if C.ZITI_CAN_BIND == ( service.perm_flags & C.ZITI_CAN_BIND ) {
|
||||
var v1Config C.ziti_server_cfg_v1
|
||||
// get_config_rc = ziti_service_get_config(service, "ziti-tunneler-server.v1", &v1_config, parse_ziti_server_cfg_v1);
|
||||
// int ziti_service_get_config(ziti_service *service, const char *cfg_type, void *cfg, int (*parser)(void *, const char *, size_t))
|
||||
r := C.ziti_service_get_config(service, C.CString("ziti-tunneler-server.v1"), unsafe.Pointer(&v1Config), (*[0]byte)(C.parse_ziti_server_cfg_v1))
|
||||
if (r == 0) {
|
||||
for _, t := range devMap {
|
||||
C.ziti_tunneler_host_v1(C.tunneler_context(t.tunCtx), unsafe.Pointer(ctx.zctx), service.name, v1Config.protocol, v1Config.hostname, v1Config.port)
|
||||
}
|
||||
C.free_ziti_server_cfg_v1(&v1Config)
|
||||
} else {
|
||||
log.Infof("service is bindable but doesn't have config? %s. flags: %v.", name, service.perm_flags)
|
||||
}
|
||||
}
|
||||
|
||||
cfg := C.ziti_service_get_raw_config(service, tunCfgName)
|
||||
|
||||
host := ""
|
||||
|
||||
@@ -43,6 +43,34 @@ func ResetDNS() {
|
||||
}
|
||||
}
|
||||
|
||||
func GetConnectionSpecificDomains() []string {
|
||||
script := `Get-DnsClient | Select-Object ConnectionSpecificSuffix | Get-Unique | ForEach-Object { $_.ConnectionSpecificSuffix }`
|
||||
|
||||
cmd := exec.Command("powershell", "-Command", script)
|
||||
cmd.Stderr = os.Stdout
|
||||
output := new(bytes.Buffer)
|
||||
cmd.Stdout = output
|
||||
|
||||
err := cmd.Run()
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
var names []string
|
||||
for {
|
||||
domain, err := output.ReadString('\n')
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
domain = strings.TrimSpace(domain)
|
||||
if !strings.HasSuffix(domain, ".") {
|
||||
names = append(names, domain + ".")
|
||||
}
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
func GetUpstreamDNS() []string {
|
||||
script := `Get-DnsClientServerAddress | ForEach-Object { $_.ServerAddresses } | Sort-Object | Get-Unique`
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
hi
|
||||
Reference in New Issue
Block a user