We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65d948d commit c6a1b06Copy full SHA for c6a1b06
1 file changed
bitswap/network/router.go
@@ -19,6 +19,18 @@ type router struct {
19
20
// New returns a BitSwapNetwork supported by underlying IPFS host.
21
func New(pstore peerstore.Peerstore, bitswap BitSwapNetwork, http BitSwapNetwork) BitSwapNetwork {
22
+ if bitswap == nil && http == nil {
23
+ panic("bad exchange network router initialization: need bitswap or http")
24
+ }
25
+
26
+ if http == nil {
27
+ return bitswap
28
29
30
+ if bitswap == nil {
31
+ return http
32
33
34
return &router{
35
Bitswap: bitswap,
36
HTTP: http,
0 commit comments