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

Fix non-root hosts failing on resolving DNS #2269

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

same-id
Copy link
Contributor

@same-id same-id commented Oct 27, 2024

A fix for a bug introduced by #2168

Previously, config.Host worked in the following way:

  1. Documented as supporting ip addresses only
  2. In fact supported "host/path" syntax
  3. Did not support "scheme" prefixes, i.e. https://

Not sure this is the desired approach, probably the best thing would have been to extend config to contain "Scheme" and "Path" fields as well.

However, this was the way it worked.

  1. Now Host can contain scheme prefixes "unix://..."
  2. Host can no longer contain ".../path"

This PR solves this behavior while maintaining support of the "unix://" flow as well.

For some reason, "scheme" is named "network" in #2168 - I did not change that.

Also, remove disambiguation in "network:address:port", where it parsed "myhost:8888" as network:address instead address:port.

Also see: #2253

@same-id same-id force-pushed the fix-non-root-hosts branch 3 times, most recently from 0b754dc to 6cca6f1 Compare October 28, 2024 10:47
@guggero
Copy link
Collaborator

guggero commented Oct 28, 2024

Thanks for looking into this.
Though this project uses an older Golang version that doesn't support the strings.CutPrefix function yet.

 rpcclient/infrastructure.go:1743: undefined: strings.CutPrefix
rpcclient/infrastructure.go:1746: undefined: strings.CutPrefix

@same-id same-id force-pushed the fix-non-root-hosts branch from 6cca6f1 to a267609 Compare October 28, 2024 12:43
@same-id
Copy link
Contributor Author

same-id commented Oct 28, 2024

Fixed

@same-id same-id force-pushed the fix-non-root-hosts branch from a267609 to ed7d971 Compare October 28, 2024 12:45
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

See inline comments, I'm not sure this actually fixes your issue?

rpcclient/infrastructure.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Show resolved Hide resolved
@Roasbeef Roasbeef requested a review from Crypt-iQ October 28, 2024 17:51
@same-id same-id force-pushed the fix-non-root-hosts branch from ed7d971 to c7dae61 Compare October 29, 2024 19:05
@guggero guggero self-requested a review October 30, 2024 09:33
@same-id
Copy link
Contributor Author

same-id commented Nov 6, 2024

gentle bump - reminding that ATM btcd@master is broken with providers like quicknode

@coveralls
Copy link

coveralls commented Nov 6, 2024

Pull Request Test Coverage Report for Build 12174808993

Details

  • 22 of 50 (44.0%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.03%) to 57.282%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rpcclient/infrastructure.go 22 50 44.0%
Files with Coverage Reduction New Missed Lines %
rpcclient/infrastructure.go 2 39.96%
Totals Coverage Status
Change from base Build 12142686341: 0.03%
Covered Lines: 29911
Relevant Lines: 52217

💛 - Coveralls

Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

I think we should clean this up a bit more and add some basic tests.

Here's my proposal as a diff (feel free to just use in your commit, no attribution required):
proposal.diff.txt

rpcclient/infrastructure.go Show resolved Hide resolved
@same-id same-id force-pushed the fix-non-root-hosts branch from c7dae61 to 47faac8 Compare November 8, 2024 11:11
@same-id same-id requested a review from guggero November 8, 2024 11:12
Copy link
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM 🎉

@same-id
Copy link
Contributor Author

same-id commented Nov 9, 2024

Thanks, LGTM 🎉

Thanks for the review, still pending approval from another reviewer: @Crypt-iQ

@same-id
Copy link
Contributor Author

same-id commented Nov 11, 2024

@guggero - just making sure we are really waiting for an additional reviewer here

@same-id
Copy link
Contributor Author

same-id commented Dec 1, 2024

Hi, @guggero

Gentle ping

This is still stuck on review

@guggero
Copy link
Collaborator

guggero commented Dec 2, 2024

cc @yyforyongyu

Copy link
Collaborator

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

Thanks for the cleanup!

rpcclient/infrastructure.go Outdated Show resolved Hide resolved
rpcclient/infrastructure.go Outdated Show resolved Hide resolved
A fix for a bug introduced by btcsuite#2168

Previously, config.Host worked in the following way:
1. Documented as supporting ip addresses only
2. In fact supported "host/path" syntax
3. Did not support "scheme" prefixes, i.e. https://

Not sure this is the desired approach, probably the best thing would
have been to extend config to contain "Scheme" and "Path" fields as well.

However, this was the way it worked.

1. Now Host can contain scheme prefixes "unix://..."
2. Host can no longer contain ".../path"

This PR solves this behavior while maintaining support of the "unix://" flow
as well.

For some reason, "scheme" is named "network" in btcsuite#2168 - I did not change that.

Also remove disambiguation in "network:address:port", where it parsed
"myhost:8888" as network:address instead address:port.
@same-id same-id force-pushed the fix-non-root-hosts branch from 47faac8 to 42d6eba Compare December 5, 2024 07:01
@same-id
Copy link
Contributor Author

same-id commented Dec 5, 2024

Still blocked on merge

@guggero guggero requested a review from yyforyongyu December 5, 2024 10:30
Copy link
Collaborator

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

LGTM👍

@Roasbeef Roasbeef merged commit ec0b90d into btcsuite:master Dec 5, 2024
3 checks passed
@same-id
Copy link
Contributor Author

same-id commented Dec 5, 2024

Thanks!

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.

5 participants