How to make go-ipfs use ws-star for punsub

539 Views Asked by At

When i use wss in go-ipfs, it throw not support wss

so i can’t use /dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star

i wanna make js-ipfs and go-ipfs can join same pubsub topic

does any other address can make it or how can make go-ipfs support it

1

There are 1 best solutions below

1
On

i wanna make js-ipfs and go-ipfs can join same pubsub topic

To make it possible you only need to ensure JS is connected to GO.

There is no ws-star for go-ipfs because it has DHT. JS version has no DHT yet, but can work around that by letting it know about your GO node by adding it to bootstraps:

  1. Enable WebSockets transport (/ws) in go-ipfs config:
    • Add /ip4/A.B.C.D/tcp/4422/ws to Addresses.Swarm array and restart the node – it will enable unencrypted WebSockets
  2. Put it behind nginx or some other reverse proxy that provides TLS (enabling encrypted Websockets, /wss)
    • You need TLS because JS loaded from HTTPS requires WebSockets connections
  3. Set up /wss address of go-ipfs in js-ipfs as one of bootstrap servers.
    • This will ensure go and js have direct connection and no DHT is needed.