Skip to content

Commit

Permalink
welcome v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
doroved committed Oct 24, 2024
1 parent 84cea90 commit be82a11
Show file tree
Hide file tree
Showing 12 changed files with 1,077 additions and 217 deletions.
306 changes: 299 additions & 7 deletions Cargo.lock

Large diffs are not rendered by default.

21 changes: 19 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "proxer"
version = "0.1.2"
version = "0.2.0"
edition = "2021"
authors = ["doroved"]
description = "Proxy manager all network requests on macOS + spoofDPI all direct connections."
description = "Proxy all macOS network requests with domain-based filtering. Basic spoof DPI for direct connections."
readme = "README.md"
repository = "https://github.com/doroved/proxer"
license = "MIT OR Apache-2.0"
Expand All @@ -27,6 +27,23 @@ futures = "0.3.30"
wildmatch = "2.3.4"
json5 = "0.4.1"
chrono = "0.4.38"
clap = { version = "4.5.20", features = ["derive"] }
sha2 = "0.10.8"
lazy_static = "1.5.0"
# simple-home-dir = "0.4.3"
hyper-tls = "0.6.0"
hyper-proxy = "0.9.1"
# hyper-util = "0.1.9"
# http-body-util = "0.1.2"
# bytes = "1.7.2"
# hyper-tls = "0.5"
# hyper-proxy = "0.7"
# Ошибка с этой версией
# headers = "0.4.0"
# headers = "0.3.0"
# reqwest = "0.12.8"
# hyper-proxy2 = "0.1.0"
# hyper-http-proxy = "1.0.0"

[profile.release]
panic = "abort" # Strip expensive panic clean-up logic
Expand Down
144 changes: 133 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,166 @@ Network request proxy manager with host filtering on macOS + spoofDPI direct con

![proxer screenshot](screenshot.png)

## How to use
## How to Install

1. Clone the repository.
Just log into your macOS terminal and run the command:

```bash
git clone https://github.com/doroved/proxer.git
curl -fsSL https://raw.githubusercontent.com/doroved/proxer/main/install.sh | bash
```
After installation, be sure to run this command to make proxer available in the current terminal session:

2. Rename `proxer.example.json5` to `proxer.json5` and edit it.
```bash
export PATH=$PATH:~/.proxer/bin
```
To update proxer to the latest version, use the same command that was used for installation.

