rapiz1 / rathole

A lightweight and high-performance reverse proxy for NAT traversal, written in Rust. An alternative to frp and ngrok.
Apache License 2.0
8.82k stars 441 forks source link

Allow use of DNS resolution from proxy server #288

Open bvanelli opened 9 months ago

bvanelli commented 9 months ago

Feature Proposed

Currently, you can connect through an HTTP proxy using the following config:

[client.transport]
type = "tcp"
[client.transport.tcp]
proxy = "http://proxy:3128"

But this only works if the domain name can be resolved by the host, not by the proxy. When setting the docker-compose with the extra host, it then works:

  bridge:
    # image: rapiz1/rathole:latest
    build: rathole/
    restart: always
    networks: ["edge"]
    container_name: bridge
    command: /app/config.toml
    extra_hosts: ["tunnel:172.19.0.3"]
    volumes:
      - "./rathole/application.toml:/app/config.toml"
    ports:
      - "8080:8080"

Since it's a PoC I fixed the internal IP.

Use Case

When the proxy is desired, but DNS resolution also has to go throught the proxy.

Possible Solution

I believe the proxy library in use is https://github.com/LinkTed/async-http-proxy, and therefore does not implement this feature of proxying dns requests. The general behaviour would be:

My Rust knowlege is very limited but it seems like the type of feature I could implement, if you say it's feasible using currently libraries and no major refactor is required.

fernvenue commented 9 months ago

Yea, socks5h from curl is a great example.