Merge pull request #181 from openziti/issue-180-monitor-updates

Issue 180 monitor updates
This commit is contained in:
dovholuknf
2020-11-01 23:29:17 -05:00
committed by GitHub
33 changed files with 1393 additions and 1068 deletions
+2 -1
View File
@@ -115,9 +115,10 @@ namespace ZitiDesktopEdge
_downloadUrl = asset.Property("browser_download_url").Value.ToString();
break;
}
} catch
} catch(Exception ex)
{
UpdateAvailable.Content = "An exception occurred while performing upgrade check";
Debug.WriteLine("Error when checking for version: " + ex.Message);
UpdateAvailable.Visibility = Visibility.Visible;
}
}
+3 -4
View File
@@ -3,14 +3,14 @@ using System.Collections.Generic;
using System.Windows;
using System.Windows.Input;
using System.IO;
using ZitiDesktopEdge.Models;
using ZitiDesktopEdge.ServiceClient;
using System.ServiceProcess;
using System.Linq;
using System.Diagnostics;
using System.Windows.Controls;
using System.Drawing;
using ZitiDesktopEdge.Models;
using ZitiDesktopEdge.ServiceClient;
namespace ZitiDesktopEdge {
@@ -28,10 +28,9 @@ namespace ZitiDesktopEdge {
private bool _isServiceInError = false;
private int _right = 75;
private int _left = 75;
private int _bottom = 0;
private int _top = 30;
private double _maxHeight = 800d;
private string[] suffixes = { "bps", "kbps", "mbps", "gbps", "tbps", "pbps" };
private string[] suffixes = { "Bps", "kBps", "mBps", "gBps", "tBps", "pBps" };
private List<ZitiIdentity> identities {
get {
-1
View File
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System;
using System.Runtime.InteropServices;
using System.Drawing;
using System.ComponentModel;
+371 -367
View File
@@ -1,368 +1,372 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FA4291EA-A97E-4854-959F-91EE7B330B37}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Ziti.Desktop.Edge</RootNamespace>
<AssemblyName>ZitiDesktopEdge</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<SupportUrl>https://support.netfoundry.io</SupportUrl>
<TargetCulture>en-US</TargetCulture>
<ProductName>Ziti Desktop Edge</ProductName>
<PublisherName>NetFoundry</PublisherName>
<SuiteName>Ziti</SuiteName>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.2.8.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>189AAD422A106DC81E8E79C7E0D2118CEB2E6321</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>
</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Releases|AnyCPU'">
<OutputPath>bin\Releases\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ziti.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.Management.Automation.dll.10.0.10586.0\lib\net40\System.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="System.Management.Instrumentation" />
<Reference Include="System.Net" />
<Reference Include="System.Net.NetworkInformation, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.NetworkInformation.4.3.0\lib\net46\System.Net.NetworkInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ControllerScreen.xaml.cs">
<DependentUpon>ControllerScreen.xaml</DependentUpon>
</Compile>
<Compile Include="IdentityDetails.xaml.cs">
<DependentUpon>IdentityDetails.xaml</DependentUpon>
</Compile>
<Compile Include="MainMenu.xaml.cs">
<DependentUpon>MainMenu.xaml</DependentUpon>
</Compile>
<Compile Include="Models\UILog.cs" />
<Compile Include="Models\UIModel.cs" />
<Compile Include="Views\ItemRenderers\ServiceInfo.xaml.cs">
<DependentUpon>ServiceInfo.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ItemRenderers\MenuEditItem.xaml.cs">
<DependentUpon>MenuEditItem.xaml</DependentUpon>
</Compile>
<Compile Include="ServiceClient\DataStructures.cs" />
<Compile Include="ServiceClient\ClientImpl.cs" />
<Compile Include="RegistrationScreen.xaml.cs">
<DependentUpon>RegistrationScreen.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ItemRenderers\SubOptionItem.xaml.cs">
<DependentUpon>SubOptionItem.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ItemRenderers\SubMenuItem.xaml.cs">
<DependentUpon>SubMenuItem.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ItemRenderers\MenuItem.xaml.cs">
<DependentUpon>MenuItem.xaml</DependentUpon>
</Compile>
<Compile Include="Models\ZitiIdentity.cs" />
<Compile Include="Models\ZitiService.cs" />
<Compile Include="Toggler.xaml.cs">
<DependentUpon>Toggler.xaml</DependentUpon>
</Compile>
<Compile Include="WinAPI.cs" />
<Page Include="ControllerScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="IdentityDetails.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ItemRenderers\IdentityItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainMenu.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Views\ItemRenderers\IdentityItem.xaml.cs">
<DependentUpon>IdentityItem.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Views\ItemRenderers\ServiceInfo.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\ItemRenderers\MenuEditItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="RegistrationScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ItemRenderers\SubOptionItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\ItemRenderers\SubMenuItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\ItemRenderers\MenuItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Toggler.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="ZitiDesktopEdge_TemporaryKey.pfx" />
<Resource Include="Assets\Fonts\open_sans.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Fonts\russo_one.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<None Include="..\.editorconfig">
<Link>.editorconfig</Link>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\icon.ico" />
<Resource Include="Assets\Images\icon.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\identity.png" />
<Resource Include="Assets\Images\jwt.png" />
<Resource Include="Assets\Images\loading.png" />
<Resource Include="Assets\Images\logo.png" />
<Resource Include="Assets\Images\next.png" />
<Resource Include="Assets\Images\off.png" />
<Resource Include="Assets\Images\offline.png" />
<Resource Include="Assets\Images\on.png" />
<Resource Include="Assets\Images\online.png" />
<Resource Include="Assets\Images\open.png" />
<Resource Include="Assets\Images\privacy.png" />
<Resource Include="Assets\Images\qr.png" />
<Resource Include="Assets\Images\select.png" />
<Resource Include="Assets\Images\support.png" />
<Resource Include="Assets\Images\up.png" />
<Resource Include="Assets\Images\z.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\about.png" />
<Resource Include="Assets\Images\advanced.png" />
<Resource Include="Assets\Images\appicon.png" />
<Resource Include="Assets\Images\back.png" />
<Resource Include="Assets\Images\background.png" />
<Resource Include="Assets\Images\bubble.png" />
<Resource Include="Assets\Images\card.png" />
<Resource Include="Assets\Images\close.png" />
<Resource Include="Assets\Images\closer.png" />
<Resource Include="Assets\Images\connect.png" />
<Resource Include="Assets\Images\connected.png" />
<Resource Include="Assets\Images\dashboard.png" />
<Resource Include="Assets\Images\down.png" />
<Resource Include="Assets\Images\feedback.png" />
<Resource Include="Assets\Images\globe.png" />
<Resource Include="Assets\Images\hamburger.png" />
<Resource Include="Assets\Images\header.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\x.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\nextArrow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\lastArrow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\logs.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\wrench.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\detach.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\ziti-green.ico" />
<Resource Include="Assets\Images\Ziti-Green.png" />
<Resource Include="Assets\Images\ziti-red.ico" />
<Resource Include="Assets\Images\Ziti-Red.png" />
<Resource Include="Assets\Images\ziti-white.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Images\Ziti-White.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="ziti.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\server.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Views\Controls\" />
<Folder Include="Views\Screens\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\Warning.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\No_Services.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\Success.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FA4291EA-A97E-4854-959F-91EE7B330B37}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Ziti.Desktop.Edge</RootNamespace>
<AssemblyName>ZitiDesktopEdge</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<SupportUrl>https://support.netfoundry.io</SupportUrl>
<TargetCulture>en-US</TargetCulture>
<ProductName>Ziti Desktop Edge</ProductName>
<PublisherName>NetFoundry</PublisherName>
<SuiteName>Ziti</SuiteName>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.2.8.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>189AAD422A106DC81E8E79C7E0D2118CEB2E6321</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>
</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Releases|AnyCPU'">
<OutputPath>bin\Releases\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ziti.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.Management.Automation.dll.10.0.10586.0\lib\net40\System.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="System.Management.Instrumentation" />
<Reference Include="System.Net" />
<Reference Include="System.Net.NetworkInformation, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.NetworkInformation.4.3.0\lib\net46\System.Net.NetworkInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="ControllerScreen.xaml.cs">
<DependentUpon>ControllerScreen.xaml</DependentUpon>
</Compile>
<Compile Include="IdentityDetails.xaml.cs">
<DependentUpon>IdentityDetails.xaml</DependentUpon>
</Compile>
<Compile Include="MainMenu.xaml.cs">
<DependentUpon>MainMenu.xaml</DependentUpon>
</Compile>
<Compile Include="Models\UILog.cs" />
<Compile Include="Models\UIModel.cs" />
<Compile Include="Views\ItemRenderers\ServiceInfo.xaml.cs">
<DependentUpon>ServiceInfo.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ItemRenderers\MenuEditItem.xaml.cs">
<DependentUpon>MenuEditItem.xaml</DependentUpon>
</Compile>
<Compile Include="RegistrationScreen.xaml.cs">
<DependentUpon>RegistrationScreen.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ItemRenderers\SubOptionItem.xaml.cs">
<DependentUpon>SubOptionItem.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ItemRenderers\SubMenuItem.xaml.cs">
<DependentUpon>SubMenuItem.xaml</DependentUpon>
</Compile>
<Compile Include="Views\ItemRenderers\MenuItem.xaml.cs">
<DependentUpon>MenuItem.xaml</DependentUpon>
</Compile>
<Compile Include="Models\ZitiIdentity.cs" />
<Compile Include="Models\ZitiService.cs" />
<Compile Include="Toggler.xaml.cs">
<DependentUpon>Toggler.xaml</DependentUpon>
</Compile>
<Compile Include="WinAPI.cs" />
<Page Include="ControllerScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="IdentityDetails.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ItemRenderers\IdentityItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainMenu.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Views\ItemRenderers\IdentityItem.xaml.cs">
<DependentUpon>IdentityItem.xaml</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Views\ItemRenderers\ServiceInfo.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\ItemRenderers\MenuEditItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="RegistrationScreen.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\ItemRenderers\SubOptionItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\ItemRenderers\SubMenuItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\ItemRenderers\MenuItem.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Toggler.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.manifest" />
<None Include="ZitiDesktopEdge_TemporaryKey.pfx" />
<Resource Include="Assets\Fonts\open_sans.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Fonts\russo_one.ttf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<None Include="..\.editorconfig">
<Link>.editorconfig</Link>
</None>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\icon.ico" />
<Resource Include="Assets\Images\icon.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\identity.png" />
<Resource Include="Assets\Images\jwt.png" />
<Resource Include="Assets\Images\loading.png" />
<Resource Include="Assets\Images\logo.png" />
<Resource Include="Assets\Images\next.png" />
<Resource Include="Assets\Images\off.png" />
<Resource Include="Assets\Images\offline.png" />
<Resource Include="Assets\Images\on.png" />
<Resource Include="Assets\Images\online.png" />
<Resource Include="Assets\Images\open.png" />
<Resource Include="Assets\Images\privacy.png" />
<Resource Include="Assets\Images\qr.png" />
<Resource Include="Assets\Images\select.png" />
<Resource Include="Assets\Images\support.png" />
<Resource Include="Assets\Images\up.png" />
<Resource Include="Assets\Images\z.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\about.png" />
<Resource Include="Assets\Images\advanced.png" />
<Resource Include="Assets\Images\appicon.png" />
<Resource Include="Assets\Images\back.png" />
<Resource Include="Assets\Images\background.png" />
<Resource Include="Assets\Images\bubble.png" />
<Resource Include="Assets\Images\card.png" />
<Resource Include="Assets\Images\close.png" />
<Resource Include="Assets\Images\closer.png" />
<Resource Include="Assets\Images\connect.png" />
<Resource Include="Assets\Images\connected.png" />
<Resource Include="Assets\Images\dashboard.png" />
<Resource Include="Assets\Images\down.png" />
<Resource Include="Assets\Images\feedback.png" />
<Resource Include="Assets\Images\globe.png" />
<Resource Include="Assets\Images\hamburger.png" />
<Resource Include="Assets\Images\header.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\x.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\nextArrow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\lastArrow.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\logs.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\wrench.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\detach.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\ziti-green.ico" />
<Resource Include="Assets\Images\Ziti-Green.png" />
<Resource Include="Assets\Images\ziti-red.ico" />
<Resource Include="Assets\Images\Ziti-Red.png" />
<Resource Include="Assets\Images\ziti-white.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Assets\Images\Ziti-White.png" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Resource Include="ziti.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\server.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Views\Controls\" />
<Folder Include="Views\Screens\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\Warning.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\No_Services.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\Images\Success.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ZitiDesktopEdge.Client\ZitiDesktopEdge.Client.csproj">
<Project>{26b30979-99b5-4102-bd0b-129bedff0057}</Project>
<Name>ZitiDesktopEdge.Client</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+11 -6
View File
@@ -8,7 +8,6 @@
<ROW Property="AI_FrameColor" Value="powderblue" MultiBuildValue="AnyCPU_Release:deepskyblue" MsiKey="AI_FrameColor"/>
<ROW Property="AI_ImagesColor" Value="powderblue" MsiKey="AI_ImagesColor"/>
<ROW Property="AI_PREDEF_LCONDS_PROPS" Value="AI_DETECTED_INTERNET_CONNECTION"/>
<ROW Property="AI_PROPPATH_PERBUILD_App.config" Value="..\ZitiUpdateService\bin\Release\App.config"/>
<ROW Property="AI_PROPPATH_PERBUILD_ZitiDesktopEdge.exe" Value="..\DesktopEdge\bin\Release\ZitiDesktopEdge.exe"/>
<ROW Property="AI_PROPPATH_PERBUILD_ZitiDesktopEdge.exe.config" Value="..\DesktopEdge\bin\Release\ZitiDesktopEdge.exe.config"/>
<ROW Property="AI_PROPPATH_PERBUILD_ZitiUpdateService.exe" Value="..\ZitiUpdateService\bin\Release\ZitiUpdateService.exe"/>
@@ -22,10 +21,12 @@
<ROW Property="ARPURLINFOABOUT" Value="https://ziti.dev"/>
<ROW Property="CTRLS" Value="2"/>
<ROW Property="Manufacturer" Value="NetFoundry, Inc."/>
<ROW Property="MsiLogging" MultiBuildValue="AnyCPU_Release:vp"/>
<ROW Property="ProductCode" Value="1033:{FEC3D10A-3B99-47A8-8C7C-753CD26D6377} " Type="16"/>
<ROW Property="ProductLanguage" Value="1033"/>
<ROW Property="ProductName" Value="Ziti Desktop Edge"/>
<ROW Property="ProductVersion" Value="1.3.0" Type="32"/>
<ROW Property="REBOOT" MultiBuildValue="AnyCPU_Release:Suppress"/>
<ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/>
<ROW Property="UpgradeCode" Value="{CB7E173A-663D-4A23-BB22-D1E8D885C2F3}"/>
<ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME#AnyCPU_Release:Windows 9x/ME" ValueLocId="-"/>
@@ -48,10 +49,12 @@
<COMPONENT cid="caphyon.advinst.msicomp.MsiCompsComponent">
<ROW Component="AI_ExePath" ComponentId="{F9B15650-F37D-424A-B159-B54B9F36EC2C}" Directory_="APPDIR" Attributes="260" KeyPath="AI_ExePath"/>
<ROW Component="APPDIR" ComponentId="{B3881A25-6890-4920-9F69-CACA0C9ABA63}" Directory_="APPDIR" Attributes="0"/>
<ROW Component="App.config" ComponentId="{27FAD46C-8379-4680-8506-4BCBA5A012E8}" Directory_="APPDIR" Attributes="0" KeyPath="App.config" Type="0"/>
<ROW Component="App.config" ComponentId="{27FAD46C-8379-4680-8506-4BCBA5A012E8}" Directory_="APPDIR" Attributes="0" KeyPath="ZitiDesktopEdge.exe.config" Type="0"/>
<ROW Component="NLog.dll" ComponentId="{384D38B5-A4A0-4BC6-886A-82153E2687ED}" Directory_="APPDIR" Attributes="0" KeyPath="NLog.dll"/>
<ROW Component="Newtonsoft.Json.dll" ComponentId="{5D7B59CE-A1B5-4EE9-842E-0206408F8674}" Directory_="APPDIR" Attributes="0" KeyPath="Newtonsoft.Json.dll"/>
<ROW Component="ProductInformation" ComponentId="{4FC3A7CB-D334-466A-A919-E6A237EF4443}" Directory_="APPDIR" Attributes="260" KeyPath="Version"/>
<ROW Component="SHORTCUTDIR" ComponentId="{3A88A759-A3FE-443F-A6D9-0D97BA424B2E}" Directory_="SHORTCUTDIR" Attributes="0"/>
<ROW Component="ZitiDesktopEdge.Client.dll" ComponentId="{7834CBFB-BA9A-4337-9603-507C71135B01}" Directory_="APPDIR" Attributes="0" KeyPath="ZitiDesktopEdge.Client.dll"/>
<ROW Component="ZitiDesktopEdge.exe" ComponentId="{FDDCF14B-4FAF-469F-810E-0877A0DD5F3B}" Directory_="APPDIR" Attributes="0" KeyPath="ZitiDesktopEdge.exe"/>
<ROW Component="ZitiUpdateService.exe" ComponentId="{01B4F535-D4A3-44CD-BB2D-A3A905A095D6}" Directory_="APPDIR" Attributes="0" KeyPath="ZitiUpdateService.exe"/>
<ROW Component="libgcc_s_seh1.dll" ComponentId="{B97B6447-8941-4F04-AA22-50D34E0A0F1A}" Directory_="APPDIR" Attributes="256" KeyPath="libgcc_s_seh1.dll"/>
@@ -66,7 +69,6 @@
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiFilesComponent">
<ROW File="ZitiDesktopEdge.exe" Component_="ZitiDesktopEdge.exe" FileName="ZITIDE~1.EXE|ZitiDesktopEdge.exe" Attributes="0" SourcePath="&lt;AI_APPPATH_PERBUILD_ZitiDesktopEdge.exe&gt;" SelfReg="false" DigSign="true"/>
<ROW File="App.config" Component_="App.config" FileName="APP~1.CON|App.config" Attributes="0" SourcePath="&lt;AI_APPPATH_PERBUILD_App.config&gt;" SelfReg="false"/>
<ROW File="ZitiDesktopEdge.exe.config" Component_="App.config" FileName="ZITIDE~1.CON|ZitiDesktopEdge.exe.config" Attributes="0" SourcePath="&lt;AI_APPPATH_PERBUILD_ZitiDesktopEdge.exe.config&gt;" SelfReg="false"/>
<ROW File="ZitiUpdateService.exe" Component_="ZitiUpdateService.exe" FileName="ZITIUP~1.EXE|ZitiUpdateService.exe" Attributes="0" SourcePath="&lt;AI_APPPATH_PERBUILD_ZitiUpdateService.exe&gt;" SelfReg="false" DigSign="true"/>
<ROW File="ZitiUpdateService.exe.config" Component_="App.config" FileName="ZITIUP~1.CON|ZitiUpdateService.exe.config" Attributes="0" SourcePath="&lt;AI_APPPATH_PERBUILD_ZitiUpdateService.exe.config&gt;" SelfReg="false"/>
@@ -78,9 +80,10 @@
<ROW File="ziti.ico" Component_="App.config" FileName="ziti.ico" Attributes="0" SourcePath="ziti.ico" SelfReg="false"/>
<ROW File="Newtonsoft.Json.dll" Component_="Newtonsoft.Json.dll" FileName="NEWTON~1.DLL|Newtonsoft.Json.dll" Attributes="0" SourcePath="..\DesktopEdge\bin\Release\Newtonsoft.Json.dll" SelfReg="false"/>
<ROW File="collectlogs.ps1" Component_="App.config" FileName="COLLEC~1.PS1|collect-logs.ps1" Attributes="0" SourcePath="collect-logs.ps1" SelfReg="false"/>
<ROW File="ZitiDesktopEdge.Client.dll" Component_="ZitiDesktopEdge.Client.dll" FileName="ZITIDE~1.DLL|ZitiDesktopEdge.Client.dll" Attributes="0" SourcePath="..\ZitiDesktopEdge.Client\bin\Release\ZitiDesktopEdge.Client.dll" SelfReg="false"/>
<ROW File="NLog.dll" Component_="NLog.dll" FileName="NLog.dll" Attributes="0" SourcePath="..\ZitiUpdateService\bin\Release\NLog.dll" SelfReg="false"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.AppPathsComponent">
<ROW Name="AI_APPPATH_PERBUILD_App.config" Path="[|AI_PROPPATH_PERBUILD_App.config]" Type="2" Content="0"/>
<ROW Name="AI_APPPATH_PERBUILD_ZitiDesktopEdge.exe" Path="[|AI_PROPPATH_PERBUILD_ZitiDesktopEdge.exe]" Type="2" Content="0"/>
<ROW Name="AI_APPPATH_PERBUILD_ZitiDesktopEdge.exe.config" Path="[|AI_PROPPATH_PERBUILD_ZitiDesktopEdge.exe.config]" Type="2" Content="0"/>
<ROW Name="AI_APPPATH_PERBUILD_ZitiUpdateService.exe" Path="[|AI_PROPPATH_PERBUILD_ZitiUpdateService.exe]" Type="2" Content="0"/>
@@ -211,6 +214,8 @@
<ROW Feature_="MainFeature" Component_="ziti.dll"/>
<ROW Feature_="MainFeature" Component_="zititunnel.exe"/>
<ROW Feature_="MainFeature" Component_="Newtonsoft.Json.dll"/>
<ROW Feature_="MainFeature" Component_="ZitiDesktopEdge.Client.dll"/>
<ROW Feature_="MainFeature" Component_="NLog.dll"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiIconsComponent">
<ROW Name="ziti.exe" SourcePath="ziti.ico" Index="0"/>
@@ -265,11 +270,11 @@
<ROW Registry="Version" Root="-1" Key="Software\[Manufacturer]\[ProductName]" Name="Version" Value="[ProductVersion]" Component_="ProductInformation"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiServCtrlComponent">
<ROW ServiceControl="ZitiUpdateService.exe" Name="ziti-monitor" Event="160" Wait="0" Component_="ZitiUpdateService.exe"/>
<ROW ServiceControl="ZitiUpdateService.exe" Name="ziti-monitor" Event="161" Wait="0" Component_="ZitiUpdateService.exe"/>
<ROW ServiceControl="zititunnel.exe" Name="ziti" Event="161" Wait="0" Component_="zititunnel.exe"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiServInstComponent">
<ROW ServiceInstall="ZitiUpdateService.exe" Name="ziti-monitor" DisplayName="Ziti Desktop Monitor Service" ServiceType="16" StartType="2" ErrorControl="1" Component_="ZitiUpdateService.exe" Description="Monitors and updates the Ziti Access Service"/>
<ROW ServiceInstall="ZitiUpdateService.exe" Name="ziti-monitor" DisplayName="Ziti Desktop Monitor Service" ServiceType="16" StartType="2" ErrorControl="32769" Component_="ZitiUpdateService.exe" Description="Monitors and updates the Ziti Access Service"/>
<ROW ServiceInstall="zititunnel.exe" Name="ziti" DisplayName="Ziti Desktop Edge Service" ServiceType="16" StartType="2" ErrorControl="32769" Component_="zititunnel.exe" Description="Access your Networks Secured by Ziti"/>
</COMPONENT>
<COMPONENT cid="caphyon.advinst.msicomp.MsiShortsComponent">
+9 -2
View File
@@ -52,8 +52,15 @@ if($gituser -eq "ziti-ci") {
} else {
echo "detected ziti-ci - but no gh_deploy_key. push may fail"
}
git commit -m "[ci skip] committing updated installer file" 2>&1
git push 2>&1
$b="$env:GIT_BRANCH"
if( $b -match '(^master$|^release-[0-9]*\.[0-9]*\.[0-9]*)' ) {
echo "branch $b matches the required regex - committing and pushing"
git commit -m "[ci skip] committing updated installer file" 2>&1
git push 2>&1
} else {
echo "branch $b does not match the regex. no commit/no push"
}
} else {
echo "detected user [${gituser}] which is not ziti-ci - skipping installer commit"
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ZitiDesktopEdge.Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ZitiDesktopEdge.Client")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("26b30979-99b5-4102-bd0b-129bedff0057")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -9,9 +9,6 @@ using System.Security.AccessControl;
using Newtonsoft.Json;
using System.Threading;
using System.Threading.Tasks;
using System.Runtime.Remoting.Contexts;
using System.Windows.Interop;
using System.Windows.Documents;
/// <summary>
/// The implementation will abstract away the setup of the communication to
@@ -35,7 +32,7 @@ namespace ZitiDesktopEdge.ServiceClient
VERBOSE = 6,
}
internal class Client
public class Client
{
public const int EXPECTED_API_VERSION = 1;
@@ -46,63 +43,48 @@ namespace ZitiDesktopEdge.ServiceClient
public event EventHandler<ServiceEvent> OnServiceEvent;
public event EventHandler<object> OnClientConnected;
public event EventHandler<object> OnClientDisconnected;
public event EventHandler<StatusEvent> OnShutdownEvent;
public bool CleanShutdown { get; set; }
protected virtual void ShutdownEvent(StatusEvent e) {
CleanShutdown = true;
OnShutdownEvent?.Invoke(this, e);
}
protected virtual void TunnelStatusEvent(TunnelStatusEvent e)
{
EventHandler<TunnelStatusEvent> handler = OnTunnelStatusEvent;
if (handler != null)
{
handler(this, e);
}
OnTunnelStatusEvent?.Invoke(this, e);
}
protected virtual void MetricsEvent(List<Identity> e)
{
EventHandler<List<Identity>> handler = OnMetricsEvent;
if (handler != null)
{
handler(this, e);
}
OnMetricsEvent?.Invoke(this, e);
}
protected virtual void IdentityEvent(IdentityEvent e)
{
EventHandler<IdentityEvent> handler = OnIdentityEvent;
if (handler != null)
{
handler(this, e);
}
OnIdentityEvent?.Invoke(this, e);
}
protected virtual void ServiceEvent(ServiceEvent e)
{
EventHandler<ServiceEvent> handler = OnServiceEvent;
if (handler != null)
{
handler(this, e);
}
OnServiceEvent?.Invoke(this, e);
}
protected virtual void ClientConnected(object e)
{
Connected = true;
this.Reconnecting = false;
EventHandler<object> handler = OnClientConnected;
if (handler != null)
{
handler(this, e);
}
Reconnecting = false;
CleanShutdown = true;
OnClientConnected?.Invoke(this, e);
}
protected virtual void ClientDisconnected(object e)
{
Reconnect();
Connected = false;
EventHandler<object> handler = OnClientDisconnected;
if (handler != null)
{
handler(this, e);
}
OnClientDisconnected?.Invoke(this, e);
}
JsonSerializer serializer = new JsonSerializer();
@@ -121,7 +103,7 @@ namespace ZitiDesktopEdge.ServiceClient
NamedPipeClientStream eventClient = null;
#if DEBUG
bool _extendedDebug = true; //set this to true if you need to diagnose issues with the service comms
bool _extendedDebug = false; //set ZITI_EXTENDED_DEBUG env var to true if you want to diagnose issues with the service comms
#else
bool _extendedDebug = false;
#endif
@@ -156,6 +138,12 @@ namespace ZitiDesktopEdge.ServiceClient
setupPipe();
}
public void WaitForConnection() {
while(Reconnecting || !Connected) {
Task.Delay(100).Wait();
}
}
public void Reconnect()
{
if (Reconnecting)
@@ -183,7 +171,7 @@ namespace ZitiDesktopEdge.ServiceClient
if (Connected)
{
Debug.WriteLine("Connected to the service - exiting reconect loop");
this.Connected = true;
Connected = true;
Reconnecting = false;
return;
}
@@ -192,10 +180,8 @@ namespace ZitiDesktopEdge.ServiceClient
//ClientDisconnected(null);
}
}
catch
{
//fire the event and just try it all over....
//ClientDisconnected(null);
catch (Exception ex) {
Debug.WriteLine("Service error: " + ex.Message);
}
Debug.WriteLine("Reconnect failed. Trying again...");
}
@@ -344,11 +330,11 @@ namespace ZitiDesktopEdge.ServiceClient
private void checkConnected()
{
if (this.Reconnecting)
if (Reconnecting)
{
throw new ServiceException("Client is not connected", 2, "Cannot use the client at this time, it is reconnecting");
}
if (!this.Connected)
if (!Connected)
{
throw new ServiceException("Client is not connected", 2, "Cannot use the client at this time, it is not connected");
}
@@ -500,9 +486,6 @@ namespace ZitiDesktopEdge.ServiceClient
try
{
string respAsString = readMessage(reader);
debugServiceCommunication("----------------------------------------------------------------------");
debugServiceCommunication(respAsString);
debugServiceCommunication("----------------------------------------------------------------------");
StatusEvent evt = (StatusEvent)serializer.Deserialize(new StringReader(respAsString), typeof(StatusEvent));
switch (evt.Op)
@@ -512,7 +495,7 @@ namespace ZitiDesktopEdge.ServiceClient
if (m != null)
{
this.MetricsEvent(m.Identities);
MetricsEvent(m.Identities);
}
break;
case "status":
@@ -520,7 +503,7 @@ namespace ZitiDesktopEdge.ServiceClient
if (se != null)
{
this.TunnelStatusEvent(se);
TunnelStatusEvent(se);
}
break;
case "identity":
@@ -528,7 +511,7 @@ namespace ZitiDesktopEdge.ServiceClient
if (id != null)
{
this.IdentityEvent(id);
IdentityEvent(id);
}
break;
case "service":
@@ -536,8 +519,11 @@ namespace ZitiDesktopEdge.ServiceClient
if (svc != null)
{
this.ServiceEvent(svc);
ServiceEvent(svc);
}
break;
case "shutdown":
break;
default:
Debug.WriteLine("unexpected operation! " + evt.Op);
@@ -7,7 +7,7 @@ using System.Collections.Generic;
/// </summary>
namespace ZitiDesktopEdge.ServiceClient
{
class SvcResponse
public class SvcResponse
{
public int Code { get; set; }
public string Message { get; set; }
@@ -19,12 +19,12 @@ namespace ZitiDesktopEdge.ServiceClient
}
}
class StatusUpdateResponse : SvcResponse
public class StatusUpdateResponse : SvcResponse
{
public StatusUpdate Payload { get; set; }
}
class StatusUpdate
public class StatusUpdate
{
public string Operation { get; set; }
public TunnelStatus Status { get; set; }
@@ -38,7 +38,7 @@ namespace ZitiDesktopEdge.ServiceClient
public Identity Id { get; set; }
}
class IdentityResponse : SvcResponse
public class IdentityResponse : SvcResponse
{
public Identity Payload { get; set; }
}
@@ -158,7 +158,7 @@ namespace ZitiDesktopEdge.ServiceClient
public string AdditionalCAs { get; set; }
}
class IpInfo
public class IpInfo
{
public string Ip { get; set; }
public string Subnet { get; set; }
@@ -166,7 +166,7 @@ namespace ZitiDesktopEdge.ServiceClient
public string DNS { get; set; }
}
class ServiceVersion
public class ServiceVersion
{
public string Version { get; set; }
public string Revision { get; set; }
@@ -178,12 +178,12 @@ namespace ZitiDesktopEdge.ServiceClient
}
}
class ZitiTunnelStatus : SvcResponse
public class ZitiTunnelStatus : SvcResponse
{
public TunnelStatus Status { get; set; }
}
class TunnelStatus
public class TunnelStatus
{
public bool Active { get; set; }
@@ -251,34 +251,34 @@ namespace ZitiDesktopEdge.ServiceClient
public string AdditionalInfo { get; }
}
class StatusEvent
public class StatusEvent
{
public string Op { get; set; }
}
class ActionEvent : StatusEvent
public class ActionEvent : StatusEvent
{
public string Action { get; set; }
}
class TunnelStatusEvent : StatusEvent
public class TunnelStatusEvent : StatusEvent
{
public TunnelStatus Status { get; set; }
public int ApiVersion { get; set; }
}
class MetricsEvent : StatusEvent
public class MetricsEvent : StatusEvent
{
public List<Identity> Identities { get; set; }
}
class ServiceEvent : ActionEvent
public class ServiceEvent : ActionEvent
{
public string Fingerprint { get; set; }
public Service Service { get; set; }
}
class IdentityEvent : ActionEvent
public class IdentityEvent : ActionEvent
{
public Identity Id { get; set; }
}
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{26B30979-99B5-4102-BD0B-129BEDFF0057}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ZitiDesktopEdge.Client</RootNamespace>
<AssemblyName>ZitiDesktopEdge.Client</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ServiceClient\ClientImpl.cs" />
<Compile Include="ServiceClient\DataStructures.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
</packages>
+99 -77
View File
@@ -1,77 +1,99 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29318.209
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D66B1C6A-ADFE-437E-B037-C4C849A6CA97}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZitiDesktopEdge", "DesktopEdge\ZitiDesktopEdge.csproj", "{FA4291EA-A97E-4854-959F-91EE7B330B37}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZitiUpdateService", "ZitiUpdateService\ZitiUpdateService.csproj", "{9AB81609-F5DD-40A6-87B5-F3279D48514D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|ARM.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|ARM.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|ARM64.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|x64.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|x64.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|x86.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|x86.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|Any CPU.Build.0 = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|ARM.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|ARM.Build.0 = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|ARM64.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|ARM64.Build.0 = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|x64.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|x64.Build.0 = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|x86.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|x86.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|ARM.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|ARM64.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|x64.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|x64.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|x86.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|x86.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|Any CPU.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|ARM.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|ARM.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|ARM64.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|ARM64.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|x64.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|x64.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|x86.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E499EAC-C1BA-41A0-8076-D660F8ACC977}
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29318.209
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D66B1C6A-ADFE-437E-B037-C4C849A6CA97}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
README.md = README.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZitiDesktopEdge", "DesktopEdge\ZitiDesktopEdge.csproj", "{FA4291EA-A97E-4854-959F-91EE7B330B37}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZitiUpdateService", "ZitiUpdateService\ZitiUpdateService.csproj", "{9AB81609-F5DD-40A6-87B5-F3279D48514D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZitiDesktopEdge.Client", "ZitiDesktopEdge.Client\ZitiDesktopEdge.Client.csproj", "{26B30979-99B5-4102-BD0B-129BEDFF0057}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|ARM.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|ARM.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|ARM64.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|x64.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|x64.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|x86.ActiveCfg = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Debug|x86.Build.0 = Debug|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|Any CPU.Build.0 = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|ARM.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|ARM.Build.0 = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|ARM64.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|ARM64.Build.0 = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|x64.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|x64.Build.0 = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|x86.ActiveCfg = Release|Any CPU
{FA4291EA-A97E-4854-959F-91EE7B330B37}.Release|x86.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|ARM.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|ARM.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|ARM64.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|x64.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|x64.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|x86.ActiveCfg = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Debug|x86.Build.0 = Debug|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|Any CPU.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|ARM.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|ARM.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|ARM64.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|ARM64.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|x64.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|x64.Build.0 = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|x86.ActiveCfg = Release|Any CPU
{9AB81609-F5DD-40A6-87B5-F3279D48514D}.Release|x86.Build.0 = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|ARM.ActiveCfg = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|ARM.Build.0 = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|ARM64.Build.0 = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|x64.ActiveCfg = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|x64.Build.0 = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|x86.ActiveCfg = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Debug|x86.Build.0 = Debug|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|Any CPU.ActiveCfg = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|Any CPU.Build.0 = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|ARM.ActiveCfg = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|ARM.Build.0 = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|ARM64.ActiveCfg = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|ARM64.Build.0 = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|x64.ActiveCfg = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|x64.Build.0 = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|x86.ActiveCfg = Release|Any CPU
{26B30979-99B5-4102-BD0B-129BEDFF0057}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E499EAC-C1BA-41A0-8076-D660F8ACC977}
EndGlobalSection
EndGlobal
+33 -32
View File
@@ -1,33 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="UpdateUrl" value="https://netfoundry.jfrog.io/netfoundry/ziti-maven-snapshot/ziti-tunnel-win/amd64/windows/ziti-tunnel-win/maven-metadata.xml"/>
<!--
Format for UpdateTimer is "hours:minutes:seconds" - none of the values can exceed the normal range of each tuple.
For example this is invalid: "0:60:0" because 60 is > 59. To represent every hour you would use "1:0:0"
This example shows a value that would check for updates every one hour, two minutes and three seconds
<add key="UpdateTimer" value="1:2:3"/>
This operation is should probably remain high such as "1:0:0" (every hour) or "1:0:0:0" (every day)
-->
<add key="UpdateTimer" value="0:1:0"/><!--default to look for updates once a minute-->
<add key="Version" value="release"/>
<!--
Format for ServiceTimer is "hours:minutes:seconds" - none of the values can exceed the normal range of each tuple.
For example this is invalid: "0:60:0" because 60 is > 59. To represent every hour you would use "1:0:0"
This example shows a value that would check for the health of the service every one hour, two minutes and three seconds
<add key="ServiceTimer" value="1:2:3"/>
This operation is fast and should probably remain low such as "0:1:0" (every minute) or "0:0:15" (every 15 seconds)
-->
<add key="ServiceTimer" value="0:0:5"/><!--default to verify the service is running every five seconds-->
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="UpdateUrl" value="https://api.github.com/repos/openziti/desktop-edge-win/releases/latest" />
<!--
Format for UpdateTimer is "hours:minutes:seconds" - none of the values can exceed the normal range of each tuple.
For example this is invalid: "0:60:0" because 60 is > 59. To represent every hour you would use "1:0:0"
This example shows a value that would check for updates every one hour, two minutes and three seconds
<add key="UpdateTimer" value="1:2:3"/>
This operation is should probably remain high such as "1:0:0" (every hour) or "1:0:0:0" (every day)
-->
<add key="UpdateTimer" value="0:1:0" />
<!--default to look for updates once a minute-->
<add key="Version" value="release" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
</configuration>
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ZitiUpdateService {
interface IUpdateCheck {
bool IsUpdateAvailable(Version current);
string FileName();
void CopyUpdatePackage(string destinationFolder, string destinationName);
bool AlreadyDownloaded(string destinationFolder, string destinationName);
}
}
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="logfile" xsi:type="File" fileName="file.txt" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile" />
</rules>
</nlog>
+51 -28
View File
@@ -1,28 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace ZitiUpdateService {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main() {
UpdateService updateSvc = new UpdateService();
#if DEBUG
updateSvc.Debug();
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
#else
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
updateSvc
};
ServiceBase.Run(ServicesToRun);
#endif
}
}
}
using System;
using System.ServiceProcess;
using NLog;
using NLog.Config;
using NLog.Targets;
namespace ZitiUpdateService {
static class Program {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main() {
//Environment.SetEnvironmentVariable("ZITI_EXTENDED_DEBUG", "true");
var config = new LoggingConfiguration();
var logname = "ziti-montior";
// Targets where to log to: File and Console
var logfile = new FileTarget("logfile") {
FileName = $"{logname}.log",
ArchiveEvery = FileArchivePeriod.Day,
ArchiveNumbering = ArchiveNumberingMode.Rolling,
MaxArchiveFiles = 7,
//ArchiveAboveSize = 10000,
};
var logconsole = new ConsoleTarget("logconsole");
// Rules for mapping loggers to targets
config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole);
config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);
// Apply config
LogManager.Configuration = config;
UpdateService updateSvc = new UpdateService();
#if DEBUG
updateSvc.Debug();
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
#else
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
updateSvc
};
ServiceBase.Run(ServicesToRun);
#endif
}
}
}
+35 -36
View File
@@ -1,36 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ZitiUpdateService")]
[assembly: AssemblyDescription("Ziti Monitor and Update Service")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NetFoundry")]
[assembly: AssemblyProduct("ZitiUpdateService")]
[assembly: AssemblyCopyright("Copyright © NetFoundry 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9ab81609-f5dd-40a6-87b5-f3279d48514d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ziti-monitor")]
[assembly: AssemblyDescription("Ziti Monitor and Update Service")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("NetFoundry")]
[assembly: AssemblyProduct("ZitiUpdateService")]
[assembly: AssemblyCopyright("Copyright © NetFoundry 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9ab81609-f5dd-40a6-87b5-f3279d48514d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
+27
View File
@@ -0,0 +1,27 @@
namespace ZitiUpdateService
{
public class ServiceMonitor
{
public void MonitorSrevice()
{
//a simple method that opens a pipe to the data service and tries to read data
//from the pipe. If the pipe doesn't respond
}
public void ResetNetwork()
{
}
public void ResetRouting()
{
}
public void ResetDNS()
{
}
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace ZitiUpdateService
{
public class ServiceUpdater
{
}
}
+8
View File
@@ -0,0 +1,8 @@
namespace ZitiUpdateService
{
public class UpdateChecker
{
}
}
+90
View File
@@ -0,0 +1,90 @@
using System;
using System.IO;
using System.Net;
using NLog;
using Newtonsoft.Json.Linq;
namespace ZitiUpdateService {
internal class GithubCheck : IUpdateCheck {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
string url;
string downloadUrl = null;
string downloadFileName = null;
public GithubCheck(string url) {
this.url = url;
}
public bool AlreadyDownloaded(string destinationFolder, string destinationName) {
return File.Exists(Path.Combine(destinationFolder, destinationName));
}
public void CopyUpdatePackage(string destinationFolder, string destinationName) {
WebClient webClient = new WebClient();
string dest = Path.Combine(destinationFolder, destinationName);
Logger.Info("download started: {0}", downloadUrl);
webClient.DownloadFile(downloadUrl, dest);
Logger.Info("download complete. file at {0}", dest);
}
public string FileName() {
return downloadFileName;
}
public bool IsUpdateAvailable(Version current) {
HttpWebRequest httpWebRequest = WebRequest.CreateHttp(url);
httpWebRequest.Method = "GET";
httpWebRequest.ContentType = "application/json";
httpWebRequest.UserAgent = "OpenZiti UpdateService";
HttpWebResponse httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
StreamReader streamReader = new StreamReader(httpResponse.GetResponseStream());
string result = streamReader.ReadToEnd();
JObject json = JObject.Parse(result);
string serverVersion = json.Property("tag_name").Value.ToString() + ".0";
Version published = new Version(serverVersion);
int compare = current.CompareTo(published);
if (compare < 0) {
Logger.Info("an upgrade is available.");
} else if (compare > 0) {
Logger.Info("the version installed is newer than the released version");
return false;
}
JArray assets = JArray.Parse(json.Property("assets").Value.ToString());
foreach (JObject asset in assets.Children<JObject>()) {
downloadUrl = asset.Property("browser_download_url").Value.ToString();
break;
}
if (downloadUrl == null) {
Logger.Error("DOWNLOAD URL not found at: {0}", url);
return false;
}
downloadFileName = downloadUrl.Substring(downloadUrl.LastIndexOf('/') + 1);
return true;
}
}
internal class FilesystemCheck : IUpdateCheck {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
string dest = null;
public bool AlreadyDownloaded(string destinationFolder, string destinationName) {
return File.Exists(Path.Combine(destinationFolder, destinationName));
}
public void CopyUpdatePackage(string destinationFolder, string destinationName) {
dest = Path.Combine(destinationFolder, destinationName);
File.Copy(@"C:\git\github\openziti\desktop-edge-win\Installer\Output\" + FileName(), dest);
}
public string FileName() {
return "Ziti Desktop Edge Client-1.3.0.exe";
}
public bool IsUpdateAvailable(Version current) {
return true;
}
}
}
+232 -258
View File
@@ -1,258 +1,232 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Timers;
using System.Management.Automation;
using System.Xml;
using System.Configuration;
using System.Collections.Specialized;
namespace ZitiUpdateService {
public partial class UpdateService : ServiceBase {
private int checkTimerDefault = 60000;
private int updateTimerDefault = 600000;
private string _version = "";
private bool _isNew = true;
/// private int _majorVersion = 1;
private string _versionUrl = "https://netfoundry.jfrog.io/netfoundry/ziti-maven-snapshot/ziti-tunnel-win/amd64/windows/ziti-tunnel-win/maven-metadata.xml";
private string _serviceUrl = "https://netfoundry.jfrog.io/netfoundry/ziti-maven-snapshot/ziti-tunnel-win/amd64/windows/ziti-tunnel-win/${version}/ziti-tunnel-win-${version}.zip";
private System.Timers.Timer _checkTimer = new System.Timers.Timer();
private System.Timers.Timer _updateTimer = new System.Timers.Timer();
private bool inUpdateCheck = false;
private bool inServiceCheck = false;
private string _rootDirectory = "";
private string _logDirectory = "";
private bool _isJustStopped = true;
private string _versionType = "latest";
ServiceController controller;
public UpdateService() {
InitializeComponent();
}
public void Debug() {
OnStart(null);
}
protected override void OnStart(string[] args) {
try {
if (ConfigurationManager.AppSettings.Get("UpdateUrl") != null) _versionUrl = ConfigurationManager.AppSettings.Get("UpdateUrl");
if (ConfigurationManager.AppSettings.Get("Version") != null) _versionType = ConfigurationManager.AppSettings.Get("Version");
} catch (Exception e) {
Log(e.ToString());
}
_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);
Log("Setup Watchers");
SetupServiceWatchers();
}
protected override void OnStop() {
Log("Stopping update Service");
}
private void SetupServiceWatchers() {
Log("Setting Up Watchers");
var serviceTimerInterval = ConfigurationManager.AppSettings.Get("ServiceTimer");
var serviceInt = TimeSpan.Zero;
if (!TimeSpan.TryParse(serviceTimerInterval, out serviceInt)) {
serviceInt = new TimeSpan(0, 1, 0);
}
var updateTimerInterval = ConfigurationManager.AppSettings.Get("UpdateTimer");
var upInt = TimeSpan.Zero;
if (!TimeSpan.TryParse(updateTimerInterval, out upInt)) {
upInt = new TimeSpan(0, 1, 0);
}
Log("Ziti Update Setting Up Watchers");
_checkTimer = new System.Timers.Timer();
_checkTimer.Elapsed += CheckService;
_checkTimer.Interval = serviceInt.TotalMilliseconds;
_checkTimer.Enabled = true;
_checkTimer.Start();
Log("Service Checker is running");
_updateTimer = new System.Timers.Timer();
_updateTimer.Elapsed += CheckUpdate;
_updateTimer.Interval = upInt.TotalMilliseconds;
_updateTimer.Enabled = true;
_updateTimer.Start();
Log("Version Checker is running");
CheckUpdate(null, null); //check immediately
}
private void CheckUpdate(object sender, ElapsedEventArgs e) {
if (inUpdateCheck) return;
inUpdateCheck = true; //simple semaphone
try {
var request = WebRequest.Create(_versionUrl) as HttpWebRequest;
var response = request.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
var result = readStream.ReadToEnd();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(result);
XmlNode node = xmlDoc.SelectSingleNode("metadata/versioning/" + _versionType);
string version = node.InnerText;
if (version != _version) {
Log("Version Checked: " + version + " on " + _version + " from " + _versionType);
UpdateServiceFiles(version);
}
} catch {
}
inUpdateCheck = false;
}
private void CheckService(object sender, ElapsedEventArgs e) {
if (inServiceCheck || inUpdateCheck) return;
inServiceCheck = true; //simple semaphone
try {
controller = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == "ziti");
if (controller == null) return; //means it's not installed or the user doesn't have privs
if (controller.Status == ServiceControllerStatus.Stopped || controller.Status == ServiceControllerStatus.StopPending) {
if (_isJustStopped) {
_isJustStopped = false;
Log("Ziti Service has been stopped, update Network");
//should not be necessary in v0.0.10+ RunScript();
StartZiti();
}
} else {
if (controller.Status == ServiceControllerStatus.Running) {
_isJustStopped = true;
}
}
} catch {
}
inServiceCheck = false;
}
private void UpdateServiceFiles(string currentVersion) {
var request = WebRequest.Create(_versionUrl) as HttpWebRequest;
var response = request.GetResponse();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
var result = readStream.ReadToEnd();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(result);
XmlNode node = xmlDoc.SelectSingleNode("metadata/versioning/"+_versionType);
string version = node.InnerText;
Log("Got Version: " + version+" from "+_versionType);
if (_version.Trim() == currentVersion.Trim()) {
_version = currentVersion;
Log("Version local is the same as the version remote: " + version);
return;
}
StopZiti();
string remoteService = _serviceUrl.Replace("${version}", version);
if (!Directory.Exists(Path.Combine(_rootDirectory, "Service"))) Directory.CreateDirectory(Path.Combine(_rootDirectory, "Service"));
string[] files = Directory.GetFiles(Path.Combine(_rootDirectory, "Service"));
foreach (string file in files) {
try {
Log("Delete: " + file);
File.Delete(file);
} catch (Exception e) {
EventLog.WriteEntry("Ziti", e.ToString(), EventLogEntryType.Error);
}
}
WebClient webClient = new WebClient();
Log("Get From: "+remoteService);
webClient.DownloadFile(remoteService, Path.Combine(_rootDirectory, "Service") + @"\windows-tunneler.zip");
Log("Zip Downloaded");
ZipFile.ExtractToDirectory(Path.Combine(_rootDirectory, "Service") + @"\windows-tunneler.zip", Path.Combine(_rootDirectory, "Service"));
Log("Zip UnZipped");
File.WriteAllText(Path.Combine(_rootDirectory, @"Service\Version.txt"), version);
_version = version;
if (_isNew) {
Log("Installing Service " + _version);
ProcessStartInfo installService = new ProcessStartInfo();
installService.CreateNoWindow = true;
installService.UseShellExecute = true;
installService.FileName = Path.Combine(_rootDirectory, "Service") + @"\ziti-tunnel.exe";
installService.WindowStyle = ProcessWindowStyle.Hidden;
installService.Arguments = "install";
Log("Install Using " + installService.FileName + " " + installService.Arguments);
try {
Process exeProcess = Process.Start(installService);
exeProcess.WaitForExit();
Log("Installed " + installService.FileName + " " + installService.Arguments);
} catch (Exception e) {
Log("Cannot Install Service - " + e.ToString());
}
} else {
// nothing to do
}
StartZiti();
}
private void RunScript() {
string scriptText = "get-netipinterface|ForEach-Object { Set-DnsClientServerAddress-InterfaceIndex $_.ifIndex-ResetServerAddresses}";
Log("Executing: " + scriptText);
using (PowerShell PowerShellInstance = PowerShell.Create()) {
PowerShellInstance.AddScript(scriptText);
IAsyncResult result = PowerShellInstance.BeginInvoke();
while (result.IsCompleted == false) {
Thread.Sleep(1000);
}
}
}
private void StartZiti() {
controller = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == "ziti");
if (controller != null && controller.Status != ServiceControllerStatus.Running && controller.Status != ServiceControllerStatus.StartPending && controller.Status != ServiceControllerStatus.ContinuePending) {
try {
Log("Starting Service");
controller.Start();
controller.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(30));
SetupServiceWatchers();
} catch (Exception e) {
Log("Cannot Start Service - " + e.ToString());
}
}
}
private void StopZiti() {
controller = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == "ziti");
if (controller != null && controller.Status != ServiceControllerStatus.Stopped) {
try {
controller.Stop();
controller.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(30));
} catch (Exception e) {
Log("Cannot Stop Service - " + e.ToString());
}
}
}
object logLock = new object();
private void Log(string message) {
lock (logLock) {
File.AppendAllText(Path.Combine(_logDirectory, @"Log.log"), DateTime.Now.ToString() + " " + message + '\n');
EventLog.WriteEntry("Ziti Update Service", message, EventLogEntryType.Information);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Timers;
using System.Management.Automation;
using System.Xml;
using System.Configuration;
using System.Threading.Tasks;
using ZitiDesktopEdge.ServiceClient;
using NLog;
using Newtonsoft.Json.Linq;
using System.Reflection;
using NLog.Config;
namespace ZitiUpdateService {
public partial class UpdateService : ServiceBase {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private string _version = "";
private bool _isNew = true;
private System.Timers.Timer _updateTimer = new System.Timers.Timer();
private bool inUpdateCheck = false;
private string _rootDirectory = "";
private string _logDirectory = "";
private string _versionType = "latest";
private Client svc = new Client();
private bool running = false;
ServiceController controller;
public UpdateService() {
InitializeComponent();
Logger.Info("Initializing");
svc.OnClientConnected += Svc_OnClientConnected;
svc.OnTunnelStatusEvent += Svc_OnTunnelStatusEvent;
svc.OnClientDisconnected += Svc_OnClientDisconnected;
svc.OnShutdownEvent += Svc_OnShutdownEvent;
}
public void Debug() {
OnStart(null);
}
protected override void OnStart(string[] args) {
try {
if (ConfigurationManager.AppSettings.Get("Version") != null) _versionType = ConfigurationManager.AppSettings.Get("Version");
} catch (Exception e) {
Logger.Info(e.ToString());
}
_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);
if (!running) {
running = true;
Task.Run(() => {
SetupServiceWatchers();
});
}
Logger.Info("initialized and running");
}
protected override void OnStop() {
Logger.Info("stopping update service");
}
private void SetupServiceWatchers() {
Logger.Info("setting up watches");
try {
svc.Connect();
} catch {
//svc.Reconnect();
}
//svc.WaitForConnection();
var updateTimerInterval = ConfigurationManager.AppSettings.Get("UpdateTimer");
var upInt = TimeSpan.Zero;
if (!TimeSpan.TryParse(updateTimerInterval, out upInt)) {
upInt = new TimeSpan(0, 1, 0);
}
Logger.Info("Ziti Update Setting Up Watchers");
_updateTimer = new System.Timers.Timer();
_updateTimer.Elapsed += CheckUpdate;
_updateTimer.Interval = upInt.TotalMilliseconds;
_updateTimer.Enabled = true;
_updateTimer.Start();
Logger.Info("Version Checker is running");
CheckUpdate(null, null); //check immediately
}
private void CheckUpdate(object sender, ElapsedEventArgs e) {
if (inUpdateCheck) return;
inUpdateCheck = true; //simple semaphone
try {
Logger.Info("checking for update");
var updateUrl = ConfigurationManager.AppSettings.Get("UpdateUrl");
if (string.IsNullOrEmpty(updateUrl)) {
updateUrl = "https://api.github.com/repos/openziti/desktop-edge-win/releases/latest";
}
IUpdateCheck check = new GithubCheck(updateUrl);
//IUpdateCheck check = new FilesystemCheck();
string currentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); //fetch from ziti?
Version installed = new Version(currentVersion);
if (!check.IsUpdateAvailable(installed)) {
Logger.Debug("update check complete. no update available");
inUpdateCheck = false;
return;
}
Logger.Info("update is available.");
var curdir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var updateFolder = $"{curdir}{Path.DirectorySeparatorChar}updates";
Directory.CreateDirectory(updateFolder);
Logger.Info("copying update package");
string filename = check.FileName();
if (check.AlreadyDownloaded(updateFolder, filename)) {
Logger.Info("package has already been downloaded - moving to install phase");
} else {
Logger.Info("copying update package begins");
check.CopyUpdatePackage(updateFolder, filename);
Logger.Info("copying update package complete");
}
StopZiti();
// shell out to a new process and run the uninstall, reinstall steps which SHOULD stop this current process as well
string fileDestination = Path.Combine(updateFolder, filename);
Process.Start(fileDestination, "/passive");
} catch (Exception ex) {
Logger.Error(ex, "Unexpected error has occurred");
}
inUpdateCheck = false;
}
private void StartZiti() {
controller = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == "ziti");
if (controller != null && controller.Status != ServiceControllerStatus.Running && controller.Status != ServiceControllerStatus.StartPending && controller.Status != ServiceControllerStatus.ContinuePending) {
try {
Logger.Info("Starting Service");
controller.Start();
controller.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(30));
SetupServiceWatchers();
} catch (Exception e) {
Logger.Info("Cannot Start Service - " + e.ToString());
}
}
}
private void StopZiti() {
Logger.Info("Stopping the ziti service...");
controller = ServiceController.GetServices().FirstOrDefault(s => s.ServiceName == "ziti");
if (controller != null && controller.Status != ServiceControllerStatus.Stopped) {
try {
controller.Stop();
controller.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(30));
} catch (Exception e) {
Logger.Error(e, "Timout while trying to stop service!");
}
}
}
private static void Svc_OnShutdownEvent(object sender, StatusEvent e) {
Logger.Info("the service is shutting down normally...");
}
private static void Svc_OnTunnelStatusEvent(object sender, TunnelStatusEvent e) {
string dns = e?.Status?.IpInfo?.DNS;
string version = e?.Status?.ServiceVersion.Version;
string op = e?.Op;
Logger.Info($"Operation {op}. running dns: {dns} at version {version}");
}
private static void Svc_OnClientConnected(object sender, object e) {
Logger.Info("successfully connected to service");
}
private static void Svc_OnClientDisconnected(object sender, object e) {
Client svc = (Client)sender;
if (svc.CleanShutdown) {
//then this is fine and expected - the service is shutting down
Logger.Info("client disconnected due to clean service shutdown");
} else {
Logger.Error("SERVICE IS DOWN and did not exit cleanly. initiating DNS cleanup");
//EnumerateDNS();
var ps = System.Management.Automation.PowerShell.Create();
string script = "Get-NetIPInterface | ForEach-Object { Set-DnsClientServerAddress -InterfaceIndex $_.ifIndex -ResetServerAddresses }";
ps.Commands.AddScript(script);
Logger.Info("No longer connected to the service. Resetting the network by executing reset script.");
Task.Delay(1000).Wait();
ps.Invoke();
Logger.Info("Reset script executed.");
//EnumerateDNS();
}
}
private static void EnumerateDNS() {
var ps = System.Management.Automation.PowerShell.Create();
ps.AddScript("Get-DnsClientServerAddress");
var results = ps.Invoke();
using (StringWriter sw = new StringWriter()) {
foreach (var r in results) {
string name = (string)r.Properties["InterfaceAlias"].Value;
string[] dnses = (string[])r.Properties["ServerAddresses"].Value;
sw.WriteLine($"Interface: {name}. DNS: {string.Join(",", dnses)}");
}
Logger.Info("DNS RESULTS:\n{0}", sw.ToString());
}
}
}
}
+159 -139
View File
@@ -1,140 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9AB81609-F5DD-40A6-87B5-F3279D48514D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>ZitiUpdateService</RootNamespace>
<AssemblyName>ZitiUpdateService</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ziti-white.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>189AAD422A106DC81E8E79C7E0D2118CEB2E6321</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>
</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Releases|AnyCPU'">
<OutputPath>bin\Releases\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.PowerShell.5.ReferenceAssemblies.1.1.0\lib\net4\System.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ProjectInstaller.Designer.cs">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</Compile>
<Compile Include="UpdateService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UpdateService.Designer.cs">
<DependentUpon>UpdateService.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="ZitiUpdateService_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="ziti-white.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9AB81609-F5DD-40A6-87B5-F3279D48514D}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>ZitiUpdateService</RootNamespace>
<AssemblyName>ZitiUpdateService</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>ziti.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>189AAD422A106DC81E8E79C7E0D2118CEB2E6321</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>
</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Releases|AnyCPU'">
<OutputPath>bin\Releases\</OutputPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.7.5\lib\net45\NLog.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Management" />
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.PowerShell.5.ReferenceAssemblies.1.1.0\lib\net4\System.Management.Automation.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Transactions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="IUpdateCheck.cs" />
<Compile Include="Program.cs" />
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ProjectInstaller.Designer.cs">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</Compile>
<Compile Include="UpdateCheckers.cs" />
<Compile Include="UpdateService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="UpdateService.Designer.cs">
<DependentUpon>UpdateService.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Resource Include="ziti.ico" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="ZitiUpdateService_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Resource Include="ziti-green.ico" />
<Content Include="ziti-white.ico" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.8">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.8 %28x86 and x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ZitiDesktopEdge.Client\ZitiDesktopEdge.Client.csproj">
<Project>{26b30979-99b5-4102-bd0b-129bedff0057}</Project>
<Name>ZitiDesktopEdge.Client</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+5 -3
View File
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.PowerShell.5.ReferenceAssemblies" version="1.1.0" targetFramework="net48" />
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.PowerShell.5.ReferenceAssemblies" version="1.1.0" targetFramework="net48" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
<package id="NLog" version="4.7.5" targetFramework="net48" />
</packages>
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