## Key Features:
- Traffic filtering by hosts with caching.
- Basic SpoofDPI support.
- Setting secret token for [Proxerver](https://github.com/doroved/proxerver) to protect against proxy detection.

```
proxer --help
Proxy all macOS network requests with domain-based filtering. Basic spoof DPI for direct connections.
Usage: proxer [OPTIONS]
Options:
--port <u16> Set port for proxer. By default, a random port is used.
--dpi Enable DPI spoofing for direct connections. Spoofing is disabled by default.
--config <string> Path to the configuration file. Example: '/path/to/proxer.(json5|json)'. Default is ~/.proxer/config.json5.
--token <string> Secret token to access the HTTP/S proxerver. Must match the token specified in the proxerver configuration.
--log-error-all Show all errors. By default, only critical errors are shown. This option is useful for debugging.
-h, --help Print help
-V, --version Print version
```

The default configuration file is located in `~/.proxer/config.json5`. To edit it, you can quickly open it using the terminal command:

```bash
mv proxer.example.json5 proxer.json5
open -a TextEdit ~/.proxer/config.json5
```

3. Run `cargo build --release` to build the binary.
If you want to use your own configuration file, you can specify it at startup using the `--config` flag.
For example, if you are in a directory with the config, you can run proxer as follows:

```bash
proxer --config ./config.json5
```
Configuration file structure:

```json5
[
{
"name": "Proxer Free [DE] proxerver",
"enabled": true,
"scheme": "HTTPS",
"host": "proxerver.freemyip.com",
"port": 443,
"auth_credentials": {
"username": "proxerver",
"password": "onelove"
},
"filter": [
{
"name": "YouTube",
"domains": ["*.youtube.com", "*.googlevideo.com", "*.ggpht.com"]
},
{
"name": "Discord",
"domains": [
"discord.com",
"*.discord.com",
"*.discordapp.com",
"discord-attachments-*.storage.googleapis.com",
"*.discordapp.net",
"gateway.discord.gg"
]
},
{
"name": "Test",
"domains": ["api.ipify.org"]
}
]
}
]
```
If your proxies don't require authentication, you can leave the `auth_credentials.username` and `auth_credentials.password` fields empty.

## Examples of Proxer Launch Commands

Set port 5555 for the local Proxer server.

```bash
proxer --port 5555
```

Enable basic DPI bypass.
```bash
proxer --dpi
```

Set the secret token that was set when starting the `Proxerver` proxy server. This will allow the proxy server to accept requests only from your client.
```bash
proxer --token 'HelloProxerver'
```

Enable display of all proxy server connection errors.
```bash
proxer --log-error-all
```

To run the Proxer in the background, use nohup, for example:

```bash
nohup proxer [OPTIONS] >/dev/null 2>&1 &
```

Running the Proxer in the background using nohup and saving the output to a file:

```bash
nohup proxer [OPTIONS] > ~/.proxer/log.txt 2>&1 &
```

## Local Build and Run

1. Clone the repository.

```bash
git clone https://github.com/doroved/proxer.git
```

2. Run `cargo build --release` to build the binary.

```bash
cargo build --release
```

4. Run `./target/release/proxer` to start Proxer.
3. Run the Proxer binary with configuration.

```bash
./target/release/proxer
./target/release/proxer --config 'proxer.dev.json5'
```

5. Or run it in background process using `nohup`.
4. Or run it in background process using `nohup`.

```bash
nohup ./target/release/proxer >/dev/null 2>&1 &
nohup ./target/release/proxer --config 'proxer.dev.json5' >/dev/null 2>&1 &
```

6. Run `kill $(pgrep proxer)` to stop Proxer.
5. To stop Proxer, run this command.

```bash
kill $(pgrep proxer)
```

6. See Proxer running on your machine
```bash
lsof -i -P | grep LISTEN | grep proxer
```

## Interesting projects

- [DumbProxy](https://github.com/SenseUnit/dumbproxy) - Great proxy server with various features
Expand Down
118 changes: 118 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#!/bin/bash

# Check architecture
arch=$(uname -m)
if [[ "$arch" != "x86_64" && "$arch" != "arm64" ]]; then
echo "Error: Unsupported architecture $arch. Exiting script."
exit 1
fi

# Determine the appropriate architecture for the orb command
if [ "$arch" = "aarch64" ]; then
short_arch="arm64"
else
short_arch="x86_64"
fi

# Function to add PATH to the configuration file
update_path() {
local rc_file=$1
if ! grep -q "export PATH=.*proxer/bin" "$rc_file"; then
echo "# Proxer" >> "$rc_file"
echo "export PATH=\$PATH:~/.proxer/bin" >> "$rc_file"
source "$rc_file"
echo "Updated $rc_file"
else
echo "Path already added in $rc_file"
fi
}

# Fetch the latest release tag from GitHub
curl "https://api.github.com/repos/doroved/proxer/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/' |
xargs -I {} curl -OL "https://github.com/doroved/proxer/releases/download/"\{\}"/proxer.darwin-${short_arch}.tar.gz"

# Create directory for installation
mkdir -p ~/.proxer/bin

# Extract and move the files
tar -xzvf ./proxer.darwin-${short_arch}.tar.gz && \
rm -rf ./proxer.darwin-${short_arch}.tar.gz && \
mv ./proxer ~/.proxer/bin

# Check for errors in the previous commands
if [ $? -ne 0 ]; then
echo "Error. Exiting now."
exit
fi

# Remove the quarantine attribute from the proxer executable to allow it to run without restrictions
xattr -d com.apple.quarantine ~/.proxer/bin/proxer

# Check if config.json5 exists, if not, create it
if [ ! -f ~/.proxer/config.json5 ]; then
cat <<EOL > ~/.proxer/config.json5
[
{
"name": "Proxer Free [DE] proxerver",
"enabled": true,
"scheme": "HTTPS",
"host": "proxerver.freemyip.com",
"port": 443,
"auth_credentials": {
"username": "proxerver",
"password": "onelove"
},
"filter": [
{
"name": "YouTube",
"domains": ["*.youtube.com", "*.googlevideo.com", "*.ggpht.com"]
},
{
"name": "Discord",
"domains": [
"discord.com",
"*.discord.com",
"*.discordapp.com",
"discord-attachments-*.storage.googleapis.com",
"*.discordapp.net",
"gateway.discord.gg"
]
},
{
"name": "Test",
"domains": ["api.ipify.org"]
}
]
}
]
EOL
echo "Created config.json5 in ~/.proxer"
else
echo "config.json5 already exists in ~/.proxer"
fi

# Add to PATH
export PATH=$PATH:~/.proxer/bin

# Check for .bashrc and .zshrc and append PATH export if they exist
if [ -f ~/.bashrc ]; then
update_path ~/.bashrc
fi

if [ -f ~/.zshrc ]; then
update_path ~/.zshrc
fi

# Success message with version
proxer_version=$(proxer -V)
echo ""
echo "Successfully installed $proxer_version"

# Run the proxer help command
proxer --help
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
echo "Please copy and paste this command into the terminal and press Enter:"
echo "export PATH=\$PATH:~/.proxer/bin"
34 changes: 34 additions & 0 deletions proxer.dev.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
name: "Proxer Free [DE] proxerver",
enabled: true,
scheme: "HTTPS",
host: "proxerver.freemyip.com",
port: 443,
auth_credentials: {
username: "proxerver",
password: "onelove",
},
filter: [
{
name: "YouTube",
domains: ["*.youtube.com", "*.googlevideo.com", "*.ggpht.com"],
},
{
name: "Discord",
domains: [
"discord.com",
"*.discord.com",
"*.discordapp.com",
"discord-attachments-*.storage.googleapis.com",
"*.discordapp.net",
"gateway.discord.gg",
],
},
{
name: "Test",
domains: ["api.ipify.org"],
},
],
},
]
Loading

0 comments on commit be82a11

Please sign in to comment.