Skip to content

Commit

Permalink
chore: lint nat manager (#1566)
Browse files Browse the repository at this point in the history
  • Loading branch information
maschad committed Mar 5, 2023
1 parent 828879c commit 664e475
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/nat-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { AddressManager } from '@libp2p/interface-address-manager'
const log = logger('libp2p:nat')
const DEFAULT_TTL = 7200

function highPort (min = 1024, max = 65535) {
function highPort (min = 1024, max = 65535): number {
return Math.floor(Math.random() * (max - min + 1) + min)
}

Expand Down Expand Up @@ -98,18 +98,18 @@ export class NatManager implements Startable {
}
}

isStarted () {
isStarted (): boolean {
return this.started
}

start () {}
start (): void {}

/**
* Attempt to use uPnP to configure port mapping using the current gateway.
*
* Run after start to ensure the transport manager has all addresses configured.
*/
afterStart () {
afterStart (): void {
if (isBrowser || !this.enabled || this.started) {
return
}
Expand All @@ -123,7 +123,7 @@ export class NatManager implements Startable {
})
}

async _start () {
async _start (): Promise<void> {
const addrs = this.components.transportManager.getAddrs()

for (const addr of addrs) {
Expand Down Expand Up @@ -178,7 +178,7 @@ export class NatManager implements Startable {
}
}

async _getClient () {
async _getClient (): Promise<NatAPI> {
if (this.client != null) {
return this.client
}
Expand All @@ -196,7 +196,7 @@ export class NatManager implements Startable {
/**
* Stops the NAT manager
*/
async stop () {
async stop (): Promise<void> {
if (isBrowser || this.client == null) {
return
}
Expand Down

0 comments on commit 664e475

Please sign in to comment.