google-ddns
Version:
Google Dynamic DNS client update tool. Updates the DNS IP address to the current public IP.
1,110 lines (295 loc) • 14.9 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Service</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Service</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>
<span class="ancestors"><a href="DEDA-Google-DDNS.html">DEDA-Google-DDNS</a>.</span>Service<span class="signature">(options)</span><span class="type-signature"></span></h2>
<div class="class-description"><p>This is a service class designed to run the Google DynamicDNS as a service on a time interval that checks if the public IP has
changed in-order to update the Google host DNS IP address. This is intended to be simple and clean, for more complex features use
this as a template in conjunction with DynamicDNS class.</p></div>
</header>
<article>
<div class="container-overview">
<h2>Constructor</h2>
<h4 class="name" id="Service"><span class="type-signature"></span>new Service<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Creates a new class with the given options.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last"><p>See <a href="DEDA-Google-DDNS.Service.html#.getDefaultOptions">getDefaultOptions()</a> for more details.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-author">Author:</dt>
<dd class="tag-author">
<ul>
<li><a href="mailto:charbel.choueiri@gmail.com">Charbel Choueiri</a></li>
</ul>
</dd>
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Service.js.html">lib/Service.js</a>, <a href="lib_Service.js.html#line19">line 19</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<h4 class="name" id="consecutiveErrors"><span class="type-signature"></span>consecutiveErrors<span class="type-signature"> :number</span></h4>
<div class="description">
<p>Keeps track of the number of consecutive errors in-order to determine what to do next base don the set options.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">number</span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Service.js.html">lib/Service.js</a>, <a href="lib_Service.js.html#line37">line 37</a>
</li></ul></dd>
</dl>
<h4 class="name" id="dynamicDNS"><span class="type-signature"></span>dynamicDNS<span class="type-signature"> :<a href="DEDA-Google-DDNS.DynamicDNS.html">DEDA-Google-DDNS.DynamicDNS</a></span></h4>
<div class="description">
<p>An instance of the Google DynamicDNS class used within this service.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="DEDA-Google-DDNS.DynamicDNS.html">DEDA-Google-DDNS.DynamicDNS</a></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Service.js.html">lib/Service.js</a>, <a href="lib_Service.js.html#line31">line 31</a>
</li></ul></dd>
</dl>
<h4 class="name" id="options"><span class="type-signature"></span>options<span class="type-signature"> :<a href="DEDA-Google-DDNS.Service.html#.DefaultOptions">DEDA-Google-DDNS.Service.DefaultOptions</a></span></h4>
<div class="description">
<p>The class options as defined by <a href="DEDA-Google-DDNS.Service.html#.getDefaultOptions">getDefaultOptions()</a>
On initialization the constructor options parameters are merged with the default options.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="DEDA-Google-DDNS.Service.html#.DefaultOptions">DEDA-Google-DDNS.Service.DefaultOptions</a></span>
</li>
</ul>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Service.js.html">lib/Service.js</a>, <a href="lib_Service.js.html#line44">line 44</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".getDefaultOptions"><span class="type-signature">(static) </span>getDefaultOptions<span class="signature">()</span><span class="type-signature"> → {<a href="DEDA-Google-DDNS.Service.html#.DefaultOptions">DEDA-Google-DDNS.Service.DefaultOptions</a>}</span></h4>
<div class="description">
<p>Returns a list of all possible options for this class with their default values.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Service.js.html">lib/Service.js</a>, <a href="lib_Service.js.html#line64">line 64</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Returns the component default options.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="DEDA-Google-DDNS.Service.html#.DefaultOptions">DEDA-Google-DDNS.Service.DefaultOptions</a></span>
</dd>
</dl>
<h4 class="name" id="log"><span class="type-signature"></span>log<span class="signature">(message, type)</span><span class="type-signature"></span></h4>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>message</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="default">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="default">
log
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Service.js.html">lib/Service.js</a>, <a href="lib_Service.js.html#line118">line 118</a>
</li></ul></dd>
</dl>
<h4 class="name" id="start"><span class="type-signature">(async) </span>start<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
<p>Starts the service check loop that will check for public IP changes every set time interval to ensure it remains
synchronized with the host name DNS IP address.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Service.js.html">lib/Service.js</a>, <a href="lib_Service.js.html#line79">line 79</a>
</li></ul></dd>
</dl>
<h3 class="subsection-title">Type Definitions</h3>
<h4 class="name" id=".DefaultOptions">DefaultOptions</h4>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Object</span>
</li>
</ul>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>checkInterval</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
60
</td>
<td class="description last"><p>The amount of time in seconds to wait before checking if the public IP has changed.</p></td>
</tr>
<tr>
<td class="name"><code>maxConsecutiveErrors</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
10
</td>
<td class="description last"><p>The maximum number of check consecutive errors before stopping the check timer loop.</p></td>
</tr>
<tr>
<td class="name"><code>exitOnMaxErrors</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>Defines whether to exit process when the max consecutive errors has been reached.</p></td>
</tr>
<tr>
<td class="name"><code>logPath</code></td>
<td class="type">
<span class="param-type">string</span>
|
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
'./logs.log'
</td>
<td class="description last"><p>Defines the log output path. Set to false to disable output logs.</p></td>
</tr>
<tr>
<td class="name"><code>logToConsole</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
true
</td>
<td class="description last"><p>Defines whether to log output to the console or not.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="lib_Service.js.html">lib/Service.js</a>, <a href="lib_Service.js.html#line50">line 50</a>
</li></ul></dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="DEDA-Google-DDNS.DynamicDNS.html">DynamicDNS</a></li><li><a href="DEDA-Google-DDNS.Options.html">Options</a></li><li><a href="DEDA-Google-DDNS.Service.html">Service</a></li></ul><h3>Namespaces</h3><ul><li><a href="DEDA-Google-DDNS.html">DEDA-Google-DDNS</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 01 2018 11:49:49 GMT-0400 (Eastern Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>