File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
packages/ui/src/components Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,22 @@ function parseProvider(provider: Provider): string | undefined {
7575const updateProviders = async () => {
7676 if (metadata .value ?.item_cid ) {
7777 for await (const provider of heliaProvider .helia .value .routing .findProviders (metadata .value ?.item_cid )) {
78+ // Exclude peers by multiaddr pattern
79+ const excludeAddrPatterns = [
80+ / 127\. 0\. 0\. 1/ ,
81+ / localhost/ ,
82+ / ipfs\. io/ ,
83+ / dweb\. link/ ,
84+ / trustless-gateway\. link/ ,
85+ ]
86+
87+ const addrs = provider .multiaddrs ?.map (a => a .toString ()) ?? []
88+ const matchesExcludedAddr = addrs .some (addr =>
89+ excludeAddrPatterns .some (pattern => pattern .test (addr ))
90+ )
91+
92+ if (matchesExcludedAddr ) continue
93+
7894 providers .value = [... providers .value , provider ];
7995 }
8096 }
You can’t perform that action at this time.
0 commit comments