Skip to content

localhost IPv6 resolution #89

Open
@Shaokun-X

Description

@Shaokun-X

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions