functionland / react-native-fula

React (JS/Native) wrapper for go-fula/mobile which creates a bridge between Fula and WNFS for React Native to enable developers create mobile native apps
MIT License
2 stars 5 forks source link

Fix DNS resolver problem And access to interface list #51

Closed farhoud closed 1 year ago

farhoud commented 1 year ago

Hi guy's I have fixed these issues on the react-native project hoodchat If you want i can create PR

ehsan6sha commented 1 year ago

Can you please elaborate on the issue?

farhoud commented 1 year ago

There is 2 major issue with Libp2p on android:

ehsan6sha commented 1 year ago

For this problem I am a bit unclear on what the issue is? We have a working DNS on react-native that resolves fx.land relay server to enable the app connect to any blox backend. Can you elaborate on the problem? Here is the current relay that RN can use without issue: /dns/relay.dev.fx.land/tcp/4001/p2p/12D3KooWDRrBaAfPwsGJivBoUw5fE7ZpDiyfUjqgiURq2DEcL835/p2p-circuit/p2p/[Blox perId]

we are not calling InterfaceAddrs anywhere Maybe a good idea to write the steps needed to break the app, so that we can see what is the exact breaking point

ehsan6sha commented 1 year ago

hi @farhoud how did you resolve this?

ehsan6sha commented 1 year ago

@farhoud This line here causes the issue you mentioned (and another line in flush) https://github.com/functionland/go-fula/blob/32cf82417a72ea382405d953da62f31f4e2f118d/mobile/client.go#L62

ehsan6sha commented 1 year ago

DESCRIPTION: The error is populated on this line of go when we compiled it for Android and imported in JAVA: https://github.com/functionland/go-fula/blob/32cf82417a72ea382405d953da62f31f4e2f118d/mobile/client.go#L62

route ip+net: netlinkrib: permission denied seems that error: route ip+net: netlinkrib: permission denied is a real thing and not gone yet. It affects anything that requires discovery in the network like mdns. probabely in the features you added it is used as well since hte issue is not closed I suspect it is still a thing: https://github.com/golang/go/issues/40569#issuecomment-1050381441

seems they kinda solved it in ipfs shipyad, but could not fully understand how to implement in ours as well: https://github.com/search?q=repo%3Aipfs-shipyard%2Fgomobile-ipfs%20MDNSLockerDriver%20&type=code seems this part on Android is doing the action and htey passed it to go: WifiManager wifi = (WifiManager) this.reactContext.getSystemService(Context.WIFI_SERVICE); WifiManager.MulticastLock multicastLock = wifi.createMulticastLock("multicastLock"); multicastLock.setReferenceCounted(true); multicastLock.acquire();

also I am not sure if anywhere we need this one? https://github.com/golang/go/issues/40569#issuecomment-1191731266

ehsan6sha commented 1 year ago

@hhio618

farhoud commented 1 year ago

First you should patch the underlining packages: https://github.com/w3-voice/go-multiaddr/commit/224cf7db3e8a57f7b884d647808935cee0312065

create a net driver interface the same as go network driver interface

https://github.com/w3-voice/app/blob/main/go/driver_net.go

And implement the interface in java then

https://github.com/w3-voice/app/blob/main/android/core/src/main/java/fx/android/core/NetDriver.java

And then override the java driver with go driver: https://github.com/w3-voice/app/blob/f6a901464797c98e31b66fd75292086240d39227/android/core/src/main/java/fx/android/core/CoreService.java#L131