libp2p / js-libp2p-webrtc-star

libp2p WebRTC transport that includes a discovery mechanism provided by the signalling-star
https://libp2p.io
Other
320 stars 97 forks source link

changing the default stun server #455

Open amirtgm opened 2 years ago

amirtgm commented 2 years ago

I used the configs when I create my libp2p node and added my custom turn server to it like this:

transport: {
        WebRTCStar: {
          filter: filters.all,
          listenerOptions: {
            config: {
              iceServers: [
                {
                  urls: 'turn:*******',
                  username: '*****',
                  credential: '******',
                  credentialType: 'password',
                },
              ],
            },
          },
        },
      },

but after a long time of debugging, I found out that this customization is only happening for the listener part. on the other hand, when a user tries to dial another one, there will be a new instance of simple peer with the default configuration.

I managed to resolve it by adding the configs to dial options but this shouldn't be the case right?

private dial = async (addr: Multiaddr, protocol: Protocols) => {
    return this.node.dialProtocol(addr, protocol, {
      spOptions: {
        config: {
          iceServers: [
           {
                  urls: 'turn:*******',
                  username: '*****',
                  credential: '******',
                  credentialType: 'password',
                },
          ],
        },
      },
    } as any);
  };
BaptisteHubert commented 1 year ago

Hello, I am commenting this issue as i think i have the same problem (even though the fix proposed by @amirtgm doesn't work in my case).

Even when i'm providing a TURN server in the WebRTC, i am not able to find a peer that isn't on the same network as mine.

I am following the second code block cited on the js-libp2p/doc/CONFIGURATION.MD

Here is my libp2p configuration My code is running online at this address

Version of libp2p: 0.37.3 Version of webrtc-star: 3.0.3

BaptisteHubert commented 1 year ago

Hi @BigLep, since you previously triaged this issue, could you expand on the way it could be pushed forward? Being in the "maintenance priorities", does that mean that you already pinned down the problem at the core of this issue?

BigLep commented 1 year ago

Hi @BaptisteHubert: Unfortunately I don't expect this issue to get any engagement from the core maintainers in light of the work that is happening with building a robust WebRTC implementation across libp2p implementations: https://github.com/libp2p/specs/pull/412

@p-shahi : I thought we had a work item for clarifying the maintenance posture for webrtc-star and webrtc-direct. If not would you please be able to create one and execute on it?

p-shahi commented 1 year ago

Yes please see the incoming archival notice in the readme: https://github.com/libp2p/js-libp2p-webrtc-star/pull/486 I'll archive this repo shortly