@@ -25,58 +25,115 @@ ipfs.swarm.addrs(function (err, addrs) {})
25
25
26
26
##### ` Go ` ** WIP**
27
27
28
- ##### ` JavaScript ` - ipfs.swarm.SOMETHING(data , [ callback] )
28
+ ##### ` JavaScript ` - ipfs.swarm.connect(addr , [ callback] )
29
29
30
- ` callback ` must follow ` function (err, res) {} ` signature, where ` err ` is an error if the operation was not successful. ` res ` will be an array of:
30
+ Where ` addr ` is of type [ multiaddr] ( https://github.com/multiformats/js-multiaddr )
31
+
32
+ ` callback ` must follow ` function (err, res) {} ` signature, where ` err ` is an error if the operation was not successful.
31
33
32
34
If no ` callback ` is passed, a promise is returned.
33
35
34
36
Example:
35
37
38
+ ``` JavaScript
39
+ ipfs .swarm .connect (addr, function (err ) {
40
+ // if no err is present, connection is now open
41
+ })
42
+ ```
36
43
37
44
#### ` disconnect `
38
45
39
46
> Close a connection on a given address.
40
47
41
48
##### ` Go ` ** WIP**
42
49
43
- ##### ` JavaScript ` - ipfs.swarm.SOMETHING(data , [ callback] )
50
+ ##### ` JavaScript ` - ipfs.swarm.disconnect(addr , [ callback] )
44
51
45
- ` callback ` must follow ` function (err, res) {} ` signature, where ` err ` is an error if the operation was not successful. ` res ` will be an array of:
52
+ Where ` addr ` is of type [ multiaddr] ( https://github.com/multiformats/js-multiaddr )
53
+
54
+ ` callback ` must follow ` function (err) {} ` signature, where ` err ` is an error if the operation was not successful.
46
55
47
56
If no ` callback ` is passed, a promise is returned.
48
57
49
58
Example:
50
59
60
+ ``` JavaScript
61
+ ipfs .swarm .disconnect (addr, function (err ) {})
62
+ ```
51
63
52
64
#### ` filters `
53
65
54
- > Manipulate address filters
66
+ > Display current multiaddr filters
67
+
68
+ ##### ` Go ` ** WIP**
69
+
70
+ ##### ` JavaScript ` - ipfs.swarm.filters([ callback] )
71
+
72
+ ` callback ` must follow ` function (err, filters) {} ` signature, where ` err ` is an error if the operation was not successful. ` filters ` is an array of multiaddrs that represent the filters being applied.
73
+
74
+ If no ` callback ` is passed, a promise is returned.
75
+
76
+ Example:
77
+
78
+ ``` JavaScript
79
+ ipfs .swarm .filters (function (err , filters ) {})
80
+ ```
81
+
82
+ #### ` filters.add `
83
+
84
+ > Add another filter.
55
85
56
86
##### ` Go ` ** WIP**
57
87
58
- ##### ` JavaScript ` - ipfs.swarm.filters(data, [ callback] )
88
+ ##### ` JavaScript ` - ipfs.swarm.filters.add(filter, [ callback] )
89
+
90
+ Where ` filter ` is of type [ multiaddr] ( )
91
+
92
+ ` callback ` must follow ` function (err) {} ` signature, where ` err ` is an error if the operation was not successful.
93
+
94
+ If no ` callback ` is passed, a promise is returned.
95
+
96
+ Example:
97
+
98
+ ``` JavaScript
99
+ ipfs .swarm .filters .add (filter, function (err ) {})
100
+ ```
101
+
102
+ #### ` filters.rm `
103
+
104
+ > Remove a filter
105
+
106
+ ##### ` Go ` ** WIP**
107
+
108
+ ##### ` JavaScript ` - ipfs.swarm.filters.rm(filter, [ callback] )
109
+
110
+ Where ` filter ` is of type [ multiaddr] ( )
59
111
60
112
` callback ` must follow ` function (err, res) {} ` signature, where ` err ` is an error if the operation was not successful. ` res ` will be an array of:
61
113
62
114
If no ` callback ` is passed, a promise is returned.
63
115
64
116
Example:
65
117
118
+ ``` JavaScript
119
+ ipfs .swarm .filters .rm (filter, function (err ) {})
120
+ ```
66
121
67
122
#### ` peers `
68
123
69
124
> List out the peers that we have connections with.
70
125
71
126
##### ` Go ` ** WIP**
72
127
73
- ##### ` JavaScript ` - ipfs.swarm.peers(data, [ callback] )
128
+ ##### ` JavaScript ` - ipfs.swarm.peers([ callback] )
74
129
75
- ` callback ` must follow ` function (err, res ) {} ` signature, where ` err ` is an error if the operation was not successful. ` res ` will be an array of:
130
+ ` callback ` must follow ` function (err, peerInfos ) {} ` signature, where ` err ` is an error if the operation was not successful. ` peerInfos ` will be an array of [ PeerInfo ] ( ) .
76
131
77
132
If no ` callback ` is passed, a promise is returned.
78
133
79
134
Example:
80
135
81
-
136
+ ``` JavaScript
137
+ ipfs .swarm .peers (function (err , peerInfos ) {})
138
+ ```
82
139
0 commit comments