Skip to content

Commit ceed8d8

Browse files
committed
chore: update export name for consistency
1 parent 124ca8a commit ceed8d8

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

doc/migrations/v0.44-v0.45.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ const node = createLibp2p({
5858

5959
```js
6060
import { createLibp2p } from 'libp2p'
61-
import { autonatService } from 'libp2p/autonat'
61+
import { autoNATService } from 'libp2p/autonat'
6262
import { circuitRelayServer } from 'libp2p/circuit-relay'
6363
import { identifyService } from 'libp2p/identify'
6464
import { pingService } from 'libp2p/ping'
6565
import { fetchService } from 'libp2p/fetch'
6666
import { uPnPNATService } from 'libp2p/upnp-nat'
6767
import { kadDHT } from '@libp2p/kad-dht'
68-
import { gossipSub } from '@ChainSafe/libp2p-gossipsub'
68+
import { gossipsub } from '@ChainSafe/libp2p-gossipsub'
6969

7070
const node = createLibp2p({
7171
// ... other options here
@@ -82,10 +82,10 @@ const node = createLibp2p({
8282
uPnPNAT: uPnPNATService({
8383
/** UPnP NAT options **/
8484
}),
85-
autonat: autonatService({
85+
autoNAT: autoNATService({
8686
/** AutoNAT options **/
8787
}),
88-
pubsub: gossipSub(),
88+
pubsub: gossipsub(),
8989
dht: kadDHT(),
9090
relay: circuitRelayServer()
9191
}

src/autonat/index.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const log = logger('libp2p:autonat')
3434
// https://github.com/libp2p/specs/blob/master/autonat/README.md#autonat-protocol
3535
const REQUIRED_SUCCESSFUL_DIALS = 4
3636

37-
export interface AutonatServiceInit {
37+
export interface AutoNATServiceInit {
3838
/**
3939
* Allows overriding the protocol prefix used
4040
*/
@@ -56,17 +56,17 @@ export interface AutonatServiceInit {
5656
refreshInterval?: number
5757

5858
/**
59-
* How many parallel inbound autonat streams we allow per-connection
59+
* How many parallel inbound autoNAT streams we allow per-connection
6060
*/
6161
maxInboundStreams?: number
6262

6363
/**
64-
* How many parallel outbound autonat streams we allow per-connection
64+
* How many parallel outbound autoNAT streams we allow per-connection
6565
*/
6666
maxOutboundStreams?: number
6767
}
6868

69-
export interface AutonatComponents {
69+
export interface AutoNATComponents {
7070
registrar: Registrar
7171
addressManager: AddressManager
7272
transportManager: TransportManager
@@ -75,8 +75,8 @@ export interface AutonatComponents {
7575
peerRouting: PeerRouting
7676
}
7777

78-
class DefaultAutonatService implements Startable {
79-
private readonly components: AutonatComponents
78+
class DefaultAutoNATService implements Startable {
79+
private readonly components: AutoNATComponents
8080
private readonly startupDelay: number
8181
private readonly refreshInterval: number
8282
private readonly protocol: string
@@ -86,7 +86,7 @@ class DefaultAutonatService implements Startable {
8686
private verifyAddressTimeout?: ReturnType<typeof setTimeout>
8787
private started: boolean
8888

89-
constructor (components: AutonatComponents, init: AutonatServiceInit) {
89+
constructor (components: AutoNATComponents, init: AutoNATServiceInit) {
9090
this.components = components
9191
this.started = false
9292
this.protocol = `/${init.protocolPrefix ?? PROTOCOL_PREFIX}/${PROTOCOL_NAME}/${PROTOCOL_VERSION}`
@@ -130,7 +130,7 @@ class DefaultAutonatService implements Startable {
130130
}
131131

132132
/**
133-
* Handle an incoming autonat request
133+
* Handle an incoming AutoNAT request
134134
*/
135135
async handleIncomingAutonatStream (data: IncomingStreamData): Promise<void> {
136136
const signal = anySignal([AbortSignal.timeout(this.timeout)])
@@ -565,8 +565,8 @@ class DefaultAutonatService implements Startable {
565565
}
566566
}
567567

568-
export function autonatService (init: AutonatServiceInit = {}): (components: AutonatComponents) => {} {
568+
export function autoNATService (init: AutoNATServiceInit = {}): (components: AutoNATComponents) => {} {
569569
return (components) => {
570-
return new DefaultAutonatService(components, init)
570+
return new DefaultAutoNATService(components, init)
571571
}
572572
}

test/autonat/index.spec.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { expect } from 'aegir/chai'
55
import sinon from 'sinon'
66
import { createEd25519PeerId } from '@libp2p/peer-id-factory'
77
import { start, stop } from '@libp2p/interfaces/startable'
8-
import { autonatService, AutonatServiceInit } from '../../src/autonat/index.js'
8+
import { autoNATService, AutoNATServiceInit } from '../../src/autonat/index.js'
99
import { StubbedInstance, stubInterface } from 'sinon-ts'
1010
import type { PeerRouting } from '@libp2p/interface-peer-routing'
1111
import { Multiaddr, multiaddr } from '@multiformats/multiaddr'
@@ -26,7 +26,7 @@ import { Components, defaultComponents } from '../../src/components.js'
2626
import { Uint8ArrayList } from 'uint8arraylist'
2727
import type { PeerInfo } from '@libp2p/interface-peer-info'
2828

29-
const defaultInit: AutonatServiceInit = {
29+
const defaultInit: AutoNATServiceInit = {
3030
protocolPrefix: 'libp2p',
3131
maxInboundStreams: 1,
3232
maxOutboundStreams: 1,
@@ -65,7 +65,7 @@ describe('autonat', () => {
6565
peerStore
6666
})
6767

68-
service = autonatService(defaultInit)(components)
68+
service = autoNATService(defaultInit)(components)
6969

7070
await start(components)
7171
await start(service)

0 commit comments

Comments
 (0)