Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Router only uses Addresses.Swarm #9823

Closed
3 tasks done
jtsmedley opened this issue Apr 17, 2023 · 11 comments · Fixed by #9920
Closed
3 tasks done

HTTP Router only uses Addresses.Swarm #9823

jtsmedley opened this issue Apr 17, 2023 · 11 comments · Fixed by #9920
Labels
effort/hours Estimated to take one or several hours exp/intermediate Prior experience is likely helpful help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P3 Low: Not priority right now

Comments

@jtsmedley
Copy link

Checklist

Installation method

ipfs-update or dist.ipfs.tech

Version

Kubo version: 0.19.1-958e586
Repo version: 13
System version: amd64/linux
Golang version: go1.19.1

Config

{
  "API": {
    "HTTPHeaders": {}
  },
  "Addresses": {
    "API": "/ip4/0.0.0.0/tcp/5001",
    "Announce": [
      "/ip4/[PUBLIC_IP]/tcp/4001"
    ],
    "AppendAnnounce": [],
    "Gateway": "/ip4/0.0.0.0/tcp/8080",
    "NoAnnounce": [
      "/ip4/10.0.0.0/ipcidr/8",
      "/ip4/100.64.0.0/ipcidr/10",
      "/ip4/169.254.0.0/ipcidr/16",
      "/ip4/172.16.0.0/ipcidr/12",
      "/ip4/192.0.0.0/ipcidr/24",
      "/ip4/192.0.2.0/ipcidr/24",
      "/ip4/192.168.0.0/ipcidr/16",
      "/ip4/198.18.0.0/ipcidr/15",
      "/ip4/198.51.100.0/ipcidr/24",
      "/ip4/203.0.113.0/ipcidr/24",
      "/ip4/240.0.0.0/ipcidr/4",
      "/ip6/100::/ipcidr/64",
      "/ip6/2001:2::/ipcidr/48",
      "/ip6/2001:db8::/ipcidr/32",
      "/ip6/fc00::/ipcidr/7",
      "/ip6/fe80::/ipcidr/10"
    ],
    "Swarm": [
      "/ip4/0.0.0.0/tcp/4001"
    ]
  },
  "AutoNAT": {
    "ServiceMode": "disabled"
  },
  "Bootstrap": [
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
    "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt"
  ],
  "DNS": {
    "Resolvers": {}
  },
  "Datastore": {
    "BloomFilterSize": 268435456,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
        {
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/3",
            "sync": false,
            "type": "flatfs"
          },
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
        },
        {
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          },
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
        }
      ],
      "type": "mount"
    },
    "StorageGCWatermark": 90,
    "StorageMax": "50GB"
  },
  "Discovery": {
    "MDNS": {
      "Enabled": false
    }
  },
  "Experimental": {
    "AcceleratedDHTClient": true,
    "FilestoreEnabled": false,
    "GraphsyncEnabled": false,
    "Libp2pStreamMounting": false,
    "P2pHttpProxy": false,
    "StrategicProviding": false,
    "UrlstoreEnabled": false
  },
  "Gateway": {
    "APICommands": [],
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
        "X-Requested-With",
        "Range",
        "User-Agent"
      ],
      "Access-Control-Allow-Methods": [
        "GET"
      ],
      "Access-Control-Allow-Origin": [
        "*"
      ]
    },
    "NoDNSLink": false,
    "NoFetch": true,
    "PathPrefixes": [],
    "PublicGateways": null,
    "RootRedirect": "",
    "Writable": false
  },
  "Identity": {
    "PeerID": "[PEER_ID]"
  },
  "Internal": {
    "Bitswap": {
      "EngineBlockstoreWorkerCount": 1250,
      "EngineTaskWorkerCount": 250,
      "MaxOutstandingBytesPerPeer": 1048576,
      "TaskWorkerCount": 250
    }
  },
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  },
  "Migration": {
    "DownloadSources": [],
    "Keep": ""
  },
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  },
  "Peering": {
    "Peers": null
  },
  "Pinning": {
    "RemoteServices": {}
  },
  "Plugins": {
    "Plugins": null
  },
  "Provider": {
    "Strategy": ""
  },
  "Pubsub": {
    "DisableSigning": false,
    "Router": ""
  },
  "Reprovider": {
    "Interval": "12h",
    "Strategy": "pinned"
  },
  "Routing": {
    "Methods": {
      "find-peers": {
        "RouterName": "WanDHT"
      },
      "find-providers": {
        "RouterName": "ParallelHelper"
      },
      "get-ipns": {
        "RouterName": "WanDHT"
      },
      "provide": {
        "RouterName": "ParallelHelper"
      },
      "put-ipns": {
        "RouterName": "WanDHT"
      }
    },
    "Routers": {
      "HttpIndexer": {
        "Parameters": {
          "Endpoint": "[MOCKING_ENDPOINT]"
        },
        "Type": "http"
      },
      "ParallelHelper": {
        "Parameters": {
          "Routers": [
            {
              "IgnoreErrors": true,
              "RouterName": "HttpIndexer",
              "Timeout": "3m"
            },
            {
              "ExecuteAfter": "2s",
              "IgnoreErrors": false,
              "RouterName": "WanDHT",
              "Timeout": "30m"
            }
          ]
        },
        "Type": "parallel"
      },
      "WanDHT": {
        "Parameters": {
          "AcceleratedDHTClient": true,
          "Mode": "dhtserver",
          "PublicIPNetwork": true
        },
        "Type": "dht"
      }
    },
    "Type": "custom"
  },
  "Swarm": {
    "AddrFilters": [
      "/ip4/100.64.0.0/ipcidr/10",
      "/ip4/169.254.0.0/ipcidr/16",
      "/ip4/172.16.0.0/ipcidr/12",
      "/ip4/192.0.0.0/ipcidr/24",
      "/ip4/192.0.2.0/ipcidr/24",
      "/ip4/192.168.0.0/ipcidr/16",
      "/ip4/198.18.0.0/ipcidr/15",
      "/ip4/198.51.100.0/ipcidr/24",
      "/ip4/203.0.113.0/ipcidr/24",
      "/ip4/240.0.0.0/ipcidr/4",
      "/ip6/100::/ipcidr/64",
      "/ip6/2001:2::/ipcidr/48",
      "/ip6/2001:db8::/ipcidr/32",
      "/ip6/fc00::/ipcidr/7",
      "/ip6/fe80::/ipcidr/10"
    ],
    "ConnMgr": {
      "HighWater": 1200
    },
    "DisableBandwidthMetrics": true,
    "DisableNatPortMap": true,
    "RelayClient": {
      "Enabled": true
    },
    "RelayService": {
      "Enabled": false
    },
    "ResourceMgr": {},
    "Transports": {
      "Multiplexers": {},
      "Network": {},
      "Security": {}
    }
  }
}

