diff --git a/DnsService/App.config b/DnsService/App.config new file mode 100644 index 00000000..74ade9db --- /dev/null +++ b/DnsService/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/DnsService/DnsService.csproj b/DnsService/DnsService.csproj new file mode 100644 index 00000000..5132541f --- /dev/null +++ b/DnsService/DnsService.csproj @@ -0,0 +1,82 @@ + + + + + Debug + AnyCPU + {7873B2B8-01BA-48BC-B4B0-0857FFD873C9} + WinExe + DnsService + DnsService + v4.0 + 512 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Component + + + ProjectInstaller.cs + + + Component + + + Service1.cs + + + + + + + + + + ProjectInstaller.cs + + + Service1.cs + + + + + {a561cf13-fe21-40a1-bf8d-bd242304187a} + DnsServerCore + + + + \ No newline at end of file diff --git a/DnsService/Program.cs b/DnsService/Program.cs new file mode 100644 index 00000000..b894b586 --- /dev/null +++ b/DnsService/Program.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.ServiceProcess; +using System.Text; +using System.Threading.Tasks; + +namespace DnsService +{ + static class Program + { + /// + /// The main entry point for the application. + /// + static void Main() + { + ServiceBase[] ServicesToRun; + ServicesToRun = new ServiceBase[] + { + new DnsService() + }; + ServiceBase.Run(ServicesToRun); + } + } +} diff --git a/DnsService/ProjectInstaller.Designer.cs b/DnsService/ProjectInstaller.Designer.cs new file mode 100644 index 00000000..3de02b84 --- /dev/null +++ b/DnsService/ProjectInstaller.Designer.cs @@ -0,0 +1,60 @@ +namespace DnsService +{ + partial class ProjectInstaller + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller(); + this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller(); + // + // serviceProcessInstaller1 + // + this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.NetworkService; + this.serviceProcessInstaller1.Password = null; + this.serviceProcessInstaller1.Username = null; + // + // serviceInstaller1 + // + this.serviceInstaller1.Description = "Technitium DNS Service"; + this.serviceInstaller1.DisplayName = "Technitium DNS Service"; + this.serviceInstaller1.ServiceName = "DnsService"; + this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic; + // + // ProjectInstaller + // + this.Installers.AddRange(new System.Configuration.Install.Installer[] { + this.serviceProcessInstaller1, + this.serviceInstaller1}); + + } + + #endregion + + private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1; + private System.ServiceProcess.ServiceInstaller serviceInstaller1; + } +} \ No newline at end of file diff --git a/DnsService/ProjectInstaller.cs b/DnsService/ProjectInstaller.cs new file mode 100644 index 00000000..42f82e7b --- /dev/null +++ b/DnsService/ProjectInstaller.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Configuration.Install; +using System.Linq; +using System.Threading.Tasks; + +namespace DnsService +{ + [RunInstaller(true)] + public partial class ProjectInstaller : System.Configuration.Install.Installer + { + public ProjectInstaller() + { + InitializeComponent(); + } + } +} diff --git a/DnsService/ProjectInstaller.resx b/DnsService/ProjectInstaller.resx new file mode 100644 index 00000000..5c8b4681 --- /dev/null +++ b/DnsService/ProjectInstaller.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 196, 17 + + + False + + \ No newline at end of file diff --git a/DnsService/Properties/AssemblyInfo.cs b/DnsService/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..3b3d0414 --- /dev/null +++ b/DnsService/Properties/AssemblyInfo.cs @@ -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("DnsService")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DnsService")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[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("7873b2b8-01ba-48bc-b4b0-0857ffd873c9")] + +// 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")] diff --git a/DnsService/Service1.Designer.cs b/DnsService/Service1.Designer.cs new file mode 100644 index 00000000..b496d83f --- /dev/null +++ b/DnsService/Service1.Designer.cs @@ -0,0 +1,40 @@ +namespace DnsService +{ + partial class DnsService + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + // + // DnsService + // + this.ServiceName = "DnsService"; + + } + + #endregion + } +} diff --git a/DnsService/Service1.cs b/DnsService/Service1.cs new file mode 100644 index 00000000..203f588c --- /dev/null +++ b/DnsService/Service1.cs @@ -0,0 +1,45 @@ +/* +Technitium DNS Server +Copyright (C) 2017 Shreyas Zare (shreyas@technitium.com) + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +*/ + +using DnsServerCore; +using System.ServiceProcess; + +namespace DnsService +{ + public partial class DnsService : ServiceBase + { + DnsWebService _service; + + public DnsService() + { + InitializeComponent(); + } + + protected override void OnStart(string[] args) + { + _service = new DnsWebService(args[0]); + _service.Start(); + } + + protected override void OnStop() + { + _service.Stop(); + } + } +} diff --git a/DnsService/Service1.resx b/DnsService/Service1.resx new file mode 100644 index 00000000..e5858cc2 --- /dev/null +++ b/DnsService/Service1.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + False + + \ No newline at end of file