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: allow domain name as endpoint address #54

Merged
merged 5 commits into from
Apr 25, 2024

Conversation

j-chmielewski
Copy link
Contributor

No description provided.

@j-chmielewski j-chmielewski force-pushed the 213-gateway-by-domain branch 2 times, most recently from cc69417 to 6c02f30 Compare April 23, 2024 07:30
@j-chmielewski j-chmielewski force-pushed the 213-gateway-by-domain branch from 6c02f30 to b6f2dbc Compare April 23, 2024 08:37
@j-chmielewski j-chmielewski force-pushed the 213-gateway-by-domain branch from f874dfc to fbfee2b Compare April 23, 2024 10:00
src/host.rs Outdated
@@ -53,6 +53,15 @@ impl Peer {
self.allowed_ips = allowed_ips;
}

/// Resolves endpoint address to SocketAddr and sets the field
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Resolves endpoint address to SocketAddr and sets the field
/// Resolves endpoint address to [SocketAddr] and sets the field.

Chyba tak 😉

src/utils.rs Outdated
@@ -340,3 +344,12 @@ pub(crate) fn clean_fwmark_rules(fwmark: u32) -> Result<(), WireguardInterfaceEr
netlink::delete_main_table_rule(IpVersion::IPv6, 0)?;
Ok(())
}

/// Resolves domain name to SocketAddr
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Resolves domain name to SocketAddr
/// Resolves domain name to [SocketAddr].

src/host.rs Outdated
@@ -53,6 +53,15 @@ impl Peer {
self.allowed_ips = allowed_ips;
}

/// Resolves endpoint address to SocketAddr and sets the field
pub fn set_endpoint(&mut self, endpoint: &str) -> Result<(), WireguardInterfaceError> {
self.endpoint = match endpoint.parse() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
self.endpoint = match endpoint.parse() {
self.endpoint = Some(resolve(endpoint)?);

.to_socket_addr() i tak najpierw próbuje zrobić .parse(), więc nie potrzeba dublować
https://doc.rust-lang.org/src/std/net/socket_addr.rs.html#282-289

@j-chmielewski j-chmielewski merged commit 799775e into main Apr 25, 2024
1 check passed
@j-chmielewski j-chmielewski deleted the 213-gateway-by-domain branch April 25, 2024 14:22
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

Successfully merging this pull request may close these issues.

2 participants