Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Running js-ipfs behind a proxy #1865

Closed
Closed
@JGAntunes

Description

@JGAntunes

Hey there! 👋

tl;dr; Is there a way for a node to "advertise" one swarm address without binding to it?

I've been looking into running some tests with multiple IPFS nodes running behind a TCP proxy. I'm using a bootstrap discovery method with 3 initial nodes deployed followed by another set of them. The config I'm using is something like this:

{
    "Addresses": {
        "Swarm": [
            "/ip4/127.0.0.1/tcp/4002"
        ],
        "API": "/ip4/172.17.0.5/tcp/5002",
(...)

And the TCP proxy running at port 8002 forwarding traffic to the ipfs swarm address.

I came to find however that given the peer doesn't know its own address, other peers end up with peer lists like this (notice the two peers with a 127.0.0.1 address):

kubectl exec -it node-3-ipfs-testbed-bddb7b794-rftkz --container=js-ipfs -- jsipfs swarm peers
/ip4/127.0.0.1/tcp/4002/ipfs/QmSFkkfUZU3zZX3uEXm8FxJMpMGnU1qejRQUiy6UzyDJWk
/ip4/127.0.0.1/tcp/4002/ipfs/QmfQUpk41XPjQ7AehCSbRi7CCRB8LERB1pNxQFHMk9JiUY
/dns4/node-2-ipfs-testbed/tcp/8002/ipfs/QmcTaFLT2vziRVSN8nnd3HRhZxXbo8MG1ghRc65qHCkZ8v
/dns4/node-1-ipfs-testbed/tcp/8002/ipfs/QmaZfXvwHvNk3nrJyrgPWDi1LK6bPDPr5JSXXWV88Hykts

If I try to use the proxy address in the swarm config it will fail because the node tries to bind to it. So I guess what I need is some way for the peer to list an address without binding to it, is this possible? I was looking around in libp2p for something that would allow this behaviour but to no luck 😞 do any of you know a way around this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/supportA question or request for support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions