A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/agraf/slirp-unix below:

agraf/slirp-unix: Slirp UNIX domain socket proxy

Slirp UNIX domain socket proxy

Virtualization.Framework on macOS can tunnel network traffic via a UNIX domain socket. This proxy adds a simple backend for this mechanism using slirp. This allows VMs to communicate to the outside world even if the NAT network target does not work, for example due to corporate firewall policy settings.

The application has a builting usage text:

Slirp UNIX socket proxy
-----------------------

Usage: ./slirp_unix [-p path] [-f host_port:guest_port]

  -p path                  Define the path for the UNIX socket. Defaults to /tmp/slirp.
  -f host_port:guest_port  Add port forward to a guest socket. Can be supplied multiple times.

To connect to it, make sure to create a UNIX domain socket that also binds to a path, like this:

struct sockaddr_un caddr = {
    .sun_family = AF_UNIX,
    .sun_path = "/tmp/client"
};
struct sockaddr_un addr = {
    .sun_family = AF_UNIX,
    .sun_path = "/tmp/slirp"
};

fd = socket(AF_UNIX, SOCK_DGRAM, 0);
bind(fd, (struct sockaddr *)&caddr, sizeof(caddr));
connect(fd, (struct sockaddr *)&addr, sizeof(addr));

After that, you can freely send and receive ethernet frames over the local UNIX DGRAM socket.

To build, first install libslirp using brew

and then build the proxy application

This provides a slirp_unix binary in the build directory which you can run from there.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4