+1 -22
View File
@@ -97,7 +97,7 @@ func HookupTun(dev tun.Device/*, dns []net.IP*/) error {
writeQ: make(chan []byte, 64),
readQ: make(chan []byte, 64),
}
//devMap[name] = t
theTun = t
opts := (*C.tunneler_sdk_options)(C.calloc(1, C.sizeof_tunneler_sdk_options))
@@ -143,11 +143,6 @@ func netifClose(h C.netif_handle) C.int {
//export netifSetup
func netifSetup(h C.netif_handle, l *C.uv_loop_t, packetCb C.packet_cb, ctx unsafe.Pointer) C.int {
/*t, found := devMap[C.GoString(h.id)]
if !found {
log.Error("should not be here")
return -1
}*/
theTun.read = (*C.uv_async_t)(C.calloc(1, C.sizeof_uv_async_t))
C.uv_async_init(l, theTun.read, C.uv_async_cb(C.readAsync))
@@ -201,13 +196,6 @@ func (t *tunnel) runReadLoop() {
//export readIdle
func readIdle(idler *C.uv_prepare_t) {
/*dev := (*C.netif_handle_t)(idler.data)
id := C.GoString(dev.id)
t, found := devMap[id]
if !found {
log.Panicf("An unexpected and unrecoverable error has occurred while looking for tun in devMap")
}*/
np := len(theTun.readQ)
for i := np; i > 0; i-- {
@@ -266,17 +254,8 @@ func RemoveIntercept(rwg *RemoveWG) {
//export remove_intercepts
func remove_intercepts(async *C.uv_async_t) {
//C.ZLOG(C.INFO, C.CString(fmt.Sprint("aaaa on uv thread - inside remove_intercepts: %d", &async.loop)))
//c := (*C.char)(async.data)
rwg := (*RemoveWG)(async.data)
/*for _, t := range devMap {
//C.ZLOG(C.INFO, C.CString("bbb on uv thread - inside remove_intercepts"))
C.ziti_tunneler_stop_intercepting(t.tunCtx, C.CString(rwg.SvcId))
}*/
C.ziti_tunneler_stop_intercepting(theTun.tunCtx, C.CString(rwg.SvcId))
//C.ZLOG(C.INFO, C.CString("ccc on uv thread - inside remove_intercepts"))
C.uv_close((*C.uv_handle_t)(unsafe.Pointer(async)), C.uv_close_cb(C.free_async))
C.ZLOG(C.INFO, C.CString("on uv thread - completed remove_intercepts"))
rwg.Wg.Done()
}
+4 -1
View File
@@ -159,8 +159,11 @@ func runListener(ip *net.IP, port int, reqch chan dnsreq) {
server, err = net.ListenUDP(network, laddr)
if err == nil {
break
} else if attempts > maxAttempts{
} else if attempts > maxAttempts {
log.Panicf("An unexpected and unrecoverable error has occurred while %s: %v", "udp listening on network", err)
} else if attempts < (3 * maxAttempts / 4) {
// only log at debug until we hit 3/4 the max attempts to remove unnecessary warns from the log
log.Debugf("System not ready to listen on %v yet. Retrying after 500ms. This has happened %d times.", laddr, attempts)
} else {
log.Warnf("System not ready to listen on %v yet. Retrying after 500ms. This has happened %d times.", laddr, attempts)
}
+6 -8
View File
@@ -54,7 +54,12 @@ type intercept struct {
isIp bool
}
func (i intercept) String() string {
return fmt.Sprintf("%s:%d", i.host, i.port)
if i.isIp {
//an ip does not need the host normalized
return fmt.Sprintf("%s:%d", i.host, i.port)
} else {
return fmt.Sprintf("%s:%d", normalizeDnsName(i.host), i.port)
}
}
type ctxIp struct {
@@ -90,12 +95,6 @@ func (dns *dnsImpl) RegisterService(svcId string, dnsNameToReg string, port uint
ip := net.ParseIP(dnsNameToReg)
icept := intercept{isIp: false, port: port}
if ip == nil {
icept.host = normalizeDnsName(dnsNameToReg)
} else {
icept.host = ip.String()
icept.isIp = true
}
key := icept.String()
log.Infof("adding DNS for %s. service name %s@%s. is ip: %t", dnsNameToReg, svcName, key, icept.isIp)
@@ -190,7 +189,6 @@ func (dns *dnsImpl) UnregisterService(host string, port uint16) {
log.Warnf("Unexpected error removing route for %s", icept.host)
}
} else {
//delete(dns.hostnameMap, icept.host)
dns.hostnameMap[icept.host].dnsEnabled = false
}
delete(dns.serviceMap, key)
+1
View File
@@ -88,6 +88,7 @@ type TunnelStatus struct {
ServiceVersion ServiceVersion
TunIpv4 string
TunIpv4Mask int
Status string
}
type ServiceVersion struct {
-9
View File
@@ -41,15 +41,6 @@ func main() {
}
logging.InitLogger("info")
//if len(os.Args) < 2 {
// // if no args supplied - expect to run as service
// os.Args = append(os.Args, "service")
//}
//cmd.Execute()
//if true {
// os.Exit(0)
//}
// passing no arguments is an indicator that this is expecting to be run 'as a service'.
// using arg count instead of svc.IsAnInteractiveSession() as svc.IsAnInteractiveSession()
// seems to return false even when run in an interactive shell as via `psexec -i -s cmd.exe`
+15 -10
View File
@@ -110,6 +110,19 @@ func SubMain(ops chan string, changes chan<- svc.Status) error {
requestShutdown("service shutdown")
// signal to any connected consumers that the service is shutting down normally
events.broadcast <- dto.StatusEvent {
Op: "shutdown",
}
// wait 1 second for the shutdown to send to clients
shutdownDelay := make(chan bool)
go func() {
time.Sleep(1*time.Second)
shutdownDelay <- true
}()
<-shutdownDelay
log.Infof("shutting down connections...")
pipes.shutdownConnections()
@@ -327,15 +340,6 @@ func serveIpc(conn net.Conn) {
defer log.Info("A connected IPC client has disconnected")
defer closeConn(conn) //close the connection after this function invoked as go routine exits
if len(events.broadcast) == cap(events.broadcast) {
log.Warn("TunnelStatusEvent will be blocked. If this warning is continuously displayed please report")
}
events.broadcast <- dto.TunnelStatusEvent{
StatusEvent: dto.StatusEvent{Op: "status"},
Status: rts.ToStatus(),
ApiVersion: API_VERSION,
}
done := make(chan struct{}, 8)
defer close(done) // ensure that goroutine exits
@@ -366,8 +370,9 @@ func serveIpc(conn net.Conn) {
enc := json.NewEncoder(writer)
for {
log.Debug("beginning read")
log.Debug("ipc read begins")
msg, err := reader.ReadString('\n')
log.Debug("ipc read ends")
if err != nil {
if err != winio.ErrFileClosed {
if err == io.EOF {
+50
View File
@@ -0,0 +1,50 @@
/*
* Copyright NetFoundry, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package iputil
import (
"encoding/binary"
"net"
)
var allOnes = 0xFFFFFFFF
func Ipv4Inc(ip net.IP, maskBits int) net.IP {
baseIpMask := 32 - maskBits
baseMask := (allOnes >> baseIpMask) << baseIpMask
ipMask := allOnes >> maskBits
ipAsInt := Ipv4ToUint32(ip)
baseIp := ipAsInt & uint32(baseMask)
//fmt.Printf("actual ip: %b - %v ", ipAsInt, ip)
newIpAsInt := ipAsInt + 1
return Uint32ToIpv4(baseIp + newIpAsInt & uint32(ipMask))
}
func Ipv4ToUint32(ip net.IP) uint32 {
if len(ip) == 16 {
return binary.BigEndian.Uint32(ip[12:16])
}
return binary.BigEndian.Uint32(ip)
}
func Uint32ToIpv4(nn uint32) net.IP {
ip := make(net.IP, 4)
binary.BigEndian.PutUint32(ip, nn)
return ip
}