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

Is Relay(circuit) transparent to application? #316

Closed
spgyip opened this issue Apr 17, 2018 · 3 comments
Closed

Is Relay(circuit) transparent to application? #316

spgyip opened this issue Apr 17, 2018 · 3 comments

Comments

@spgyip
Copy link

spgyip commented Apr 17, 2018

I have read the Relay specs, also test codes as relay_test.go.

It seems that using the Relay way is not transparent to my codes?

Which means I have to write codes:

  1. Try using a direct way
  2. If 1) fail, try using relay way

Like:

s, err := host.NewStream(context.Background(), peerID, "/echo/1.0.0")
if err!=nil {
    r := NewRelay(context.Background(), host)
    r.DialPeer(rctx, rinfo, dinfo)
    ....
}

If this is true, I think this is a little complex to application codes, or something I have mis-understand?

@vyzo
Copy link
Contributor

vyzo commented Apr 17, 2018

Relay, once configured in libp2p, is transparent in the sense that it automatically connects to relay addresses.

@whyrusleeping
Copy link
Contributor

@anticpp the relay is transparent. It is embedded inside the host as a transport, so if you try to dial a relay address, you will automatically use the relay.

However, it is not yet automatic. You need to explicitly specify a relay address for the peer you wish to relay a connection to

@Stebalien
Copy link
Member

AutoRelay has been created (although it doesn't always work all that well at the moment). #1039 replaces this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants