manner.js 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,6 +80,109 @@ BRF:0
80
80
  BRH:0
81
81
  end_of_record
82
82
  TN:
83
+ SF:src/server/lib/getOwnIpAddresses.js
84
+ FN:5,getOwnIpAddresses
85
+ FN:8,(anonymous_1)
86
+ FNF:2
87
+ FNH:2
88
+ FNDA:1,getOwnIpAddresses
89
+ FNDA:7,(anonymous_1)
90
+ DA:6,1
91
+ DA:7,1
92
+ DA:8,1
93
+ DA:9,7
94
+ DA:10,7
95
+ DA:11,7
96
+ DA:14,2
97
+ DA:15,4
98
+ DA:16,4
99
+ DA:17,4
100
+ DA:18,1
101
+ DA:20,3
102
+ DA:21,3
103
+ DA:23,2
104
+ DA:24,2
105
+ DA:25,1
106
+ DA:27,2
107
+ DA:30,1
108
+ DA:31,1
109
+ DA:32,1
110
+ DA:34,1
111
+ DA:37,3
112
+ DA:38,1
113
+ DA:44,1
114
+ LF:24
115
+ LH:24
116
+ BRDA:11,0,0,2
117
+ BRDA:11,0,1,5
118
+ BRDA:17,1,0,1
119
+ BRDA:17,1,1,3
120
+ BRDA:21,2,0,2
121
+ BRDA:21,2,1,1
122
+ BRDA:24,3,0,1
123
+ BRDA:24,3,1,1
124
+ BRDA:31,4,0,1
125
+ BRDA:31,4,1,0
126
+ BRDA:37,5,0,1
127
+ BRDA:37,5,1,2
128
+ BRDA:37,6,0,3
129
+ BRDA:37,6,1,1
130
+ BRF:14
131
+ BRH:13
132
+ end_of_record
133
+ TN:
134
+ SF:src/server/lib/isIpv4Address.js
135
+ FN:1,isIpv4Address
136
+ FNF:1
137
+ FNH:1
138
+ FNDA:2,isIpv4Address
139
+ DA:2,2
140
+ DA:3,2
141
+ DA:4,0
142
+ DA:6,2
143
+ DA:7,8
144
+ DA:8,8
145
+ DA:9,8
146
+ DA:10,0
147
+ DA:13,2
148
+ LF:9
149
+ LH:7
150
+ BRDA:3,0,0,0
151
+ BRDA:3,0,1,2
152
+ BRDA:9,1,0,0
153
+ BRDA:9,1,1,8
154
+ BRDA:9,2,0,8
155
+ BRDA:9,2,1,8
156
+ BRF:6
157
+ BRH:4
158
+ end_of_record
159
+ TN:
160
+ SF:src/server/lib/isIpv6Address.js
161
+ FN:1,isIpv6Address
162
+ FNF:1
163
+ FNH:1
164
+ FNDA:3,isIpv6Address
165
+ DA:2,3
166
+ DA:3,3
167
+ DA:4,1
168
+ DA:6,2
169
+ DA:7,16
170
+ DA:8,16
171
+ DA:9,16
172
+ DA:10,0
173
+ DA:13,2
174
+ LF:9
175
+ LH:8
176
+ BRDA:3,0,0,1
177
+ BRDA:3,0,1,2
178
+ BRDA:9,1,0,0
179
+ BRDA:9,1,1,16
180
+ BRDA:9,2,0,16
181
+ BRDA:9,2,1,16
182
+ BRF:6
183
+ BRH:5
184
+ end_of_record
185
+ TN:
83
186
  SF:src/server/lib/parseHttpDate.js
84
187
  FN:1,parseHttpDate
85
188
  FNF:1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "manner.js",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Frontend mode project.",
5
5
  "repository": "git@github.com:leobrad/mode.git",
6
6
  "author": "Leo Ely",
