boris-sinyapkin / lurk

Lightweight implementation of a SOCKS5 proxy built on async Rust
0 stars 0 forks source link
rust socks5-proxy socks5-proxy-server

Lurk

Build & Test

Overview

Lurk is an async and lightweight implementation of a SOCKS5 proxy, allowing users to establish the connection through intermediate data relaying server. It's entirely built in Rust with tokio-async runtime.

Getting Started

Prerequisites

Run Docker container

Lurk proxy could be deployed by using docker image stored in GitHub Package's.

Publish port to default 1080 and start listening incoming connections:

Run latest release in the Docker container:

docker run --rm --name lurk -p 1080:1080/tcp ghcr.io/boris-sinyapkin/lurk:latest

Run latest nightly build in the Docker container:

docker run --rm --name lurk-nightly -p 1080:1080/tcp ghcr.io/boris-sinyapkin/lurk-nightly:latest

Build & deploy from GitHub sources

Project could be compiled directly from sources:

git clone git@github.com:boris-sinyapkin/lurk.git
cd lurk
cargo build --release 

If you want to install binary to the /bin directory, run the following command from cloned repository:

cargo install --path .

By default, Lurk is listening on conventionally defined 1080 port (see RFC 1928):

Fast and fancy SOCKS5 proxy

Usage: lurk [OPTIONS]

Options:
  -p, --proxy-port <PROXY_PORT>
          Proxy server TCP port to listen on [default: 1080]
  -i, --proxy-ipv4 <PROXY_IPV4>
          Proxy server IPv4 address to listen on [default: 0.0.0.0]
      --http-endpoint-enabled
          Spin up HTTP endpoint in a background thread
      --http-endpoint-port <HTTP_ENDPOINT_PORT>
          TCP port to serve HTTP requests [default: 8080]
  -h, --help
          Print help
  -V, --version
          Print version

If default settings is acceptable, execute installed binary:

lurk

Either deploy server through cargo:

cargo run --release

Run benchmark tool against Lurk

Lurk server can be stressed by some HTTP benchmark, e.g. rsb project.

Below bash script will deploy proxy server and stress it by running this benchmark tool. As rsb project uses request create, it's possible to test proxied connections.

# Create bridge docker network
docker network create lurk-network

# Run Lurk in docker container and attach it to created bridge lurk-network
docker run --rm --network lurk-network --name lurk-server -p 1080:1080/tcp ghcr.io/boris-sinyapkin/lurk:latest

Wait until it deploys and run benchmark in a separate shell:

# Run benchmark with 1000 HTTP GET requests perfomed over 100 connections
docker run --rm --network lurk-network --name rsb-benchmark -e http_proxy=socks5://lurk-server:1080 \
  ghcr.io/gamelife1314/rsb:latest --requests 1000 --connections 100 -l --timeout 5 http://example.com

# Clean-up
docker kill lurk-server
docker network rm lurk-network