@cryptotaxi247 / kubo / commits / 5d712166b

feat: detect changes in go-libp2p-resource-manager (#8857)

This adds simple check that will scream loud and clear every time go-libp2p libraries change any of the implicit defaults related to go-libp2p-resource-manager

Marcin Rataj committed Apr 8, 2022 at 17:43 UTC 5d712166b292aef2bb770c036182ec261fc08357
4 files changed +594 -242
core/node/libp2p/rcmgr.go
+1 -1
@@ -69,7 +69,7 @@ func ResourceManager(cfg config.SwarmConfig) func(fx.Lifecycle, repo.Repo) (netw
69 return nil, opts, err
70 }
71
72 - setDefaultServiceLimits(limiter) // see rcmgr_defaults.go
72 + libp2p.SetDefaultServiceLimits(limiter)
73
74 ropts := []rcmgr.Option{rcmgr.WithMetrics(createRcmgrMetrics())}
75
core/node/libp2p/rcmgr_defaults.go
+584 -241
@@ -1,27 +1,25 @@
1 package libp2p
2
3 import (
4 + "encoding/json"
5 + "fmt"
6 "math/bits"
7 + "strings"
8
9 config "github.com/ipfs/go-ipfs/config"
7 - "github.com/libp2p/go-libp2p-core/protocol"
10 + "github.com/libp2p/go-libp2p"
11 rcmgr "github.com/libp2p/go-libp2p-resource-manager"
9 - "github.com/libp2p/go-libp2p/p2p/host/autonat"
10 - relayv1 "github.com/libp2p/go-libp2p/p2p/protocol/circuitv1/relay"
11 - circuit "github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/proto"
12 - relayv2 "github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay"
13 - "github.com/libp2p/go-libp2p/p2p/protocol/holepunch"
14 - "github.com/libp2p/go-libp2p/p2p/protocol/identify"
15 - "github.com/libp2p/go-libp2p/p2p/protocol/ping"
12 +
13 + "github.com/wI2L/jsondiff"
14 )
15
16 // This file defines implicit limit defaults used when Swarm.ResourceMgr.Enabled
19 -// We keep vendored copy to ensure go-ipfs is not impacted when go-libp2p decides
20 -// to change defaults in any of the future releases.
17
18 // adjustedDefaultLimits allows for tweaking defaults based on external factors,
19 // such as values in Swarm.ConnMgr.HiWater config.
20 func adjustedDefaultLimits(cfg config.SwarmConfig) rcmgr.DefaultLimitConfig {
21 + // Run checks to avoid introducing regressions
22 + checkImplicitDefaults()
23
24 // Return to use unmodified static limits based on values from go-libp2p 0.18
25 // return defaultLimits
@@ -30,7 +28,7 @@ func adjustedDefaultLimits(cfg config.SwarmConfig) rcmgr.DefaultLimitConfig {
28 // (based on https://github.com/filecoin-project/lotus/pull/8318/files)
29 // - give it more memory, up to 4G, min of 1G
30 // - if Swarm.ConnMgr.HighWater is too high, adjust Conn/FD/Stream limits
33 - defaultLimits := staticDefaultLimits.WithSystemMemory(.125, 1<<30, 4<<30)
31 + defaultLimits := rcmgr.DefaultLimits.WithSystemMemory(.125, 1<<30, 4<<30)
32
33 // Do we need to adjust due to Swarm.ConnMgr.HighWater?
34 if cfg.ConnMgr.Type == "basic" {
@@ -67,247 +65,592 @@ func logScale(val int) int {
65 return 1 << bitlen
66 }
67
70 -// defaultLimits are the limits used by the default rcmgr limiter constructors.
71 -// This is a vendored copy of
72 -// https://github.com/libp2p/go-libp2p-resource-manager/blob/v0.1.5/limit_defaults.go#L49
73 -var staticDefaultLimits = rcmgr.DefaultLimitConfig{
74 - SystemBaseLimit: rcmgr.BaseLimit{
75 - StreamsInbound: 4096,
76 - StreamsOutbound: 16384,
77 - Streams: 16384,
78 - ConnsInbound: 256,
79 - ConnsOutbound: 1024,
80 - Conns: 1024,
81 - FD: 512,
82 - },
83 -
84 - SystemMemory: rcmgr.MemoryLimit{
85 - MemoryFraction: 0.125,
86 - MinMemory: 128 << 20,
87 - MaxMemory: 1 << 30,
88 - },
89 -
90 - TransientBaseLimit: rcmgr.BaseLimit{
91 - StreamsInbound: 128,
92 - StreamsOutbound: 512,
93 - Streams: 512,
94 - ConnsInbound: 32,
95 - ConnsOutbound: 128,
96 - Conns: 128,
97 - FD: 128,
98 - },
99 -
100 - TransientMemory: rcmgr.MemoryLimit{
101 - MemoryFraction: 1,
102 - MinMemory: 64 << 20,
103 - MaxMemory: 64 << 20,
104 - },
105 -
106 - ServiceBaseLimit: rcmgr.BaseLimit{
107 - StreamsInbound: 2048,
108 - StreamsOutbound: 8192,
109 - Streams: 8192,
110 - },
111 -
112 - ServiceMemory: rcmgr.MemoryLimit{
113 - MemoryFraction: 0.125 / 4,
114 - MinMemory: 64 << 20,
115 - MaxMemory: 256 << 20,
116 - },
117 -
118 - ServicePeerBaseLimit: rcmgr.BaseLimit{
119 - StreamsInbound: 256,
120 - StreamsOutbound: 512,
121 - Streams: 512,
122 - },
123 -
124 - ServicePeerMemory: rcmgr.MemoryLimit{
125 - MemoryFraction: 0.125 / 16,
126 - MinMemory: 16 << 20,
127 - MaxMemory: 64 << 20,
128 - },
129 -
130 - ProtocolBaseLimit: rcmgr.BaseLimit{
131 - StreamsInbound: 1024,
132 - StreamsOutbound: 4096,
133 - Streams: 4096,
134 - },
135 -
136 - ProtocolMemory: rcmgr.MemoryLimit{
137 - MemoryFraction: 0.125 / 8,
138 - MinMemory: 64 << 20,
139 - MaxMemory: 128 << 20,
140 - },
141 -
142 - ProtocolPeerBaseLimit: rcmgr.BaseLimit{
143 - StreamsInbound: 128,
144 - StreamsOutbound: 256,
145 - Streams: 512,
146 - },
147 -
148 - ProtocolPeerMemory: rcmgr.MemoryLimit{
149 - MemoryFraction: 0.125 / 16,
150 - MinMemory: 16 << 20,
151 - MaxMemory: 64 << 20,
152 - },
153 -
154 - PeerBaseLimit: rcmgr.BaseLimit{
155 - StreamsInbound: 512,
156 - StreamsOutbound: 1024,
157 - Streams: 1024,
158 - ConnsInbound: 8,
159 - ConnsOutbound: 16,
160 - Conns: 16,
161 - FD: 8,
162 - },
163 -
164 - PeerMemory: rcmgr.MemoryLimit{
165 - MemoryFraction: 0.125 / 16,
166 - MinMemory: 64 << 20,
167 - MaxMemory: 128 << 20,
168 - },
169 -
170 - ConnBaseLimit: rcmgr.BaseLimit{
171 - ConnsInbound: 1,
172 - ConnsOutbound: 1,
173 - Conns: 1,
174 - FD: 1,
175 - },
176 -
177 - ConnMemory: 1 << 20,
178 -
179 - StreamBaseLimit: rcmgr.BaseLimit{
180 - StreamsInbound: 1,
181 - StreamsOutbound: 1,
182 - Streams: 1,
183 - },
68 +// checkImplicitDefaults compares libp2p defaults agains expected ones
69 +// and panics when they don't match. This ensures we are not surprised
70 +// by silent default limit changes when we update go-libp2p dependencies.
71 +func checkImplicitDefaults() {
72 + ok := true
73
185 - StreamMemory: 16 << 20,
186 -}
187 -
188 -// setDefaultServiceLimits sets the default limits for bundled libp2p services.
189 -// This is a vendored copy of
190 -// https://github.com/libp2p/go-libp2p/blob/v0.18.0/limits.go
191 -func setDefaultServiceLimits(limiter *rcmgr.BasicLimiter) {
192 - if limiter.ServiceLimits == nil {
193 - limiter.ServiceLimits = make(map[string]rcmgr.Limit)
194 - }
195 - if limiter.ServicePeerLimits == nil {
196 - limiter.ServicePeerLimits = make(map[string]rcmgr.Limit)
74 + // Check 1: did go-libp2p-resource-manager's DefaultLimits change?
75 + defaults, err := json.Marshal(rcmgr.DefaultLimits)
76 + if err != nil {
77 + log.Fatal(err)
78 }
198 - if limiter.ProtocolLimits == nil {
199 - limiter.ProtocolLimits = make(map[protocol.ID]rcmgr.Limit)
79 + changes, err := jsonDiff([]byte(expectedDefaultLimits), defaults)
80 + if err != nil {
81 + log.Fatal(err)
82 }
201 - if limiter.ProtocolPeerLimits == nil {
202 - limiter.ProtocolPeerLimits = make(map[protocol.ID]rcmgr.Limit)
83 + if len(changes) > 0 {
84 + ok = false
85 + log.Errorf("===> OOF! go-libp2p-resource-manager changed DefaultLimits\n"+
86 + "=> changes ('test' represents the old value):\n%s\n"+
87 + "=> go-libp2p-resource-manager DefaultLimits update needs a review:\n"+
88 + "Please inspect if changes impact go-ipfs users, and update expectedDefaultLimits in rcmgr_defaults.go to remove this message",
89 + strings.Join(changes, "\n"),
90 + )
91 }
92
205 - // identify
206 - setServiceLimits(limiter, identify.ServiceName,
207 - limiter.DefaultServiceLimits.
208 - WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
209 - WithStreamLimit(128, 128, 256), // max 256 streams -- symmetric
210 - peerLimit(16, 16, 32))
211 -
212 - setProtocolLimits(limiter, identify.ID,
213 - limiter.DefaultProtocolLimits.WithMemoryLimit(1, 4<<20, 32<<20),
214 - peerLimit(16, 16, 32))
215 - setProtocolLimits(limiter, identify.IDPush,
216 - limiter.DefaultProtocolLimits.WithMemoryLimit(1, 4<<20, 32<<20),
217 - peerLimit(16, 16, 32))
218 - setProtocolLimits(limiter, identify.IDDelta,
219 - limiter.DefaultProtocolLimits.WithMemoryLimit(1, 4<<20, 32<<20),
220 - peerLimit(16, 16, 32))
221 -
222 - // ping
223 - setServiceLimits(limiter, ping.ServiceName,
224 - limiter.DefaultServiceLimits.
225 - WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
226 - WithStreamLimit(128, 128, 128), // max 128 streams - asymmetric
227 - peerLimit(2, 3, 4))
228 - setProtocolLimits(limiter, ping.ID,
229 - limiter.DefaultProtocolLimits.WithMemoryLimit(1, 4<<20, 64<<20),
230 - peerLimit(2, 3, 4))
231 -
232 - // autonat
233 - setServiceLimits(limiter, autonat.ServiceName,
234 - limiter.DefaultServiceLimits.
235 - WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
236 - WithStreamLimit(128, 128, 128), // max 128 streams - asymmetric
237 - peerLimit(2, 2, 2))
238 - setProtocolLimits(limiter, autonat.AutoNATProto,
239 - limiter.DefaultProtocolLimits.WithMemoryLimit(1, 4<<20, 64<<20),
240 - peerLimit(2, 2, 2))
241 -
242 - // holepunch
243 - setServiceLimits(limiter, holepunch.ServiceName,
244 - limiter.DefaultServiceLimits.
245 - WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
246 - WithStreamLimit(128, 128, 256), // max 256 streams - symmetric
247 - peerLimit(2, 2, 2))
248 - setProtocolLimits(limiter, holepunch.Protocol,
249 - limiter.DefaultProtocolLimits.WithMemoryLimit(1, 4<<20, 64<<20),
250 - peerLimit(2, 2, 2))
251 -
252 - // relay/v1
253 - setServiceLimits(limiter, relayv1.ServiceName,
254 - limiter.DefaultServiceLimits.
255 - WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
256 - WithStreamLimit(1024, 1024, 1024), // max 1024 streams - asymmetric
257 - peerLimit(64, 64, 64))
258 -
259 - // relay/v2
260 - setServiceLimits(limiter, relayv2.ServiceName,
261 - limiter.DefaultServiceLimits.
262 - WithMemoryLimit(1, 4<<20, 64<<20). // max 64MB service memory
263 - WithStreamLimit(1024, 1024, 1024), // max 1024 streams - asymmetric
264 - peerLimit(64, 64, 64))
93 + // Check 2: did go-libp2p's SetDefaultServiceLimits change?
94 + testLimiter := rcmgr.NewStaticLimiter(rcmgr.DefaultLimits)
95 + libp2p.SetDefaultServiceLimits(testLimiter)
96
266 - // circuit protocols, both client and service
267 - setProtocolLimits(limiter, circuit.ProtoIDv1,
268 - limiter.DefaultProtocolLimits.
269 - WithMemoryLimit(1, 4<<20, 64<<20).
270 - WithStreamLimit(1280, 1280, 1280),
271 - peerLimit(128, 128, 128))
272 - setProtocolLimits(limiter, circuit.ProtoIDv2Hop,
273 - limiter.DefaultProtocolLimits.
274 - WithMemoryLimit(1, 4<<20, 64<<20).
275 - WithStreamLimit(1280, 1280, 1280),
276 - peerLimit(128, 128, 128))
277 - setProtocolLimits(limiter, circuit.ProtoIDv2Stop,
278 - limiter.DefaultProtocolLimits.
279 - WithMemoryLimit(1, 4<<20, 64<<20).
280 - WithStreamLimit(1280, 1280, 1280),
281 - peerLimit(128, 128, 128))
282 -
283 -}
284 -
285 -func setServiceLimits(limiter *rcmgr.BasicLimiter, svc string, limit rcmgr.Limit, peerLimit rcmgr.Limit) {
286 - if _, ok := limiter.ServiceLimits[svc]; !ok {
287 - limiter.ServiceLimits[svc] = limit
97 + serviceDefaults, err := json.Marshal(testLimiter)
98 + if err != nil {
99 + log.Fatal(err)
100 }
289 - if _, ok := limiter.ServicePeerLimits[svc]; !ok {
290 - limiter.ServicePeerLimits[svc] = peerLimit
101 + changes, err = jsonDiff([]byte(expectedDefaultServiceLimits), serviceDefaults)
102 + if err != nil {
103 + log.Fatal(err)
104 }
292 -}
293 -
294 -func setProtocolLimits(limiter *rcmgr.BasicLimiter, proto protocol.ID, limit rcmgr.Limit, peerLimit rcmgr.Limit) {
295 - if _, ok := limiter.ProtocolLimits[proto]; !ok {
296 - limiter.ProtocolLimits[proto] = limit
105 + if len(changes) > 0 {
106 + ok = false
107 + log.Errorf("===> OOF! go-libp2p changed DefaultServiceLimits\n"+
108 + "=> changes ('test' represents the old value):\n%s\n"+
109 + "=> go-libp2p SetDefaultServiceLimits update needs a review:\n"+
110 + "Please inspect if changes impact go-ipfs users, and update expectedDefaultServiceLimits in rcmgr_defaults.go to remove this message",
111 + strings.Join(changes, "\n"),
112 + )
113 }
298 - if _, ok := limiter.ProtocolPeerLimits[proto]; !ok {
299 - limiter.ProtocolPeerLimits[proto] = peerLimit
114 + if !ok {
115 + log.Fatal("daemon will refuse to run with the resource manager until this is resolved")
116 }
117 }
118
303 -func peerLimit(numStreamsIn, numStreamsOut, numStreamsTotal int) rcmgr.Limit {
304 - return &rcmgr.StaticLimit{
305 - // memory: 256kb for window buffers plus some change for message buffers per stream
306 - Memory: int64(numStreamsTotal * (256<<10 + 16384)),
307 - BaseLimit: rcmgr.BaseLimit{
308 - StreamsInbound: numStreamsIn,
309 - StreamsOutbound: numStreamsOut,
310 - Streams: numStreamsTotal,
311 - },
119 +// jsonDiff compares two strings and returns diff in JSON Patch format
120 +func jsonDiff(old []byte, updated []byte) ([]string, error) {
121 + // generate 'invertible' patch which includes old values as "test" op
122 + patch, err := jsondiff.CompareJSONOpts(old, updated, jsondiff.Invertible())
123 + changes := make([]string, len(patch))
124 + if err != nil {
125 + return changes, err
126 + }
127 + for i, op := range patch {
128 + changes[i] = fmt.Sprintf(" %s", op)
129 }
130 + return changes, nil
131 }
132 +
133 +// https://github.com/libp2p/go-libp2p-resource-manager/blob/v0.1.5/limit_defaults.go#L49
134 +const expectedDefaultLimits = `{
135 + "SystemBaseLimit": {
136 + "Streams": 16384,
137 + "StreamsInbound": 4096,
138 + "StreamsOutbound": 16384,
139 + "Conns": 1024,
140 + "ConnsInbound": 256,
141 + "ConnsOutbound": 1024,
142 + "FD": 512
143 + },
144 + "SystemMemory": {
145 + "MemoryFraction": 0.125,
146 + "MinMemory": 134217728,
147 + "MaxMemory": 1073741824
148 + },
149 + "TransientBaseLimit": {
150 + "Streams": 512,
151 + "StreamsInbound": 128,
152 + "StreamsOutbound": 512,
153 + "Conns": 128,
154 + "ConnsInbound": 32,
155 + "ConnsOutbound": 128,
156 + "FD": 128
157 + },
158 + "TransientMemory": {
159 + "MemoryFraction": 1,
160 + "MinMemory": 67108864,
161 + "MaxMemory": 67108864
162 + },
163 + "ServiceBaseLimit": {
164 + "Streams": 8192,
165 + "StreamsInbound": 2048,
166 + "StreamsOutbound": 8192,
167 + "Conns": 0,
168 + "ConnsInbound": 0,
169 + "ConnsOutbound": 0,
170 + "FD": 0
171 + },
172 + "ServiceMemory": {
173 + "MemoryFraction": 0.03125,
174 + "MinMemory": 67108864,
175 + "MaxMemory": 268435456
176 + },
177 + "ServicePeerBaseLimit": {
178 + "Streams": 512,
179 + "StreamsInbound": 256,
180 + "StreamsOutbound": 512,
181 + "Conns": 0,
182 + "ConnsInbound": 0,
183 + "ConnsOutbound": 0,
184 + "FD": 0
185 + },
186 + "ServicePeerMemory": {
187 + "MemoryFraction": 0.0078125,
188 + "MinMemory": 16777216,
189 + "MaxMemory": 67108864
190 + },
191 + "ProtocolBaseLimit": {
192 + "Streams": 4096,
193 + "StreamsInbound": 1024,
194 + "StreamsOutbound": 4096,
195 + "Conns": 0,
196 + "ConnsInbound": 0,
197 + "ConnsOutbound": 0,
198 + "FD": 0
199 + },
200 + "ProtocolMemory": {
201 + "MemoryFraction": 0.015625,
202 + "MinMemory": 67108864,
203 + "MaxMemory": 134217728
204 + },
205 + "ProtocolPeerBaseLimit": {
206 + "Streams": 512,
207 + "StreamsInbound": 128,
208 + "StreamsOutbound": 256,
209 + "Conns": 0,
210 + "ConnsInbound": 0,
211 + "ConnsOutbound": 0,
212 + "FD": 0
213 + },
214 + "ProtocolPeerMemory": {
215 + "MemoryFraction": 0.0078125,
216 + "MinMemory": 16777216,
217 + "MaxMemory": 67108864
218 + },
219 + "PeerBaseLimit": {
220 + "Streams": 1024,
221 + "StreamsInbound": 512,
222 + "StreamsOutbound": 1024,
223 + "Conns": 16,
224 + "ConnsInbound": 8,
225 + "ConnsOutbound": 16,
226 + "FD": 8
227 + },
228 + "PeerMemory": {
229 + "MemoryFraction": 0.0078125,
230 + "MinMemory": 67108864,
231 + "MaxMemory": 134217728
232 + },
233 + "ConnBaseLimit": {
234 + "Streams": 0,
235 + "StreamsInbound": 0,
236 + "StreamsOutbound": 0,
237 + "Conns": 1,
238 + "ConnsInbound": 1,
239 + "ConnsOutbound": 1,
240 + "FD": 1
241 + },
242 + "ConnMemory": 1048576,
243 + "StreamBaseLimit": {
244 + "Streams": 1,
245 + "StreamsInbound": 1,
246 + "StreamsOutbound": 1,
247 + "Conns": 0,
248 + "ConnsInbound": 0,
249 + "ConnsOutbound": 0,
250 + "FD": 0
251 + },
252 + "StreamMemory": 16777216
253 +}`
254 +
255 +// https://github.com/libp2p/go-libp2p/blob/v0.18.0/limits.go#L17
256 +const expectedDefaultServiceLimits = `{
257 + "SystemLimits": {
258 + "Streams": 16384,
259 + "StreamsInbound": 4096,
260 + "StreamsOutbound": 16384,
261 + "Conns": 1024,
262 + "ConnsInbound": 256,
263 + "ConnsOutbound": 1024,
264 + "FD": 512,
265 + "Memory": 1073741824
266 + },
267 + "TransientLimits": {
268 + "Streams": 512,
269 + "StreamsInbound": 128,
270 + "StreamsOutbound": 512,
271 + "Conns": 128,
272 + "ConnsInbound": 32,
273 + "ConnsOutbound": 128,
274 + "FD": 128,
275 + "Memory": 67108864
276 + },
277 + "DefaultServiceLimits": {
278 + "Streams": 8192,
279 + "StreamsInbound": 2048,
280 + "StreamsOutbound": 8192,
281 + "Conns": 0,
282 + "ConnsInbound": 0,
283 + "ConnsOutbound": 0,
284 + "FD": 0,
285 + "Memory": 67108864
286 + },
287 + "DefaultServicePeerLimits": {
288 + "Streams": 512,
289 + "StreamsInbound": 256,
290 + "StreamsOutbound": 512,
291 + "Conns": 0,
292 + "ConnsInbound": 0,
293 + "ConnsOutbound": 0,
294 + "FD": 0,
295 + "Memory": 16777216
296 + },
297 + "ServiceLimits": {
298 + "libp2p.autonat": {
299 + "Streams": 128,
300 + "StreamsInbound": 128,
301 + "StreamsOutbound": 128,
302 + "Conns": 0,
303 + "ConnsInbound": 0,
304 + "ConnsOutbound": 0,
305 + "FD": 0,
306 + "Memory": 67108864
307 + },
308 + "libp2p.holepunch": {
309 + "Streams": 256,
310 + "StreamsInbound": 128,
311 + "StreamsOutbound": 128,
312 + "Conns": 0,
313 + "ConnsInbound": 0,
314 + "ConnsOutbound": 0,
315 + "FD": 0,
316 + "Memory": 67108864
317 + },
318 + "libp2p.identify": {
319 + "Streams": 256,
320 + "StreamsInbound": 128,
321 + "StreamsOutbound": 128,
322 + "Conns": 0,
323 + "ConnsInbound": 0,
324 + "ConnsOutbound": 0,
325 + "FD": 0,
326 + "Memory": 67108864
327 + },
328 + "libp2p.ping": {
329 + "Streams": 128,
330 + "StreamsInbound": 128,
331 + "StreamsOutbound": 128,
332 + "Conns": 0,
333 + "ConnsInbound": 0,
334 + "ConnsOutbound": 0,
335 + "FD": 0,
336 + "Memory": 67108864
337 + },
338 + "libp2p.relay/v1": {
339 + "Streams": 1024,
340 + "StreamsInbound": 1024,
341 + "StreamsOutbound": 1024,
342 + "Conns": 0,
343 + "ConnsInbound": 0,
344 + "ConnsOutbound": 0,
345 + "FD": 0,
346 + "Memory": 67108864
347 + },
348 + "libp2p.relay/v2": {
349 + "Streams": 1024,
350 + "StreamsInbound": 1024,
351 + "StreamsOutbound": 1024,
352 + "Conns": 0,
353 + "ConnsInbound": 0,
354 + "ConnsOutbound": 0,
355 + "FD": 0,
356 + "Memory": 67108864
357 + }
358 + },
359 + "ServicePeerLimits": {
360 + "libp2p.autonat": {
361 + "Streams": 2,
362 + "StreamsInbound": 2,
363 + "StreamsOutbound": 2,
364 + "Conns": 0,
365 + "ConnsInbound": 0,
366 + "ConnsOutbound": 0,
367 + "FD": 0,
368 + "Memory": 557056
369 + },
370 + "libp2p.holepunch": {
371 + "Streams": 2,
372 + "StreamsInbound": 2,
373 + "StreamsOutbound": 2,
374 + "Conns": 0,
375 + "ConnsInbound": 0,
376 + "ConnsOutbound": 0,
377 + "FD": 0,
378 + "Memory": 557056
379 + },
380 + "libp2p.identify": {
381 + "Streams": 32,
382 + "StreamsInbound": 16,
383 + "StreamsOutbound": 16,
384 + "Conns": 0,
385 + "ConnsInbound": 0,
386 + "ConnsOutbound": 0,
387 + "FD": 0,
388 + "Memory": 8912896
389 + },
390 + "libp2p.ping": {
391 + "Streams": 4,
392 + "StreamsInbound": 2,
393 + "StreamsOutbound": 3,
394 + "Conns": 0,
395 + "ConnsInbound": 0,
396 + "ConnsOutbound": 0,
397 + "FD": 0,
398 + "Memory": 1114112
399 + },
400 + "libp2p.relay/v1": {
401 + "Streams": 64,
402 + "StreamsInbound": 64,
403 + "StreamsOutbound": 64,
404 + "Conns": 0,
405 + "ConnsInbound": 0,
406 + "ConnsOutbound": 0,
407 + "FD": 0,
408 + "Memory": 17825792
409 + },
410 + "libp2p.relay/v2": {
411 + "Streams": 64,
412 + "StreamsInbound": 64,
413 + "StreamsOutbound": 64,
414 + "Conns": 0,
415 + "ConnsInbound": 0,
416 + "ConnsOutbound": 0,
417 + "FD": 0,
418 + "Memory": 17825792
419 + }
420 + },
421 + "DefaultProtocolLimits": {
422 + "Streams": 4096,
423 + "StreamsInbound": 1024,
424 + "StreamsOutbound": 4096,
425 + "Conns": 0,
426 + "ConnsInbound": 0,
427 + "ConnsOutbound": 0,
428 + "FD": 0,
429 + "Memory": 67108864
430 + },
431 + "DefaultProtocolPeerLimits": {
432 + "Streams": 512,
433 + "StreamsInbound": 128,
434 + "StreamsOutbound": 256,
435 + "Conns": 0,
436 + "ConnsInbound": 0,
437 + "ConnsOutbound": 0,
438 + "FD": 0,
439 + "Memory": 16777216
440 + },
441 + "ProtocolLimits": {
442 + "/ipfs/id/1.0.0": {
443 + "Streams": 4096,
444 + "StreamsInbound": 1024,
445 + "StreamsOutbound": 4096,
446 + "Conns": 0,
447 + "ConnsInbound": 0,
448 + "ConnsOutbound": 0,
449 + "FD": 0,
450 + "Memory": 33554432
451 + },
452 + "/ipfs/id/push/1.0.0": {
453 + "Streams": 4096,
454 + "StreamsInbound": 1024,
455 + "StreamsOutbound": 4096,
456 + "Conns": 0,
457 + "ConnsInbound": 0,
458 + "ConnsOutbound": 0,
459 + "FD": 0,
460 + "Memory": 33554432
461 + },
462 + "/ipfs/ping/1.0.0": {
463 + "Streams": 4096,
464 + "StreamsInbound": 1024,
465 + "StreamsOutbound": 4096,
466 + "Conns": 0,
467 + "ConnsInbound": 0,
468 + "ConnsOutbound": 0,
469 + "FD": 0,
470 + "Memory": 67108864
471 + },
472 + "/libp2p/autonat/1.0.0": {
473 + "Streams": 4096,
474 + "StreamsInbound": 1024,
475 + "StreamsOutbound": 4096,
476 + "Conns": 0,
477 + "ConnsInbound": 0,
478 + "ConnsOutbound": 0,
479 + "FD": 0,
480 + "Memory": 67108864
481 + },
482 + "/libp2p/circuit/relay/0.1.0": {
483 + "Streams": 1280,
484 + "StreamsInbound": 1280,
485 + "StreamsOutbound": 1280,
486 + "Conns": 0,
487 + "ConnsInbound": 0,
488 + "ConnsOutbound": 0,
489 + "FD": 0,
490 + "Memory": 67108864
491 + },
492 + "/libp2p/circuit/relay/0.2.0/hop": {
493 + "Streams": 1280,
494 + "StreamsInbound": 1280,
495 + "StreamsOutbound": 1280,
496 + "Conns": 0,
497 + "ConnsInbound": 0,
498 + "ConnsOutbound": 0,
499 + "FD": 0,
500 + "Memory": 67108864
501 + },
502 + "/libp2p/circuit/relay/0.2.0/stop": {
503 + "Streams": 1280,
504 + "StreamsInbound": 1280,
505 + "StreamsOutbound": 1280,
506 + "Conns": 0,
507 + "ConnsInbound": 0,
508 + "ConnsOutbound": 0,
509 + "FD": 0,
510 + "Memory": 67108864
511 + },
512 + "/libp2p/dcutr": {
513 + "Streams": 4096,
514 + "StreamsInbound": 1024,
515 + "StreamsOutbound": 4096,
516 + "Conns": 0,
517 + "ConnsInbound": 0,
518 + "ConnsOutbound": 0,
519 + "FD": 0,
520 + "Memory": 67108864
521 + },
522 + "/p2p/id/delta/1.0.0": {
523 + "Streams": 4096,
524 + "StreamsInbound": 1024,
525 + "StreamsOutbound": 4096,
526 + "Conns": 0,
527 + "ConnsInbound": 0,
528 + "ConnsOutbound": 0,
529 + "FD": 0,
530 + "Memory": 33554432
531 + }
532 + },
533 + "ProtocolPeerLimits": {
534 + "/ipfs/id/1.0.0": {
535 + "Streams": 32,
536 + "StreamsInbound": 16,
537 + "StreamsOutbound": 16,
538 + "Conns": 0,
539 + "ConnsInbound": 0,
540 + "ConnsOutbound": 0,
541 + "FD": 0,
542 + "Memory": 8912896
543 + },
544 + "/ipfs/id/push/1.0.0": {
545 + "Streams": 32,
546 + "StreamsInbound": 16,
547 + "StreamsOutbound": 16,
548 + "Conns": 0,
549 + "ConnsInbound": 0,
550 + "ConnsOutbound": 0,
551 + "FD": 0,
552 + "Memory": 8912896
553 + },
554 + "/ipfs/ping/1.0.0": {
555 + "Streams": 4,
556 + "StreamsInbound": 2,
557 + "StreamsOutbound": 3,
558 + "Conns": 0,
559 + "ConnsInbound": 0,
560 + "ConnsOutbound": 0,
561 + "FD": 0,
562 + "Memory": 1114112
563 + },
564 + "/libp2p/autonat/1.0.0": {
565 + "Streams": 2,
566 + "StreamsInbound": 2,
567 + "StreamsOutbound": 2,
568 + "Conns": 0,
569 + "ConnsInbound": 0,
570 + "ConnsOutbound": 0,
571 + "FD": 0,
572 + "Memory": 557056
573 + },
574 + "/libp2p/circuit/relay/0.1.0": {
575 + "Streams": 128,
576 + "StreamsInbound": 128,
577 + "StreamsOutbound": 128,
578 + "Conns": 0,
579 + "ConnsInbound": 0,
580 + "ConnsOutbound": 0,
581 + "FD": 0,
582 + "Memory": 35651584
583 + },
584 + "/libp2p/circuit/relay/0.2.0/hop": {
585 + "Streams": 128,
586 + "StreamsInbound": 128,
587 + "StreamsOutbound": 128,
588 + "Conns": 0,
589 + "ConnsInbound": 0,
590 + "ConnsOutbound": 0,
591 + "FD": 0,
592 + "Memory": 35651584
593 + },
594 + "/libp2p/circuit/relay/0.2.0/stop": {
595 + "Streams": 128,
596 + "StreamsInbound": 128,
597 + "StreamsOutbound": 128,
598 + "Conns": 0,
599 + "ConnsInbound": 0,
600 + "ConnsOutbound": 0,
601 + "FD": 0,
602 + "Memory": 35651584
603 + },
604 + "/libp2p/dcutr": {
605 + "Streams": 2,
606 + "StreamsInbound": 2,
607 + "StreamsOutbound": 2,
608 + "Conns": 0,
609 + "ConnsInbound": 0,
610 + "ConnsOutbound": 0,
611 + "FD": 0,
612 + "Memory": 557056
613 + },
614 + "/p2p/id/delta/1.0.0": {
615 + "Streams": 32,
616 + "StreamsInbound": 16,
617 + "StreamsOutbound": 16,
618 + "Conns": 0,
619 + "ConnsInbound": 0,
620 + "ConnsOutbound": 0,
621 + "FD": 0,
622 + "Memory": 8912896
623 + }
624 + },
625 + "DefaultPeerLimits": {
626 + "Streams": 1024,
627 + "StreamsInbound": 512,
628 + "StreamsOutbound": 1024,
629 + "Conns": 16,
630 + "ConnsInbound": 8,
631 + "ConnsOutbound": 16,
632 + "FD": 8,
633 + "Memory": 67108864
634 + },
635 + "PeerLimits": null,
636 + "ConnLimits": {
637 + "Streams": 0,
638 + "StreamsInbound": 0,
639 + "StreamsOutbound": 0,
640 + "Conns": 1,
641 + "ConnsInbound": 1,
642 + "ConnsOutbound": 1,
643 + "FD": 1,
644 + "Memory": 1048576
645 + },
646 + "StreamLimits": {
647 + "Streams": 1,
648 + "StreamsInbound": 1,
649 + "StreamsOutbound": 1,
650 + "Conns": 0,
651 + "ConnsInbound": 0,
652 + "ConnsOutbound": 0,
653 + "FD": 0,
654 + "Memory": 16777216
655 + }
656 +}`
go.mod
+1
@@ -103,6 +103,7 @@ require (
103 github.com/prometheus/client_golang v1.11.0
104 github.com/stretchr/testify v1.7.0
105 github.com/syndtr/goleveldb v1.0.0
106 + github.com/wI2L/jsondiff v0.2.0
107 github.com/whyrusleeping/go-sysinfo v0.0.0-20190219211824-4a357d4b90b1
108 github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7
109 go.opencensus.io v0.23.0
go.sum
+8
@@ -1423,6 +1423,12 @@ github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpP
1423 github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
1424 github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e h1:T5PdfK/M1xyrHwynxMIVMWLS7f/qHwfslZphxtGnw7s=
1425 github.com/texttheater/golang-levenshtein v0.0.0-20180516184445-d188e65d659e/go.mod h1:XDKHRm5ThF8YJjx001LtgelzsoaEcvnA7lVWz9EeX3g=
1426 +github.com/tidwall/gjson v1.14.0 h1:6aeJ0bzojgWLa82gDQHcx3S0Lr/O51I9bJ5nv6JFx5w=
1427 +github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
1428 +github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
1429 +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
1430 +github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
1431 +github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
1432 github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
1433 github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c h1:u6SKchux2yDvFQnDHS3lPnIRmfVJ5Sxy3ao2SIdysLQ=
1434 github.com/tv42/httpunix v0.0.0-20191220191345-2ba4b9c3382c/go.mod h1:hzIxponao9Kjc7aWznkXaL4U4TWaDSs8zcsY4Ka08nM=
@@ -1433,6 +1439,8 @@ github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX
1439 github.com/urfave/cli/v2 v2.0.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
1440 github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=
1441 github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=
1442 +github.com/wI2L/jsondiff v0.2.0 h1:dE00WemBa1uCjrzQUUTE/17I6m5qAaN0EMFOg2Ynr/k=
1443 +github.com/wI2L/jsondiff v0.2.0/go.mod h1:axTcwtBkY4TsKuV+RgoMhHyHKKFRI6nnjRLi8LLYQnA=
1444 github.com/wangjia184/sortedset v0.0.0-20160527075905-f5d03557ba30/go.mod h1:YkocrP2K2tcw938x9gCOmT5G5eCD6jsTz0SZuyAqwIE=
1445 github.com/warpfork/go-testmark v0.3.0/go.mod h1:jhEf8FVxd+F17juRubpmut64NEG6I2rgkUhlcqqXwE0=
1446 github.com/warpfork/go-testmark v0.9.0 h1:nc+uaCiv5lFQLYjhuC2LTYeJ7JaC+gdDmsz9r0ISy0Y=