Skip to content

Commit

Permalink
fix: lower minimum ttl to one minute (#70)
Browse files Browse the repository at this point in the history
fixes #66
  • Loading branch information
achingbrain authored Sep 12, 2024
1 parent aa85f31 commit 07e2c41
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const log = logger('nat-port-mapper')

export interface NatAPIOptions {
/**
* Minimum 20 minutes, default 2 hours
* TTL in seconds, minimum one minute
*
* @default 7200
*/
ttl?: number
description?: string
Expand Down Expand Up @@ -52,8 +54,8 @@ export class NatAPI {
private readonly updateIntervals: Map<string, any>

constructor (opts: NatAPIOptions = {}, client: Client) {
// TTL is 2 hours (min 20 min)
this.ttl = opts.ttl != null ? Math.max(opts.ttl, 1200) : 7200
// TTL is 2 hours (min 60 secs, default 2 hours)
this.ttl = opts.ttl != null ? Math.max(opts.ttl, 60) : 7200
this.description = opts.description ?? 'NatAPI'
this.gateway = opts.gateway
this.keepAlive = opts.keepAlive ?? true
Expand Down

0 comments on commit 07e2c41

Please sign in to comment.