diff --git a/commands/nntp_probe.ts b/commands/nntp_probe.ts index 74c02f4..def2aec 100644 --- a/commands/nntp_probe.ts +++ b/commands/nntp_probe.ts @@ -30,6 +30,14 @@ export default class NntpProbe extends BaseCommand { @flags.boolean({ description: 'Only the span itself and the wider ones, no bisection' }) declare noBisect: boolean + @flags.boolean({ description: 'Without XFEATURE COMPRESS GZIP' }) + declare plain: boolean + + @flags.string({ + description: 'Only spans from the article of these sizes, e.g. "8,16,24,32,48,64"', + }) + declare sizes?: string + private timeoutMs = 20_000 private info = { count: 0, low: 0, high: 0 } @@ -41,10 +49,14 @@ export default class NntpProbe extends BaseCommand { this.info = await client.group(this.group) client.close() this.logger.info( - `${this.group}: ${this.info.count} articles, ${this.info.low}–${this.info.high}.` + `${this.group}: ${this.info.count} articles, ${this.info.low}–${this.info.high}${this.plain ? '; plain' : '; compressed'}.` ) const span = (from: number, to: number) => [Math.max(this.info.low, from), Math.min(this.info.high, to)] as const + if (this.sizes) { + for (const n of this.sizes.split(',').map(Number)) await this.probe(...span(a, a + n - 1)) + return + } this.logger.info('The span and wider ones:') await this.probe(...span(a, a + size - 1)) await this.probe(...span(a, a + size * 32 - 1)) @@ -98,7 +110,7 @@ export default class NntpProbe extends BaseCommand { user: env.get('NNTP_USER'), password: env.get('NNTP_PASSWORD'), secure: env.get('NNTP_SECURE', true), - compress: true, + compress: !this.plain, timeoutMs: this.timeoutMs, }) }