You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 29, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+44-20
Original file line number
Diff line number
Diff line change
@@ -12,13 +12,33 @@
12
12
13
13
> Node.js implementation of the TCP module that libp2p uses, which implements the [interface-connection](https://github.com/libp2p/interface-connection) interface for dial/listen.
14
14
15
-
## Description
16
-
17
15
`libp2p-tcp` in Node.js is a very thin shim that adds support for dialing to a `multiaddr`. This small shim will enable libp2p to use other different transports.
18
16
19
17
**Note:** This module uses [pull-streams](https://pull-stream.github.io) for all stream based interfaces.
-[Converting `pull-streams` to Node.js Streams](#converting-pull-streams-to-nodejs-streams)
27
+
-[API](#api)
28
+
-[Contribute](#contribute)
29
+
-[License](#license)
30
+
31
+
## Install
32
+
33
+
### npm
34
+
35
+
```sh
36
+
> npm i libp2p-tcp
37
+
```
38
+
39
+
## Usage
40
+
41
+
### Example
22
42
23
43
```js
24
44
constTCP=require('libp2p-tcp')
@@ -51,25 +71,17 @@ listener.listen(() => {
51
71
})
52
72
```
53
73
54
-
outputs
74
+
Outputs:
55
75
56
-
```
76
+
```sh
57
77
listening
58
78
new connection opened
59
79
hello
60
80
```
61
81
62
-
##Installation
82
+
### This module uses `pull-streams`
63
83
64
-
### npm
65
-
66
-
```sh
67
-
> npm i libp2p-tcp
68
-
```
69
-
70
-
## This module uses `pull-streams`
71
-
72
-
We expose a streaming interface based on `pull-streams`, rather then on the Node.js core streams implementation (aka Node.js streams). `pull-streams` offers us a better mechanism for error handling and flow control guarantees. If you would like to know more about what took us to make this migration, see the discussion at this [issue](https://github.com/ipfs/js-ipfs/issues/362).
84
+
We expose a streaming interface based on `pull-streams`, rather then on the Node.js core streams implementation (aka Node.js streams). `pull-streams` offers us a better mechanism for error handling and flow control guarantees. If you would like to know more about why we did this, see the discussion at this [issue](https://github.com/ipfs/js-ipfs/issues/362).
73
85
74
86
You can learn more about pull-streams at:
75
87
@@ -78,18 +90,18 @@ You can learn more about pull-streams at:
78
90
-[pull-streams, the simple streaming primitive](http://dominictarr.com/post/149248845122/pull-streams-pull-streams-are-a-very-simple)
If you are a Node.js streams user, you can convert a pull-stream to Node.js Stream using the module `pull-stream-to-stream`, giving you an instance of a Node.js stream that is linked to the pull-stream. Example:
95
+
If you are a Node.js streams user, you can convert a pull-stream to a Node.js stream using the module [`pull-stream-to-stream`](https://github.com/dominictarr/pull-stream-to-stream), giving you an instance of a Node.js stream that is linked to the pull-stream. For example:
// nodeStreamInstance is an instance of a Node.js Stream
90
102
```
91
103
92
-
To learn more about his utility, visit https://pull-stream.github.io/#pull-stream-to-stream
104
+
To learn more about this utility, visit https://pull-stream.github.io/#pull-stream-to-stream.
93
105
94
106
## API
95
107
@@ -102,6 +114,18 @@ To learn more about his utility, visit https://pull-stream.github.io/#pull-strea
102
114
103
115
Both for dialing and listening.
104
116
117
+
## Contribute
118
+
119
+
Contributions are welcome! The libp2p implementation in JavaScript is a work in progress. As such, there's a few things you can do right now to help out:
120
+
121
+
-[Check out the existing issues](//github.com/libp2p/js-libp2p-tcp/issues).
122
+
-**Perform code reviews**.
123
+
-**Add tests**. There can never be enough tests.
124
+
125
+
Please be aware that all interactions related to libp2p are subject to the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
126
+
127
+
Small note: If editing the README, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.
0 commit comments