Description

When using an HTTP router Kubo uses the config information from .Addresses.Swarm rather than addresses parsed from .Addresses.Announce which is what is consistently used for DHT announcements.

Possible Affected Code: https://github.com/ipfs/kubo/blob/master/routing/delegated.go#L202

--- HTTP Routing Payload [Actual]
{ "Providers": [ { "Protocol": "transport-bitswap", "Schema": "bitswap", "Signature": "mglKVuUbSEZ45gQRS1is1CHhHQY7B1c+Zu39jXUM1zG4JNJyDczHgKpdNMZ7meFccy8MrIlXfReudSz3vD6+BCg", "Payload": { "Keys": [ "[CONTENT_ID]" ], "Timestamp": 1681748062739, "AdvisoryTTL": 86400000000000, "ID": "[KUBO_ID]", "Addrs": [ "/ip4/0.0.0.0/tcp/4001" ] } } ] }

--- HTTP Routing Payload [Expected]
{ "Providers": [ { "Protocol": "transport-bitswap", "Schema": "bitswap", "Signature": "mglKVuUbSEZ45gQRS1is1CHhHQY7B1c+Zu39jXUM1zG4JNJyDczHgKpdNMZ7meFccy8MrIlXfReudSz3vD6+BCg", "Payload": { "Keys": [ "[CONTENT_ID]" ], "Timestamp": 1681748062739, "AdvisoryTTL": 86400000000000, "ID": "[KUBO_ID]", "Addrs": [ "/ip4/[PUBLIC_IP]/tcp/4001" ] } } ] }

