pinokiod 3.8.64 → 3.8.66

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.
@@ -77,24 +77,12 @@ class Router {
77
77
  let info = this.info()
78
78
  console.log("published info", info)
79
79
  let pub = {}
80
- for(let host in info) {
81
- let routes = info[host]
82
- pub[host] = {}
83
- for(let dial in routes) {
84
- let matches = routes[dial]
85
- // current host => the single source of truth
86
- if (dial.startsWith(this.kernel.peer.host)) {
87
- pub[host][dial] = matches
88
- // let exposed_matches = matches.filter((m) => {
89
- // return m.endsWith(`${this.kernel.peer.name}.localhost`)
90
- // })
91
- // let port = dial.split(":")[1]
92
- // let exposed_port = this.port_mapping[`${port}`]
93
- // let exposed_dial = `${this.kernel.peer.host}:${exposed_port}` // exposed_dial :- 192.168...
94
- // pub[host][exposed_dial] = exposed_matches
95
- } else {
96
- pub[host][dial] = matches
97
- }
80
+ let routes = info[this.kernel.peer.host]
81
+ for(let dial in routes) {
82
+ let matches = routes[dial]
83
+ // current host => the single source of truth
84
+ if (dial.startsWith(this.kernel.peer.host)) {
85
+ pub[dial] = matches
98
86
  }
99
87
  }
100
88
  return pub
@@ -5,9 +5,8 @@ class PeerPeerRouter {
5
5
  this.common = new Common(router)
6
6
  }
7
7
  handle(peer) {
8
- let routes = peer.router[peer.host]
9
- for(let dial in routes) {
10
- let matches = routes[dial]
8
+ for(let dial in peer.router) {
9
+ let matches = peer.router[dial]
11
10
  let exposed_matches = matches.filter((m) => {
12
11
  return m.endsWith(`${peer.name}.localhost`)
13
12
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.8.64",
3
+ "version": "3.8.66",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2625,9 +2625,13 @@ class Server {
2625
2625
  await this.kernel.router.refresh()
2626
2626
  let list = await this.kernel.processes.refresh()
2627
2627
  list = list.map((item) => {
2628
+ let internal_port = item.ip.split(":")[1]
2629
+ let external_port = this.kernel.router.port_mapping[internal_port]
2630
+ let external_ip = `${this.kernel.peer.host}:${external_port}`
2631
+ console.log({ internal_port, external_port, external_ip })
2628
2632
  return {
2629
2633
  //proxy: this.kernel.caddy.mapping[item.ip] || [],
2630
- router: this.kernel.router.info()[this.kernel.peer.host][item.ip] || [],
2634
+ router: this.kernel.router.published()[external_ip] || [],
2631
2635
  ...item
2632
2636
  }
2633
2637
  })
@@ -2724,6 +2728,8 @@ class Server {
2724
2728
  }
2725
2729
  }
2726
2730
 
2731
+ console.log("LIST", JSON.stringify(list, null, 2))
2732
+
2727
2733
  res.render("proxy", {
2728
2734
  ip: this.kernel.peer.current_ip,
2729
2735
  peers,