iosignal 1.6.1 → 1.7.1

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.
Files changed (51) hide show
  1. package/README.md +254 -247
  2. package/auth_file.json +13 -13
  3. package/auth_file.mjs +23 -23
  4. package/dist/iosignal.cjs +2 -2
  5. package/dist/iosignal.esm.js.map +1 -1
  6. package/dist/iosignal.min.js.map +1 -1
  7. package/index.js +19 -19
  8. package/indexWebBrowser.js +13 -13
  9. package/package.json +60 -59
  10. package/rollup.config.js +69 -69
  11. package/src/api/RedisAPI.js +65 -68
  12. package/src/api/api_constant.js +7 -7
  13. package/src/api/api_reply.js +31 -34
  14. package/src/api/api_sudo.js +91 -96
  15. package/src/auth/Auth_Env.js +76 -78
  16. package/src/auth/Auth_File.js +71 -75
  17. package/src/auth/Auth_Redis.js +44 -50
  18. package/src/auth/BohoAuth.js +164 -168
  19. package/src/client/CongPacket.js +141 -150
  20. package/src/client/IOCongSocket.js +81 -88
  21. package/src/client/IOCore.js +822 -851
  22. package/src/client/IOWS.js +80 -81
  23. package/src/client/IOWebSocket.js +111 -112
  24. package/src/common/constants.js +148 -159
  25. package/src/common/payload.js +81 -82
  26. package/src/common/quotaTable.js +68 -68
  27. package/src/common/util.js +61 -61
  28. package/src/server/FileLogger.js +30 -30
  29. package/src/server/Manager.js +433 -449
  30. package/src/server/Metric.js +155 -154
  31. package/src/server/Remote.js +207 -0
  32. package/src/server/{ServerRemoteCore.js → RemoteCore.js} +439 -467
  33. package/src/server/Server.js +163 -166
  34. package/src/server/serverOption.js +56 -56
  35. package/test-browser/favicon.ico +0 -0
  36. package/test-browser/index.html +96 -93
  37. package/test-browser/server.js +11 -11
  38. package/test-client-nodejs/client.cjs +17 -17
  39. package/test-client-nodejs/client.mjs +17 -17
  40. package/test-client-nodejs/client_api_reply.mjs +15 -15
  41. package/test-client-nodejs/stateChange.mjs +19 -19
  42. package/test-server/server-Auth_Env.js +19 -19
  43. package/test-server/server-Auth_File.js +12 -12
  44. package/test-server/server-api_reply.js +6 -6
  45. package/test-server/server-api_sudo.js +7 -7
  46. package/test-server/server-commonjs.cjs +8 -8
  47. package/test-server/server-esm.mjs +20 -19
  48. package/test-server/simple-server.mjs +11 -11
  49. package/test-signal-payloadType/signalPack.js +34 -34
  50. package/test-signal-payloadType/signaling.js +60 -60
  51. package/src/server/ServerRemote.js +0 -227
