-
Notifications
You must be signed in to change notification settings - Fork 20
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
Conversation
cc69417
to
6c02f30
Compare
6c02f30
to
b6f2dbc
Compare
f874dfc
to
fbfee2b
Compare
src/host.rs
Outdated
@@ -53,6 +53,15 @@ impl Peer { | |||
self.allowed_ips = allowed_ips; | |||
} | |||
|
|||
/// Resolves endpoint address to SocketAddr and sets the field |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// 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() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
No description provided.