pinokiod 3.8.60 → 3.8.62
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.
- package/kernel/router/index.js +17 -8
- package/package.json +1 -1
package/kernel/router/index.js
CHANGED
|
@@ -48,19 +48,24 @@ class Router {
|
|
|
48
48
|
}
|
|
49
49
|
published() {
|
|
50
50
|
let info = this.info()
|
|
51
|
+
console.log("published info", info)
|
|
51
52
|
let pub = {}
|
|
52
53
|
for(let host in info) {
|
|
53
54
|
let routes = info[host]
|
|
54
55
|
pub[host] = {}
|
|
55
56
|
for(let dial in routes) {
|
|
56
57
|
let matches = routes[dial]
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
if (dial.startsWith(this.kernel.peer.host)) {
|
|
59
|
+
let exposed_matches = matches.filter((m) => {
|
|
60
|
+
return m.endsWith(`${this.kernel.peer.name}.localhost`)
|
|
61
|
+
})
|
|
62
|
+
let port = dial.split(":")[1]
|
|
63
|
+
let exposed_port = this.port_mapping[`${port}`]
|
|
64
|
+
let exposed_dial = `${this.kernel.peer.host}:${exposed_port}` // exposed_dial :- 192.168...
|
|
65
|
+
pub[host][exposed_dial] = exposed_matches
|
|
66
|
+
} else {
|
|
67
|
+
pub[host][dial] = matches
|
|
68
|
+
}
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
return pub
|
|
@@ -72,6 +77,8 @@ class Router {
|
|
|
72
77
|
console.log("matches", matches)
|
|
73
78
|
|
|
74
79
|
// iterate through them and see if the port already exists
|
|
80
|
+
let count = matches ? new Set(matches).size : 0
|
|
81
|
+
/*
|
|
75
82
|
let count = 0
|
|
76
83
|
if (matches) {
|
|
77
84
|
for(let match of matches) {
|
|
@@ -84,6 +91,7 @@ class Router {
|
|
|
84
91
|
}
|
|
85
92
|
}
|
|
86
93
|
}
|
|
94
|
+
*/
|
|
87
95
|
|
|
88
96
|
console.log("count", count)
|
|
89
97
|
|
|
@@ -145,10 +153,11 @@ class Router {
|
|
|
145
153
|
}
|
|
146
154
|
}
|
|
147
155
|
// replace :PORT_PLACEHOLDER with available ports
|
|
156
|
+
console.log("CONFIG BEFORE", JSON.stringify(this.config, null, 2))
|
|
148
157
|
|
|
149
158
|
await this.fill()
|
|
150
159
|
|
|
151
|
-
console.log("CONFIG", JSON.stringify(this.config, null, 2))
|
|
160
|
+
console.log("CONFIG AFTER", JSON.stringify(this.config, null, 2))
|
|
152
161
|
|
|
153
162
|
|
|
154
163
|
let response = await axios.post('http://127.0.0.1:2019/load', this.config, {
|