Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

feat: compatibility with go-libp2p-mdns #80

Merged
merged 17 commits into from
May 9, 2019

Commits on Apr 15, 2019

  1. feat: compatibility with go-libp2p-mdns

    This PR adds a compatibility class that allows a js-libp2p node to find a go-libp2p node (and vice versa) over MDNS.
    
    It's implemented as a separate class so the two differing implementations do not get confused.
    
    I've verified this is working correctly by running a go-ipfs and js-ipfs node with no boostrap nodes (and no other discovery methods) and verifying they find each other.
    
    TODO:
    
    * [ ] Add tests!
    
    Some tips if you want to try this out:
    
    * After you've run `ipfs init`, remember to remove the bootstrap nodes from the config file (`~/.ipfs/config`) of each node before you start up
    * Use `ipfs log level mdns debug` for some go-ipfs mdns logs
    * You can use the following script (after `npm link`ing this branch) to start a js-ipfs node with no bootstrap nodes and no discovery modules other than MDNS:
    
    ```js
    const IPFS = require('ipfs')
    const MDNS = require('libp2p-mdns')
    const TCP = require('libp2p-tcp')
    
    const ipfs = new IPFS({
      repo: '/tmp/ipfs-mdns',
      config: {
        Bootstrap: []
      },
      libp2p: {
        modules: {
          peerDiscovery: [MDNS],
          transport: [TCP]
        }
      }
    })
    
    ipfs.on('ready', async () => {
      console.log('ipfs is ready')
      console.log('My Peer ID:', (await ipfs.id()).id)
      setInterval(async () => {
        const peers = await ipfs.swarm.peers()
        console.log(peers.length, 'peers:')
        peers.forEach(p => console.log(p.peer.toB58String()))
      }, 10000)
    })
    ```
    
    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    8280e8d View commit details
    Browse the repository at this point in the history
  2. chore: appease linter

    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    0320312 View commit details
    Browse the repository at this point in the history
  3. fix: move async to dependencies

    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    62562b8 View commit details
    Browse the repository at this point in the history
  4. fix: typo in comment

    Co-Authored-By: alanshaw <alan.shaw@protocol.ai>
    vasco-santos and alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    2483aba View commit details
    Browse the repository at this point in the history
  5. refactor: pr feedback

    License: MIT
    Signed-off-by: Alan Shaw <alan@tableflip.io>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    655b4d7 View commit details
    Browse the repository at this point in the history
  6. fix: respond directly to querier

    License: MIT
    Signed-off-by: Alan Shaw <alan@tableflip.io>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    7f6ac76 View commit details
    Browse the repository at this point in the history
  7. fix: reemit the peer event from GoMulticastDNS

    License: MIT
    Signed-off-by: Alan Shaw <alan@tableflip.io>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    324bbf7 View commit details
    Browse the repository at this point in the history
  8. refactor: add interval between queries

    License: MIT
    Signed-off-by: Alan Shaw <alan@tableflip.io>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    05ec9f0 View commit details
    Browse the repository at this point in the history
  9. chore: appease linter

    License: MIT
    Signed-off-by: Alan Shaw <alan@tableflip.io>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    31369eb View commit details
    Browse the repository at this point in the history
  10. fix: existing tests

    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    3ff7250 View commit details
    Browse the repository at this point in the history
  11. fix: option name

    License: MIT
    Signed-off-by: Alan Shaw <alan@tableflip.io>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    0b39814 View commit details
    Browse the repository at this point in the history
  12. fix: use async/nextTick

    License: MIT
    Signed-off-by: Alan Shaw <alan@tableflip.io>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    2b01368 View commit details
    Browse the repository at this point in the history
  13. test: add tests for querier and main compat class

    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    3aca133 View commit details
    Browse the repository at this point in the history
  14. chore: remove .only

    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    15416c3 View commit details
    Browse the repository at this point in the history
  15. test: add responder tests

    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    37fbfdd View commit details
    Browse the repository at this point in the history
  16. fix: increase timeout for query on interval test

    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed Apr 15, 2019
    Configuration menu
    Copy the full SHA
    a3683e7 View commit details
    Browse the repository at this point in the history

Commits on May 9, 2019

  1. docs: document new compat option

    License: MIT
    Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
    alanshaw committed May 9, 2019
    Configuration menu
    Copy the full SHA
    f8f9830 View commit details
    Browse the repository at this point in the history