pmtiles-swarm 0.16.0 → 0.16.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.
- package/CHANGELOG.md +11 -0
- package/package.json +1 -1
- package/src/tile-stats.js +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,17 @@
|
|
|
7
7
|
### 🐞 Bug fixes
|
|
8
8
|
- _...Add new stuff here..._
|
|
9
9
|
|
|
10
|
+
## 0.16.1
|
|
11
|
+
### 🐞 Bug fixes
|
|
12
|
+
- **Client addresses are recorded without the IPv4-mapped prefix.** A dual-stack listener reports
|
|
13
|
+
IPv4 peers as `::ffff:172.16.1.2`, so the Traffic tab showed an address nobody types — and
|
|
14
|
+
would have counted one client twice had it reached the node over both stacks.
|
|
15
|
+
|
|
16
|
+
Only a display and counting matter: `trustProxy` matching is unaffected, since Express compares
|
|
17
|
+
mapped addresses against plain IPv4 entries correctly. Verified rather than assumed, because
|
|
18
|
+
`"trustProxy": "172.16.1.2, 172.16.1.3"` looking like it should not match a `::ffff:` socket is
|
|
19
|
+
exactly the sort of thing that would have been quietly wrong.
|
|
20
|
+
|
|
10
21
|
## 0.16.0
|
|
11
22
|
### ✨ Features and improvements
|
|
12
23
|
- **A Traffic tab in the console**, which is where the statistics added in 0.10.0 should have been
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmtiles-swarm",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "BitTorrent distribution for PMTiles map archives: create torrents, watch folders, publish and subscribe to RSS feeds, and seed through qBittorrent or an embedded client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/tile-stats.js
CHANGED
|
@@ -103,6 +103,12 @@ export class TileStats {
|
|
|
103
103
|
const { infoHash, z, status } = entry;
|
|
104
104
|
if (!infoHash) return;
|
|
105
105
|
|
|
106
|
+
// A dual-stack listener reports IPv4 peers as ::ffff:172.16.1.2, which is
|
|
107
|
+
// the same client written two ways -- so counting it as written would
|
|
108
|
+
// split one address across two entries the moment anything reached the
|
|
109
|
+
// node over plain IPv4 as well.
|
|
110
|
+
const ip = entry.ip ? entry.ip.replace(/^::ffff:/, '') : entry.ip;
|
|
111
|
+
|
|
106
112
|
let archive = this.#archives.get(infoHash);
|
|
107
113
|
if (!archive) {
|
|
108
114
|
archive = {
|
|
@@ -135,20 +141,20 @@ export class TileStats {
|
|
|
135
141
|
if (Number.isFinite(status)) {
|
|
136
142
|
archive.byStatus.set(status, (archive.byStatus.get(status) ?? 0) + 1);
|
|
137
143
|
}
|
|
138
|
-
if (
|
|
144
|
+
if (ip) {
|
|
139
145
|
// Counted rather than listed: a busy node sees a handful of distinct
|
|
140
146
|
// sources — the proxy, a few LAN clients — and the count is the answer
|
|
141
147
|
// to "is this arriving directly or through HAProxy".
|
|
142
|
-
const seen = archive.clients.get(
|
|
148
|
+
const seen = archive.clients.get(ip) ?? { requests: 0, bytes: 0 };
|
|
143
149
|
seen.requests += 1;
|
|
144
150
|
seen.bytes += bytes;
|
|
145
|
-
archive.clients.set(
|
|
151
|
+
archive.clients.set(ip, seen);
|
|
146
152
|
}
|
|
147
153
|
|
|
148
154
|
if (this.#limit === 0) return;
|
|
149
155
|
const row = {
|
|
150
156
|
at: archive.lastSeen,
|
|
151
|
-
ip:
|
|
157
|
+
ip: ip ?? null,
|
|
152
158
|
infoHash,
|
|
153
159
|
name: archive.name ?? null,
|
|
154
160
|
z: Number.isInteger(z) ? z : null,
|