Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: extract DCUtR into separate module #2220

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .release-please.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"packages/peer-record": {},
"packages/peer-store": {},
"packages/protocol-autonat": {},
"packages/protocol-dcutr": {},
"packages/protocol-identify": {},
"packages/protocol-perf": {},
"packages/protocol-ping": {},
Expand Down
31 changes: 31 additions & 0 deletions doc/migrations/v0.46-v1.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ A migration guide for refactoring your application code from libp2p `v0.46` to `
- [AutoNAT](#autonat)
- [Ping](#ping)
- [Identify](#identify)
- [DCUtR](#dcutr)
- [KeyChain](#keychain)
- [UPnPNat](#upnpnat)
- [Pnet](#pnet)
Expand Down Expand Up @@ -103,6 +104,36 @@ const node = await createLibp2p({
})
```

## DCUtR

The DCUtR service is now published in its own package.

**Before**

```ts
import { createLibp2p } from 'libp2p'
import { dcutrService } from 'libp2p/dcutr'

const node = await createLibp2p({
services: {
identify: dcutrService()
}
})
```

**After**

```ts
import { createLibp2p } from 'libp2p'
import { dcutr } from '@libp2p/dcutr'

const node = await createLibp2p({
services: {
dcutr: dcutr()
}
})
```

## KeyChain

The KeyChain object is no longer included on Libp2p and must be instantiated explicitly if desired.
Expand Down
6 changes: 3 additions & 3 deletions packages/interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
"!dist/test",
"!**/*.tsbuildinfo"
],
"browser": {
"events": "./dist/src/events.browser.js"
},
"exports": {
".": {
"types": "./dist/src/index.d.ts",
Expand Down Expand Up @@ -178,5 +175,8 @@
"it-drain": "^3.0.3",
"sinon": "^17.0.0",
"sinon-ts": "^2.0.0"
},
"browser": {
"events": "./dist/src/events.browser.js"
}
}
1 change: 1 addition & 0 deletions packages/interface/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ export class InvalidCryptoTransmissionError extends Error {
export const ERR_TIMEOUT = 'ERR_TIMEOUT'
export const ERR_INVALID_PARAMETERS = 'ERR_INVALID_PARAMETERS'
export const ERR_NOT_FOUND = 'ERR_NOT_FOUND'
export const ERR_INVALID_MESSAGE = 'ERR_INVALID_MESSAGE'
4 changes: 0 additions & 4 deletions packages/libp2p/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@
"types": "./dist/src/circuit-relay/index.d.ts",
"import": "./dist/src/circuit-relay/index.js"
},
"./dcutr": {
"types": "./dist/src/dcutr/index.d.ts",
"import": "./dist/src/dcutr/index.js"
},
"./fetch": {
"types": "./dist/src/fetch/index.d.ts",
"import": "./dist/src/fetch/index.js"
Expand Down
177 changes: 0 additions & 177 deletions packages/libp2p/test/dcutr/dcutr.node.ts

This file was deleted.

3 changes: 1 addition & 2 deletions packages/logger/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**
* @packageDocumentation
*
* A logger for libp2p based on the venerable [debug](https://www.npmjs.com/package/debug)
* module.
* A logger for libp2p based on the venerable [debug](https://www.npmjs.com/package/debug) module.
*
* @example
*
Expand Down
2 changes: 1 addition & 1 deletion packages/pnet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@libp2p/pnet",
"version": "1.0.0",
"version": "0.0.0",
"description": "Implementation of Connection protection management via a shared secret",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/pnet#readme",
Expand Down
4 changes: 4 additions & 0 deletions packages/protocol-dcutr/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This project is dual licensed under MIT and Apache-2.0.

MIT: https://www.opensource.org/licenses/mit
Apache-2.0: https://www.apache.org/licenses/license-2.0
5 changes: 5 additions & 0 deletions packages/protocol-dcutr/LICENSE-APACHE
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
19 changes: 19 additions & 0 deletions packages/protocol-dcutr/LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading
Loading