Skip to content

Latest commit

 

History

History
74 lines (62 loc) · 3.21 KB

README-en.md

File metadata and controls

74 lines (62 loc) · 3.21 KB

QUIC Proxy

Recommend my new project https://github.com/evansun922/nginx-quic

quic_proxy is a high-performance quic proxy service. it receive a request with quic from frontend and proxy to backend, e.g. nginx, etc.

The chromium provide a demo service of quic, but this demo is a single process, and it download the full file from source station before it can be sent to the frontend, this is not acceptable for big file.

We have rewritten epoll_quic_server based on the chromium, the new quic server support for high concurrency. its features:

  • Use SO_REUSEADDR to improve the ability of services to use multiple cores.
  • Use recvmmsg,sendmmsg to reduce user mode and kernel mode switching and improve service performance.
  • Use quic of chromium, we can always use the latest version of quic.
  • This project is a c++ project, support for linux systems only.
  • This project use libcurl to backend.

Building

  1. Download chromium, see how to download chromium.

  2. Download and build libcurl, you must build libcurl with boringssl, or use --without-ssl, refer to: ./configure --enable-debug --disable-optimize --with-ssl=/path/boringssl --enable-shared=no --disable-pthreads .

  3. Copy dir "proxy_quic" to "net/third_party/quiche/src/quic/" .

  4. Modify the "net/BUILD.gn" in chromium that find the configuration of epoll_quic_server and append the following:

    sources = [
      "third_party/quiche/src/quic/proxy_quic/quic_proxy_server_bin.cc",
      "third_party/quiche/src/quic/proxy_quic/quic_proxy_server.cc",
      "third_party/quiche/src/quic/proxy_quic/quic_proxy_backend.cc",
      "third_party/quiche/src/quic/proxy_quic/quic_proxy_curl.cc",
      "third_party/quiche/src/quic/proxy_quic/quic_curl_timer.cc",
      "third_party/quiche/src/quic/proxy_quic/quic_proxy_packet_writer.cc",
      "third_party/quiche/src/quic/proxy_quic/quic_proxy_packet_reader.cc",
      "third_party/quiche/src/quic/proxy_quic/sendmmsgtimer.cc",
      "third_party/quiche/src/quic/proxy_quic/quic_proxy_dispatcher.cc",
      "third_party/quiche/src/quic/proxy_quic/quic_proxy_session.cc",
      "third_party/quiche/src/quic/proxy_quic/quic_proxy_stream.cc",
    ]
    include_dirs = [
      "/usr/local/include"
    ]
    deps = [
      ":epoll_quic_tools",
      ":epoll_server",
      ":net",
      ":simple_quic_tools",
      "//base",
      "//third_party/boringssl",
    ]
    lib_dirs = [
      "/usr/local/lib"
    ]
    libs = [
      #"curl",
      "/usr/local/lib/libcurl.a",
      "/usr/lib/x86_64-linux-gnu/libz.a",
    ]
    }
    
  5. cd src; gn gen out/Debug

  6. ninja -C out/Debug quic_proxy_server (step 5, 6 see Build the QUIC client and server)

Running

out/Debug/quic_proxy_server --quic_proxy_backend_url=http://backend-host --certificate_file=/path/you.crt --key_file=/path/you.pkcs8

for daemon:

./logrun.pl /path/log-dir out/Debug/quic_proxy_server --port=443 --daemon=true --quic_proxy_backend_url=http://backend-host --certificate_file=/path/you.crt --key_file=/path/you.pkcs8

Contact

my email: [email protected]