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

localhost IPv6 resolution #89

Open
Shaokun-X opened this issue Nov 7, 2023 · 2 comments
Open

localhost IPv6 resolution #89

Shaokun-X opened this issue Nov 7, 2023 · 2 comments

Comments

@Shaokun-X
Copy link

Shaokun-X commented Nov 7, 2023

Hi there, thanks for your amazing work!
I recently found that plow doesn't seem to be able to resolve localhost to IPv6 address if IPv4 failed.

What I have observed

I have an endpoint that only allows IPv6 access:

$ curl -v http://localhost:8080/api/endpoint

*   Trying 127.0.0.1:8080...
* connect to 127.0.0.1 port 8080 failed: Connection refused
*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080 (#0)
> GET /api/endpoint
> Host: localhost:8080
> User-Agent: curl/8.1.2
> Accept: */*
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< content-type: application/json
< content-length: 10
< connection: close
< date: Tue, 07 Nov 2023 12:00:00 GMT
< cache-control: no-store
< vary: Cookie
<
{"data": 1}

If I use plow, it drops the requests when it doesn't manage to connect to the IPv4 address 127.0.0.1:

$ plow -n 10 http://localhost:8080/api/endpoint
Benchmarking http://localhost:8080/api/endpoint with 10 request(s) using 1 connection(s).
@ Real-time charts is listening on http://[::]:18888

Summary:
  Elapsed         0s
  Count           10
  RPS       1542.933
  Reads    0.000MB/s
  Writes   0.000MB/s

Error:
  10  "dial tcp4 127.0.0.1:8080: connect: connection refused"

What I expect

plow can try to connect to IPv6 address when the IPv4 is refused while using localhost, like curl does

My setup

plow: 1.3.1
OS: macOS 13.6.1 22G313 x86_64
Shell: zsh 5.9
CPU: Intel i5-1038NG7 (8) @ 2.00GHz
@Shaokun-X
Copy link
Author

Shaokun-X commented Nov 7, 2023

Also it is not possible to pass the IPv6 address directly:

$  plow -n 10  "http://[::1]:8080/api/endpoint"

Error:
  10  "couldn't find DNS entries for the given domain. Try using DialDualStack"

@six-ddc
Copy link
Owner

six-ddc commented Feb 29, 2024

Thank you for your feedback. Integrating IPv6 with the proxy functionality in fasthttp might be somewhat challenging and could require substantial modifications. I will think about how to implement this in a more refined manner.

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

No branches or pull requests

2 participants