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

feat: add DerpMap::default_from_url #1199

Merged
merged 4 commits into from
Jul 11, 2023
Merged

Conversation

Frando
Copy link
Member

@Frando Frando commented Jul 10, 2023

Description

Now that #1143 is merged, the default Derp map can be configured from a single URL for the common case of using DNS and the default STUN port. This PR adds a DerpMap::default_from_url method that just takes a Derp server URL as argument. When writing examples that accept a Derp server from e.g. a CLI argument this makes the Derp map construction simpler.

Change checklist

  • Self-review.
  • Documentation updates

Copy link
Contributor

@rklaehn rklaehn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable.

One unrelated thing: I tried out the example and had the server stop once because of a timeout. I think accept_conn producing an error should not terminate the accept loop.

let (peer_id, alpn, conn) = accept_conn(conn).await?;

should be

let Ok((peer_id, alpn, conn)) = accept_conn(conn).await else {
  error!("accept_conn errored");
  continue;
}; 

@Frando Frando force-pushed the Frando/derpmap-from-url branch 2 times, most recently from 89bef33 to a6a68ae Compare July 10, 2023 11:05
@Frando Frando enabled auto-merge (squash) July 10, 2023 11:06
@Frando Frando force-pushed the Frando/derpmap-from-url branch from a6a68ae to 6b5177f Compare July 10, 2023 13:14
@Frando Frando force-pushed the Frando/derpmap-from-url branch from 6b5177f to 9345b54 Compare July 11, 2023 08:29
@dignifiedquire dignifiedquire disabled auto-merge July 11, 2023 11:25
@dignifiedquire dignifiedquire merged commit 01641a7 into main Jul 11, 2023
@dignifiedquire dignifiedquire deleted the Frando/derpmap-from-url branch July 11, 2023 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants