-
Notifications
You must be signed in to change notification settings - Fork 0
/
ipdata.html
114 lines (104 loc) · 4.4 KB
/
ipdata.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<script type="text/javascript">
RED.nodes.registerType('ipdata',{
category: 'measurements',
color: "#2E8B57",
defaults: {
name: {value:""},
infotype: {value:"country"}
},
inputs:1,
outputs:1,
icon: "ipdata.png",
label: function() {
return this.name||"ipdata";
},
oneditprepare: function() {
const node = this;
const { string } = node;
$("#node-input-infotype").typedInput({
types: [
{
value: "option",
multiple: "true",
options: [
{ value: "country", label: "Country"},
{ value: "region", label: "Region"},
{ value: "city", label: "City"},
{ value: "coordinates", label: "Geographic coordinates"},
{ value: "zipcode", label: "Zipcode"},
{ value: "timezone", label: "Timezone"},
]
}
]
});
}
});
</script>
<script type="text/html" data-template-name="ipdata">
<div class="form-row">
<label for="node-input-infotype"><i class="fa fa-tag"></i> Data type</label>
<input type="text" id="node-input-infotype">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
</script>
<script type="text/html" data-help-name="ipdata">
<p>Provides IP Geolocation data from IP addresses in input using IP2Location LITE database.</p>
<h3>Inputs</h3>
<dl class="message-properties">
<dt>payload
<span class="property-type">buffer</span>
</dt>
<dd> Payload should be an array of IP Addresses in IPv4 or IPv6 format.
Example:
<pre>msg.payload = [ 2a10:3781:e22:1:220:4aff:fec8:23d7, 2a02:a467:f500:fd:220:4aff:fec8:2532, 94.214.123.162 ];
</pre>
</dd>
</dl>
<h3>Outputs</h3>
<ol class="node-ports">
<li>Standard output
<dl class="message-properties">
<dt>payload <span class="property-type">buffer</span></dt>
<dd>Array with an object per IP Address in input. Every element has this properties:
<ul>
<li>ip</li>
<li>ipNo (decimal version of the IP Address)</li>
<li>Other properties based on data types selected in the node editor. They can be:
<ul>
<p>If "Country is selected":</p>
<li>Country code</li>
<li>Country name</li>
<p>If "Region" is selected:</p>
<li>Region</li>
<p>If "City" is selected:</p>
<li>City</li>
<p>If "Geographic coordinates" is selected:</p>
<li>Latitude</li>
<li>Longitude</li>
<p>If "Zipcode" is selected:</p>
<li>Zipcode</li>
<p>If "Timezone" is selected:</p>
<li>Timezone</li>
</ul>
</li>
</ul>
<p>If an IP Address is not recognized from database, msg.payload will be:</p>
<pre>msg.payload = { ip: "?", ipNo: "?" };</pre>
</dd>
</dl>
</li>
</ol>
<h3>References</h3>
<ul>
<li><a href="https://github.com/martibb/node-red-geolocation-node-with-ip2location">GitHub</a> - the nodes github repository</li>
<li>
<p>
This site or product includes IP2Location LITE data available from
<a href="https://lite.ip2location.com">https://lite.ip2location.com</a>
</p>
</li>
</ul>
</script>