containers / gvisor-tap-vsock

A new network stack based on gVisor
Apache License 2.0
269 stars 50 forks source link

API usage via curl with podman-desktop 1.8.0 with HyperKit not working #345

Closed c-goes closed 7 months ago

c-goes commented 7 months ago

It seems to be not possible to use the curl examples in the README.md with podman-desktop 1.8.0

First I searched for the path of the unix socket of gvproxy

$ ps x | grep gvproxy
62934   ??  S      4:28.04 /opt/homebrew/Cellar/podman/5.0.1/libexec/podman/gvproxy -mtu 1500 -ssh-port 50078 -listen-vfkit unixgram:///var/folders/q9/fdrhq7r90310knpl_04bc30c0000gn/T/podman/podman-machine-default-gvproxy.sock ...............

My path is /var/folders/q9/fdrhq7r90310knpl_04bc30c0000gn/T/podman/podman-machine-default-gvproxy.sock

Access to the API is not working:

curl -v --unix-socket /var/folders/q9/fdrhq7r90310knpl_04bc30c0000gn/T/podman/podman-machine-default-gvproxy.sock http:/unix/services/forwarder/expose http:/unix/stats
*   Trying /var/folders/q9/fdrhq7r90310knpl_04bc30c0000g:0...
* Immediate connect fail for /var/folders/q9/fdrhq7r90310knpl_04bc30c0000g: Protocol wrong type for socket
* Failed to connect to unix port 80 after 0 ms: Couldn't connect to server
* Closing connection
curl: (7) Failed to connect to unix port 80 after 0 ms: Couldn't connect to server
*   Trying /var/folders/q9/fdrhq7r90310knpl_04bc30c0000g:0...
* Immediate connect fail for /var/folders/q9/fdrhq7r90310knpl_04bc30c0000g: Protocol wrong type for socket
* Failed to connect to unix port 80 after 0 ms: Couldn't connect to server
* Closing connection
curl: (7) Failed to connect to unix port 80 after 0 ms: Couldn't connect to server
cfergeau commented 7 months ago

The doc is misleading, the host-side API is only available when gvproxy was started with --listen, which is not the case when podman starts gvproxy. This means the behaviour you are seeing is correct.

This forwarder API is also accessible inside the guest over http://192.168.127.1:80, maybe you can use this instead?

I created https://github.com/containers/gvisor-tap-vsock/pull/346 to improve the documentation.

c-goes commented 7 months ago

Thank you. That's exactly what I wanted to know. Works perfectly inside the guest.