How to run modified go-libp2p-kad-dht?

Hello,

So I installed go-libp2p-kad-dht from [https://github.com/libp2p/go-libp2p-kad-dht.]
Firslty I dont know how to use it because the Usage section in the Github page is very vague.

Secondly, I modified providers_manager.go code and just added a print statement like println("!!??ok i am here can you see me am i showing??!!")
Then I rebuilt IPFS like this go install ./cmd/ipfs and then I run ipfs daemon.
But the code I modified didnt show up.
I didnt see my print statement.

Can someone please help me out with this.

Thanks alot I highly appreicate it.

I’ve made an example of what I was talking about on discord :
https://jorropo.net/ipfs/QmSyW7VSpic3YfCbrGXmwytSgJJG9aoenu5obJwztuN9mL/exampleGoModReplace.tar.xz

You can go build . in go-ipfs/cmd/ipfs, and run ipfs daemon (you would need to init first).
To see what I’ve changed you can just do git diff in both go-ipfs or go-libp2p-kad-dht.

yesss thank you so so much

now its working and i can see the changes

but if i run ipfs daemon outside go-ipfs/cmd/ipfs folder, then its the older version of IPFS running without the edited code.
but if i run ipfs daemon inside go-ipfs/cmd/ipfs folder, then its new IPFS running with the edited code of go-libp2p-kad-dht.

btw both IPFS either run outside or inside the folder have same peer ID.

btw both IPFS either run outside or inside the folder have same peer ID.

Yes that because the binary has nothing to do with your identity, else updating IPFS would change it (which we don’t want), your identity is on unix likes stored in ~/.ipfs/, no idea on windows.

but if i run ipfs daemon outside go-ipfs/cmd/ipfs folder, then its the older version of IPFS running without the edited code.
but if i run ipfs daemon inside go-ipfs/cmd/ipfs folder, then its new IPFS running with the edited code of go-libp2p-kad-dht .

That because you are on windows and windows is confusing.

On unix ipfs reffers only to your PATH, or what is installed on your system.
To use the ipfs you just built you would use ./ipfs instead (. just means “the current directory”, so ./ipfs means “the ipfs file in the current directory”).
On windows ipfs first attempt to see if there is a binary called “ipfs” in your current directory, if not then fallback to the PATH.

Aha okay now i get it.

Thanks alot i highly highly appreciate your help.

Do you know by any chance if there is a way to print out from the code all the requests for CID > providers mappings you receive at your node.
Like kind of observing the network and who is providing what and who is asking for what.

hello, Have you implemented this code now?