@@ -1,61 +1,61 @@
1
- import { networkInterfaces } from 'os';
2
-
3
- export function isPrivateIP(ip){
4
- if(ip.indexOf("0.0.0.0") === 0) return true
5
- if(ip.indexOf("127.0.0.1") === 0) return true
6
- if(ip.indexOf("192.168.") === 0) return true
7
- if(ip.indexOf("10.") === 0) return true
8
- if(ip.indexOf("172.") === 0){
9
- if(ip.indexOf("172.16.") === 0) return true
10
- if(ip.indexOf("172.17.") === 0) return true
11
- if(ip.indexOf("172.18.") === 0) return true
12
- if(ip.indexOf("172.19.") === 0) return true
13
- if(ip.indexOf("172.20.") === 0) return true
14
- if(ip.indexOf("172.21.") === 0) return true
15
- if(ip.indexOf("172.22.") === 0) return true
16
- if(ip.indexOf("172.23.") === 0) return true
17
- if(ip.indexOf("172.24.") === 0) return true
18
- if(ip.indexOf("172.25.") === 0) return true
19
- if(ip.indexOf("172.26.") === 0) return true
20
- if(ip.indexOf("172.27.") === 0) return true
21
- if(ip.indexOf("172.28.") === 0) return true
22
- if(ip.indexOf("172.29.") === 0) return true
23
- if(ip.indexOf("172.30.") === 0) return true
24
- if(ip.indexOf("172.31.") === 0) return true
25
- }
26
-
27
- return false
28
- }
29
-
30
- export function numberWithCommas (x) {
31
- return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
32
- }
33
-
34
- export function getIPv4HexString(ipStr){
35
- let ipv4 = ipStr.split('.')
36
- return Buffer.from(ipv4).toString('hex')
37
- }
38
-
39
- export function getLocalAddress(){
40
- const nets = networkInterfaces();
41
- // console.log(nets)
42
- const results = Object.create(null); // Or just '{}', an empty object
43
- let localAddress =''
44
- for (const name of Object.keys(nets)) {
45
- for (const net of nets[name]) {
46
- // Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses
47
- // 'IPv4' is in Node <= 17, from 18 it's a number 4 or 6
48
- const familyV4Value = typeof net.family === 'string' ? 'IPv4' : 4
49
- if (net.family === familyV4Value && !net.internal) {
50
- if (!results[name]) {
51
- results[name] = [];
52
- }
53
- results[name].push(net.address);
54
- localAddress = net.address
55
- }
56
- }
57
- }
58
-
59
- // console.log('localAddress:', localAddress)
60
- return localAddress
61
- }
1
+ import { networkInterfaces } from 'os';
2
+
3
+ export function isPrivateIP(ip) {
4
+ if (ip.indexOf("0.0.0.0") === 0) return true
5
+ if (ip.indexOf("127.0.0.1") === 0) return true
6
+ if (ip.indexOf("192.168.") === 0) return true
7
+ if (ip.indexOf("10.") === 0) return true
8
+ if (ip.indexOf("172.") === 0) {
9
+ if (ip.indexOf("172.16.") === 0) return true
10
+ if (ip.indexOf("172.17.") === 0) return true
11
+ if (ip.indexOf("172.18.") === 0) return true
12
+ if (ip.indexOf("172.19.") === 0) return true
13
+ if (ip.indexOf("172.20.") === 0) return true
14
+ if (ip.indexOf("172.21.") === 0) return true
15
+ if (ip.indexOf("172.22.") === 0) return true
16
+ if (ip.indexOf("172.23.") === 0) return true
17
+ if (ip.indexOf("172.24.") === 0) return true
18
+ if (ip.indexOf("172.25.") === 0) return true
19
+ if (ip.indexOf("172.26.") === 0) return true
20
+ if (ip.indexOf("172.27.") === 0) return true
21
+ if (ip.indexOf("172.28.") === 0) return true
22
+ if (ip.indexOf("172.29.") === 0) return true
23
+ if (ip.indexOf("172.30.") === 0) return true
24
+ if (ip.indexOf("172.31.") === 0) return true
25
+ }
26
+
27
+ return false
28
+ }
29
+
30
+ export function numberWithCommas(x) {
31
+ return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
32
+ }
33
+
34
+ export function getIPv4HexString(ipStr) {
35
+ let ipv4 = ipStr.split('.')
36
+ return Buffer.from(ipv4).toString('hex')
37
+ }
38
+
39
+ export function getLocalAddress() {
40
+ const nets = networkInterfaces();
41
+ // console.log(nets)
42
+ const results = Object.create(null); // Or just '{}', an empty object
43
+ let localAddress = ''
44
+ for (const name of Object.keys(nets)) {
45
+ for (const net of nets[name]) {
46
+ // Skip over non-IPv4 and internal (i.e. 127.0.0.1) addresses
47
+ // 'IPv4' is in Node <= 17, from 18 it's a number 4 or 6
48
+ const familyV4Value = typeof net.family === 'string' ? 'IPv4' : 4
49
+ if (net.family === familyV4Value && !net.internal) {
50
+ if (!results[name]) {
51
+ results[name] = [];
52
+ }
53
+ results[name].push(net.address);
54
+ localAddress = net.address
55
+ }
56
+ }
57
+ }
58
+
59
+ // console.log('localAddress:', localAddress)
60
+ return localAddress
61
+ }
@@ -1,30 +1,30 @@
1
- import fs from 'fs'
2
-
3
- const formatter = new Intl.DateTimeFormat('ko-KR', {
4
- // hour12: true,
5
- // hour: 'numeric',
6
- // minute: '2-digit',
7
- // second: '2-digit'
8
- year: 'numeric', month: 'numeric', day: 'numeric',
9
- hour: 'numeric', minute: 'numeric',
10
- hour12: false,
11
- timeZone: 'Asia/Seoul'
12
- });
13
-
14
-
15
- export class FileLogger{
16
- constructor(path ){
17
- this.file = fs.openSync(path ,'a+')
18
- console.log('new logFile', path, this.file )
19
- }
20
-
21
- log(msg){
22
- let format =formatter.format(new Date()) + " "+ msg +'\n';
23
- fs.write( this.file, format , (err) => {
24
- if (err) throw err;
25
- })
26
-
27
- }
28
-
29
-
30
- }
1
+ import fs from 'fs'
2
+
3
+ const formatter = new Intl.DateTimeFormat('ko-KR', {
4
+ // hour12: true,
5
+ // hour: 'numeric',
6
+ // minute: '2-digit',
7
+ // second: '2-digit'
8
+ year: 'numeric', month: 'numeric', day: 'numeric',
9
+ hour: 'numeric', minute: 'numeric',
10
+ hour12: false,
11
+ timeZone: 'Asia/Seoul'
12
+ });
13
+
14
+
15
+ export class FileLogger {
16
+ constructor(path) {
17
+ this.file = fs.openSync(path, 'a+')
18
+ console.log('new FileLogger logFile: ', path, this.file)
19
+ }
20
+
21
+ log(msg) {
22
+ let format = formatter.format(new Date()) + " " + msg + '\n';
23
+ fs.write(this.file, format, (err) => {
24
+ if (err) throw err;
25
+ })
26
+
27
+ }
28
+
29
+
30
+ }