代码之家  ›  专栏  ›  技术社区  ›  Some Guy Trying To Do Math

如何为IPFS客户端添加外部IP地址

  •  0
  • Some Guy Trying To Do Math  · 技术社区  · 4 年前

    我在谷歌计算引擎中创建了一个IPFS实例。

    当我用

    ipfs daemon
    

    盒子的本地IP地址(列出了私有地址)为10.128.0.4,但当我想从谷歌外部连接到外部IP(134.123.143.185)时,我无法连接。

    如何将外部IP添加到可接受的IP地址列表中以进行连接。

    try {
        const client = createClient(new URL('http://134.123.143.185:5001'))
    
        // call Core API methods
        const { cid } = await client.add('Hello world!')
        console.log(cid);
    } catch (error) {
        console.log(error);
    }
    
    1 回复  |  直到 4 年前
        1
  •  2
  •   Some Guy Trying To Do Math    4 年前

    IPFS服务器可能仅设置为监听127.0.0.1/5001

    如果你跑

    sudo ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
    

    这可能是非常不安全的,不是正确的做法——希望有人能纠正这个答案。