https://github.com/bacv/kingip
Http/https proxy gateway using quic for internal communication with the edge nodes
https://github.com/bacv/kingip
gateway go golang https https-proxy proxy-server quic
Last synced: 10 months ago
JSON representation
Http/https proxy gateway using quic for internal communication with the edge nodes
- Host: GitHub
- URL: https://github.com/bacv/kingip
- Owner: bacv
- License: mit
- Created: 2024-02-09T00:36:31.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-26T11:41:48.000Z (about 1 year ago)
- Last Synced: 2025-01-28T01:34:19.206Z (12 months ago)
- Topics: gateway, go, golang, https, https-proxy, proxy-server, quic
- Language: Go
- Homepage:
- Size: 98.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KingIP
A proxy server that can handle multiple exit points.
## How it works
When a user connects via the proxy to the destination server (ie. `curl -x "http://user:pass@localhost:11700" https://httpbin.org/ip -L -v`), the request traverses these services:
- Gateway decides to which region the request needs to be passed by the port the user connects to (ie. `:11700` is "red" region in the example;
- Gateway then checks if it has any relay connections and creates new `quic` stream with the random relay it chooses;
- Relay gets a proxy request from the gateway and checks if it has any edge connections for a chosen region;
- Relay, if there are any edge connections from that region, creates a new `quic` strem with a chosen edge;
- Once a "tunnel" from gateway to relay to edge is established - an inbound and outbound data is passed around from user to destination;
## How to run
To run, go to `cmd/{gateway,relay,edge}`folders and build 3 binaries.
Start these services with the default configuration:
```bash
./cmd/gateway/gateway --config ./cmd/gateway/config.yml
./cmd/relay/relay --config ./cmd/relay/config.yml
./cmd/edge/edge
```
After running gateway, relay and edge - connect to the gateway via `http://user:pass@localhost:11700`:
```bash
curl -x http://user:pass@localhost:11700 http://httpbin.org/ip -L -v
```
### Docker Compose
After running `docker compose up`, user should be able to proxy requests through tree regions: red, green, blue and yellow.
```bash
# Red
curl -x http://user:pass@localhost:11700 http://httpbin.org/ip -L -v
# Green
curl -x http://user:pass@localhost:11070 http://httpbin.org/ip -L -v
# Blue
curl -x http://user:pass@localhost:11007 http://httpbin.org/ip -L -v
# Yellow
curl -x http://user:pass@localhost:11770 http://httpbin.org/ip -L -v
```
To connect to host network via the docker compose proxy use `host.docker.internal` instead of `localhost` in the curl request:
```bash
# Connects to localhost:8080 on host system
curl -x http://user:pass@localhost:11770 http://host.docker.internal:8080/test -L -v
```
## "Curl" util
`cmd/curl` has ability to run multiple requests at once. After building it in `cmd/curl` directory:
```bash
# Usage of `curl`:
# --parallel int Number of parallel calls (default 11)
# --proxy string Proxy URL (default "http://user:pass@localhost:11700")
# --timeout duration Request timeout in seconds (default 10s)
# --url string Target URL to request (default "http://httpbin.org/ip")
./cmd/curl/curl -proxy http://user:pass@localhost:11700 -url http://httpbin.org/ip
```