Circuit relay node with public IP -- nginx necessary?

Should I need to use nginx to get a go-ipfs p2p-circuit relay node running with a public IP address? I’ve been following the circuit relay example and the localhost websocket ports ( /ip4/127.0.0.1/tcp/4004/ws/p2p/QmHash ) are showing up fine, but only the regular /tcp/4001/p2p/QmHash address is showing up for my public IP, not the /tcp/4001/ws/p2p/QmHashone I really want.

The relevant bits of my ~/.ipfs/config:

  "Addresses": {
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001",
      "/ip4/0.0.0.0/tcp/4004/ws",
      "/ip6/::/tcp/4001"
    ],
    "Announce": [],
  },
  "Swarm": {
    "AddrFilters": [
      /// tons of random stuff here from the default server setup
    ],
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": true,
    "DisableRelay": false,
    "EnableRelayHop": true,
    "EnableAutoRelay": false,
  },

and here’s what ipfs id says the addresses are:

        "Addresses": [
                "/ip4/127.0.0.1/tcp/4001/p2p/QmHash",
                "/ip4/127.0.0.1/tcp/4004/ws/p2p/QmHash",
                "/ip6/::1/tcp/4001/p2p/QmHash",
                "/ip4/35.XX.XX.XX/tcp/4001/p2p/QmHash"
        ],

Explicitly adding the 35.XX.XX.XX IP addr in the first Addresses: Swarm: bit doesn’t make a difference (with the same or different ports).

Explicitly adding the 35.XX.XX.XX IP addr in the first Addresses: Swarm: bit doesn’t make a difference

You need to add the public address to Addresses.Announce since you can’t actually listen on the public address. Addresses.Swarm are your listening addresses. I believe the reason you’re seeing the public address for TCP and not WS is that AutoNAT is likely kicking in and giving you your public TCP address. I’m not positive if websockets is supported for AutoNAT but it could be possible the other AutoNAT nodes you’ve connected to don’t have websockets enabled, which would prevent you from learning your public address.

Something to keep in mind, if you intend for js/browser nodes to connect to this node, you will need to have an SSL certificate, so you’ll likely need to use nginx anyway for that if so. If this is the case you’ll end up needing to setup a dns address and add that to Addresses.Announce instead of the IP.

1 Like

Ah, I see, thanks. That worked to get it to have the ws address I want, but you’re right that I’m trying to use it for browser nodes. So I guess I’ll do the rest of that setup now.

Thanks so much for the quick response and for proactively answering my next question! That definitely saved me another few hours of confusion.