Skip to content

Add hostaddr support #945

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

Merged
merged 17 commits into from
Jul 17, 2023
Merged

Add hostaddr support #945

merged 17 commits into from
Jul 17, 2023

Conversation

trungda
Copy link
Contributor

@trungda trungda commented Aug 26, 2022

More details in #943.
Essentially, if we could provide both host and hostaddr, we can avoid an extra DNS lookup to establish a connection to the DB. Specifically, if both host and hostaddr are provided, hostaddr is going to be used to create the socket, i.e., as a raw IP address. host is still needed for TLS validation.

Testing

cargo test returns 4 failing tests which are already failing in master

---- test::scram_user stdout ----
thread 'test::scram_user' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Tls, cause: Some(Error { code: -67843, message: "The certificate was not trusted." }) }', postgres-native-tls/src/test.rs:18:71
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- test::require stdout ----
thread 'test::require' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Tls, cause: Some(Error { code: -67843, message: "The certificate was not trusted." }) }', postgres-native-tls/src/test.rs:18:71

---- test::runtime stdout ----
thread 'test::runtime' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Tls, cause: Some(Error { code: -67843, message: "The certificate was not trusted." }) }', postgres-native-tls/src/test.rs:91:6

---- test::prefer stdout ----
thread 'test::prefer' panicked at 'called `Result::unwrap()` on an `Err` value: Error { kind: Tls, cause: Some(Error { code: -67843, message: "The certificate was not trusted." }) }', postgres-native-tls/src/test.rs:18:71


failures:
    test::prefer
    test::require
    test::runtime
    test::scram_user

test result: FAILED. 0 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s

I would be happy to make them work again in future PRs.

@trungda
Copy link
Contributor Author

trungda commented Aug 29, 2022

@sfackler could you help take a look at the latest commit? Thank you :)

@trungda trungda requested a review from sfackler August 31, 2022 04:15
@trungda
Copy link
Contributor Author

trungda commented Sep 9, 2022

@sfackler could you help take a look? Thank you :)

@trungda
Copy link
Contributor Author

trungda commented Sep 25, 2022

@sfackler could you help take a look? Thanks :)

@trungda
Copy link
Contributor Author

trungda commented Oct 15, 2022

@sfackler would be great if you could take a look :) We have to use a forked version of rust-postgres now and I am worried it might be diverged from upstream :)

@trungda
Copy link
Contributor Author

trungda commented Dec 8, 2022

@sfackler could you help take a look? Thank you :) !

@trungda
Copy link
Contributor Author

trungda commented Dec 27, 2022

@sfackler happy holidays :) Could you help take a look at this PR? I am happy to address any feedback you might have. Thank you!

@trungda
Copy link
Contributor Author

trungda commented Feb 25, 2023

@sfackler could you help take a look at this PR :) Thank you!

@trungda
Copy link
Contributor Author

trungda commented Apr 5, 2023

@sfackler could you help take a look :) We have been running this branch in production for a few months now so I am confident that this works.

@trungda
Copy link
Contributor Author

trungda commented Jun 12, 2023

Hi @sfackler , could you help review this PR when you have time? Thank you :)

@trungda
Copy link
Contributor Author

trungda commented Jul 15, 2023

Hi @sfackler , could you help take a look at this PR when you have time :) Thank you!

@sfackler
Copy link
Owner

Sorry for the very long delay! This looks good to me.

@sfackler sfackler merged commit 4f41157 into sfackler:master Jul 17, 2023
@trungda trungda deleted the tdinh/hostaddr branch August 13, 2023 04:21
@trungda
Copy link
Contributor Author

trungda commented Aug 13, 2023

Sorry for the very long delay! This looks good to me.

Thank you @sfackler ! Happy to contribute more to the project!

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