package/server/index.js CHANGED
@@ -21,6 +21,24 @@ Object.defineProperty(exports, "formatHttpKey", {
21
21
  return _formatHttpKey.default;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "getOwnIpAddresses", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _getOwnIpAddresses.default;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "isIpv4Address", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _isIpv4Address.default;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "isIpv6Address", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _isIpv6Address.default;
40
+ }
41
+ });
24
42
  Object.defineProperty(exports, "parseHttpDate", {
25
43
  enumerable: true,
26
44
  get: function () {
@@ -33,9 +51,12 @@ Object.defineProperty(exports, "readCookie", {
33
51
  return _readCookie.default;
34
52
  }
35
53
  });
54
+ var _MultiFetch = _interopRequireDefault(require("./class/MultiFetch"));
36
55
  var _readCookie = _interopRequireDefault(require("./lib/readCookie"));
37
56
  var _formatHttpKey = _interopRequireDefault(require("./lib/formatHttpKey"));
38
57
  var _formatHttpDate = _interopRequireDefault(require("./lib/formatHttpDate"));
39
58
  var _parseHttpDate = _interopRequireDefault(require("./lib/parseHttpDate"));
40
- var _MultiFetch = _interopRequireDefault(require("./class/MultiFetch"));
59
+ var _isIpv4Address = _interopRequireDefault(require("./lib/isIpv4Address"));
60
+ var _isIpv6Address = _interopRequireDefault(require("./lib/isIpv6Address"));
61
+ var _getOwnIpAddresses = _interopRequireDefault(require("./lib/getOwnIpAddresses"));
41
62
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = getOwnIpAddresses;
7
+ var _os = _interopRequireDefault(require("os"));
8
+ var _isIpv4Address = _interopRequireDefault(require("./isIpv4Address"));
9
+ var _isIpv6Address = _interopRequireDefault(require("./isIpv6Address"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function getOwnIpAddresses() {
12
+ const nets = _os.default.networkInterfaces();
13
+ const ans = [];
14
+ Object.keys(nets).forEach(key => {
15
+ const net = nets[key];
16
+ const {
17
+ length
18
+ } = net;
19
+ if (length >= 2) {
20
+ let ipv4;
21
+ let ipv6;
22
+ for (let i = 0; i < length; i += 1) {
23
+ const ip = net[i];
24
+ const {
25
+ internal
26
+ } = ip;
27
+ if (internal === true) {
28
+ break;
29
+ } else {
30
+ const {
31
+ family
32
+ } = ip;
33
+ switch (family) {
34
+ case 'IPv6':
35
+ {
36
+ const {
37
+ address
38
+ } = ip;
39
+ if ((0, _isIpv6Address.default)(address)) {
40
+ ipv6 = address;
41
+ }
42
+ break;
43
+ }
44
+ case 'IPv4':
45
+ {
46
+ const {
47
+ address
48
+ } = ip;
49
+ if ((0, _isIpv4Address.default)(address)) {
50
+ ipv4 = address;
51
+ }
52
+ break;
53
+ }
54
+ }
55
+ if (ipv4 !== undefined && ipv6 !== undefined) {
56
+ ans.push({
57
+ ipv4,
58
+ ipv6
59
+ });
60
+ }
61
+ }
62
+ }
63
+ }
64
+ });
65
+ return ans;
66
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = isIpv4Address;
7
+ function isIpv4Address(address) {
8
+ const sections = address.split('.');
9
+ if (sections.length !== 4) {
10
+ return false;
11
+ }
12
+ for (let i = 0; i < sections.length; i += 1) {
13
+ const section = sections;
14
+ const value = parseInt(section);
15
+ if (!(value >= 0 && value <= 255)) {
16
+ return false;
17
+ }
18
+ }
19
+ return true;
20
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = isIpv6Address;
7
+ function isIpv6Address(address) {
8
+ const sections = address.split(':');
9
+ if (sections.length !== 8) {
10
+ return false;
11
+ }
12
+ for (let i = 0; i < sections.length; i += 1) {
13
+ const section = sections;
14
+ const value = parseInt(section, 16);
15
+ if (!(value >= 0 && value <= 16 ** 4 - 1)) {
16
+ return false;
17
+ }
18
+ }
19
+ return true;
20
+ }