@jtsmedley jtsmedley added kind/bug A bug in existing code (including security flaws) need/triage Needs initial labeling and prioritization labels Apr 17, 2023
@aschmahmann
Copy link
Contributor

@jtsmedley where Routing v1 HTTP endpoint are you using? Are you trying to put provider records over HTTP or only receive them?

@aschmahmann aschmahmann added need/author-input Needs input from the original author and removed need/triage Needs initial labeling and prioritization labels May 22, 2023
@jtsmedley
Copy link
Author

@aschmahmann This issue occurs is related to publishing provider records over HTTP from Kubo. The Routing v1 HTTP request that is emitted by Kubo contains a list of addresses that is different than the list of addresses being published by the DHT publisher.

@github-actions
Copy link

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

@Jorropo Jorropo removed need/author-input Needs input from the original author kind/stale labels May 31, 2023
@lidel
Copy link
Member

lidel commented May 31, 2023

@jtsmedley afaik PUTs to /routing/v1 are not officially supported and experimental impl. may break at any time.

The fix for this needs to wait until IPIP-378 is finalized and implemented in boxo/routing/http, unless you have time to debug and submit a PR with surgical fix.

@jtsmedley
Copy link
Author

@lidel To be clear this issue is with Kubo Delegated Routing posting to Index-Provider. This is not an issue with posting into Kubo. I consider Kubo's IPNI put implementation to currently be broken and cannot use it.

@lidel
Copy link
Member

lidel commented Jun 1, 2023

Correct, you can't use it: PUT to /routing/v1 was never officially supported anywhere, and it is still the case.
There is no stable API/spec, no tests, no support.

We've just started working towards making /routing/v1 useful beyond basic GET from cid.contact, and we will focus on exposing GET in Kubo first. PUT is planned, but after we have basic GET working reliably, as it serves more use cases.

@jtsmedley It sounds like you are using experimental PUT code against your own endpoint, and it happens to work aside from the Announce bug reported here. I guess that is good news, but also a source of confusion on our end.

Why were you under impression PUTs are supported?
Is it because of example in /docs/config.md#routing-methods or some other docs?

@jtsmedley
Copy link
Author

jtsmedley commented Jun 1, 2023

@lidel I do see here that v0.18.0 support is just for GET. I believe this got confusing with the deprecation of Reframe which dropped the original buggy but deemed production worthy path of onboarding advertisements from Kubo onto IPNI. That left only experimental PUT code from Kubo to work with the index-provider which would otherwise basically be a dead project which has resulted in this documentation being developed out of positive intent.

I think the answer here is that officially Kubo doesn't support PUT for Delegated Routing, but has experimental support currently that has known bugs. I am happy with that answer and can only give a thumbs up in support of Kubo being able to PUT to IPNI in some way.

@lidel
Copy link
Member

lidel commented Jun 1, 2023

Thank you, @jtsmedley, this clears a lot of confusion. 🙏

Since it was the IPNI project who did not test this end-to-end, but prompted you to use it before it's ready (IPIP-378 is wip), you could fill an issue in ipni/index-provider and ask them to either provide support and contribute bugfixes, or remove it from docs until it is safe to recommend.

Kubo maintainers will not spend time on this until officially supported, the spec is finalized and tests are in place.

@lidel
Copy link
Member

lidel commented Jun 2, 2023

cc @masih for visibility. Not sure if the note added in this PR is enough for your users.
Addressing the problem in Kubo would be the proper fix.

@masih
Copy link
Member

masih commented Jun 5, 2023

Not sure if the note added in this PR is enough for your users.

Cc @ischasny

@lidel lidel added P3 Low: Not priority right now help wanted Seeking public contribution on this issue labels Jun 5, 2023
@lidel
Copy link
Member

lidel commented Jun 5, 2023

Triage notes:

  • Kubo maintainers will get to this after PUTs in /routing/v1 is finalized, can't spend time on experimental thing at this time
  • If anyone needs the fix for this sooner, PR welcome 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/hours Estimated to take one or several hours exp/intermediate Prior experience is likely helpful help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P3 Low: Not priority right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants