pinokiod 3.8.102 → 3.8.104
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.
|
@@ -4,7 +4,7 @@ class Connector {
|
|
|
4
4
|
}
|
|
5
5
|
handle ({ match, connector, dial, }) {
|
|
6
6
|
console.log("connector.handle", { match, connector, dial })
|
|
7
|
-
let connector_name = connector.host + "
|
|
7
|
+
let connector_name = connector.host + ":" + connector.port
|
|
8
8
|
let listener = "0.0.0.0:PORT_PLACEHOLDER_" + connector_name
|
|
9
9
|
let listener_pointer = connector.host + ":PORT_PLACEHOLDER_" + connector_name
|
|
10
10
|
if(!this.router.config.apps.http.servers[connector_name]) {
|
package/kernel/router/index.js
CHANGED
|
@@ -49,12 +49,16 @@ class Router {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
console.log("BEFORE REPLACING", mapping)
|
|
53
|
+
|
|
52
54
|
let json = JSON.stringify(mapping)
|
|
53
55
|
for(let key in this.port_cache) {
|
|
54
56
|
console.log("replacing", key, "with", this.port_cache[key])
|
|
55
57
|
json = json.replaceAll(key, this.port_cache[key])
|
|
56
58
|
}
|
|
57
59
|
let m = JSON.parse(json)
|
|
60
|
+
|
|
61
|
+
console.log("AFTER REPLACING", m)
|
|
58
62
|
return m
|
|
59
63
|
// return mapping
|
|
60
64
|
}
|
|
@@ -89,7 +93,7 @@ class Router {
|
|
|
89
93
|
async fill() {
|
|
90
94
|
const jsonString = JSON.stringify(this.config)
|
|
91
95
|
// find all PORT_PLACEHOLDER patterns
|
|
92
|
-
const matches = jsonString.match(/:PORT_PLACEHOLDER_[0-9
|
|
96
|
+
const matches = jsonString.match(/:PORT_PLACEHOLDER_[0-9.:]+/g)
|
|
93
97
|
|
|
94
98
|
|
|
95
99
|
// iterate through them and see if the port already exists
|
|
@@ -124,8 +128,9 @@ class Router {
|
|
|
124
128
|
// local_share_ip :- 192.168....
|
|
125
129
|
let local_share_key = key.replace("PORT_PLACEHOLDER_", "")
|
|
126
130
|
let chunks = local_share_key.split(":")
|
|
127
|
-
let
|
|
128
|
-
let
|
|
131
|
+
let original_port = chunks[chunks.length-1]
|
|
132
|
+
let local_share_ip = chunks.slice(0, chunks.length-1).join(":")
|
|
133
|
+
|
|
129
134
|
let local_share_port = replaced_map[key]
|
|
130
135
|
if (!this.local_network_mapping[local_share_ip]) {
|
|
131
136
|
this.local_network_mapping[local_share_ip] = {}
|
|
@@ -11,7 +11,8 @@ class PeerPeerRouter {
|
|
|
11
11
|
let exposed_matches = matches.filter((m) => {
|
|
12
12
|
return m.endsWith(`${peer.name}.localhost`)
|
|
13
13
|
})
|
|
14
|
-
let
|
|
14
|
+
let chunks = dial.split(":")
|
|
15
|
+
let port = chunks[chunks.length-1]
|
|
15
16
|
let exposed_dial = `${peer.host}:${port}` // exposed_dial :- 192.168...
|
|
16
17
|
for(let match of exposed_matches) {
|
|
17
18
|
console.log("common.handle", { match, exposed_dial, host: peer.host })
|