### Install SpoofDPI Using Installation Script Source: https://github.com/xvzc/spoofdpi/blob/main/docs/getting-started/install.md This command downloads and executes the official installation script for SpoofDPI. The binary will be placed in the /usr/local/bin directory. ```console $ curl -fsSL https://raw.githubusercontent.com/xvzc/SpoofDPI/main/install.sh | bash ``` -------------------------------- ### Basic DNS over HTTPS Setup (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/examples.md A minimal TOML configuration for SpoofDPI to enable DNS over HTTPS (DoH) using Google's DNS server. This is a starting point for basic DoH functionality. ```toml [dns] mode = "https" https-url = "https://dns.google/dns-query" ``` -------------------------------- ### Install libpcap Dependency for SpoofDPI Source: https://github.com/xvzc/spoofdpi/blob/main/docs/getting-started/install.md Instructions for installing the libpcap library, which is a required dependency for SpoofDPI on macOS and FreeBSD. Linux systems do not require this explicit installation. ```console # macOS $ brew install libpcap # FreeBSD $ pkg install libpcap # Linux $ echo "libpcap is not required on Linux" ``` -------------------------------- ### Install libpcap Development Headers (Fedora/RHEL) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/build-and-run.md Installs the libpcap development headers on Fedora or RHEL-based systems. This command uses 'dnf' to install the 'libpcap-devel' package, which provides the necessary files for compiling code that uses libpcap. ```bash sudo dnf install libpcap-devel ``` -------------------------------- ### Install SpoofDPI Using Installation Script Source: https://context7.com/xvzc/spoofdpi/llms.txt Installs SpoofDPI to /usr/local/bin using a provided script from GitHub. This method requires sudo permissions for writing to system directories. ```bash # Install to /usr/local/bin (requires sudo for permission) curl -fsSL https://raw.githubusercontent.com/xvzc/SpoofDPI/main/install.sh | bash ``` -------------------------------- ### Install SpoofDPI Using Package Managers Source: https://github.com/xvzc/spoofdpi/blob/main/docs/getting-started/install.md Installs SpoofDPI using common package managers for different Linux distributions and macOS. Note that package manager versions might not always be the latest. ```console # macOS $ brew install spoofdpi # Arch Linux $ yay -S spoofdpi # Fedora $ sudo dnf install spoofdpi # FreeBSD $ pkg install spoofdpi ``` -------------------------------- ### Install libpcap Development Headers (macOS) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/build-and-run.md Installs the libpcap library on macOS using Homebrew. This command ensures that the packet capture library and its associated headers are available for development purposes. ```bash brew install libpcap ``` -------------------------------- ### Install libpcap Development Headers (Debian/Ubuntu) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/build-and-run.md Installs the libpcap development headers on Debian-based systems (e.g., Ubuntu) required for packet capture functionality. This command updates the package list and then installs the necessary development package. ```bash sudo apt update && sudo apt install libpcap-dev ``` -------------------------------- ### Manually Build SpoofDPI from GitHub Release Archive Source: https://github.com/xvzc/spoofdpi/blob/main/docs/getting-started/install.md A bash script to build SpoofDPI from a GitHub release archive. It downloads the source, extracts it, and compiles the binary, embedding version, commit hash, and build information. This method is useful for platforms without native GitHub Actions runners. ```bash #!/usr/bin/env bash VERSION="#REPLACE_THIS_WITH_VERSION#" BUILD_INFO="freebsd" ASSET="spoofdpi-$VERSION.tar.gz" SRC="spoofdpi-$VERSION" DIST="dist" curl -fsSL \ https://github.com/xvzc/SpoofDPI/releases/download/v$VERSION/$ASSET \ -o ./$ASSET tar -xvzf ./spoofdpi-$VERSION.tar.gz BUILD_LDFLAGS="-s -w" BUILD_LDFLAGS="$BUILD_LDFLAGS -X 'main.version=$VERSION'" BUILD_LDFLAGS="$BUILD_LDFLAGS -X 'main.commit=$(cat ./$SRC/COMMIT)'" BUILD_LDFLAGS="$BUILD_LDFLAGS -X 'main.build=$BUILD_INFO'" # You can disable CGO on Linux by setting `CGO_ENABLED=0` CGO_ENABLED=1 go build -C ./$SRC \ -ldflags "$BUILD_LDFLAGS" \ -o ../$DIST/spoofdpi ./cmd/spoofdpi ``` -------------------------------- ### Manually Build SpoofDPI from Git Repository Source: https://github.com/xvzc/spoofdpi/blob/main/docs/getting-started/install.md A shell script to manually build SpoofDPI from its Git repository. It clones the repository, sets build flags including commit and build information, and compiles the binary. CGO can be disabled on Linux. ```sh #!/usr/bin/env sh BUILD_INFO="git" SRC="SpoofDPI" DIST="dist" mkdir -p ./$DIST git clone https://github.com/xvzc/SpoofDPI.git BUILD_LDFLAGS="-s -w" BUILD_LDFLAGS="$BUILD_LDFLAGS -X 'main.commit=$(git -C ./$SRC rev-parse --short HEAD)'" BUILD_LDFLAGS="$BUILD_LDFLAGS -X 'main.build=$BUILD_INFO'" # You can disable CGO on Linux by setting `CGO_ENABLED=0` CGO_ENABLED=1 go build -C ./$SRC \ -ldflags "$BUILD_LDFLAGS" \ -o ../$DIST/spoofdpi ./cmd/spoofdpi ``` -------------------------------- ### Install SpoofDPI with Package Managers Source: https://context7.com/xvzc/spoofdpi/llms.txt Provides commands for installing SpoofDPI on various operating systems using their respective package managers. This includes Homebrew for macOS, AUR for Arch Linux, DNF for Fedora, and pkg for FreeBSD. ```bash # macOS brew install spoofdpi # Arch Linux yay -S spoofdpi # Fedora sudo dnf install spoofdpi # FreeBSD pkg install spoofdpi ``` -------------------------------- ### Build SpoofDPI Executable (Go with CGO) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/build-and-run.md Compiles the SpoofDPI project into an executable binary. This command explicitly enables CGO, which is necessary for the project's low-level networking features. It also applies linker flags to strip debug information and reduce binary size. ```bash CGO_ENABLED=1 go build -ldflags="-w -s" ./cmd/... ``` -------------------------------- ### Run SpoofDPI from Source Code (Go) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/build-and-run.md Executes the SpoofDPI application directly from its source code using the 'go run' command. This method is useful for testing without creating a standalone executable. Command-line arguments can be appended after the package path. ```bash go run ./cmd/spoofdpi --https-chunk-size 1 ``` -------------------------------- ### Run SpoofDPI with Default Settings (Bash) Source: https://context7.com/xvzc/spoofdpi/llms.txt Starts the SpoofDPI proxy server using its default configuration. By default, it listens on the loopback interface at port 8080. ```bash # Run with default settings (listens on 127.0.0.1:8080) spoofdpi ``` -------------------------------- ### Page Structure with Jinja and HTML Source: https://github.com/xvzc/spoofdpi/blob/main/docs/overrides/home.html This Jinja template defines the overall structure of the web page, extending a base template. It includes sections for header, tabs, content, and footer. Specific content like an image and a 'Get Started' button are placed within the 'tabs' block, utilizing Jinja's URL filter for link generation. ```html {% extends "base.html" %} {% block extrahead %} {{ super() }} .md-header { position: initial; box-shadow: none; } .md-header__button { display: none; } /* Rules provided by user */ .md-main__inner { margin: 0; } .md-tabs { display: none; box-shadow: none; } .md-content { /* Hide the default markdown content */ display: none; } /* [NEW] Hide the default footer */ .md-footer { display: none; } /* Base page styles */ body, html { margin: 0; padding: 0; overflow: hidden; /* Corrected syntax error (removed quotes) and used color from previous context */ background-color: hsl(230, 13%, 9%); position: relative; height: 100vh; } /* Canvas (background) */ canvas#matrix { display: block; position: fixed; top: 0; left: 0; z-index: 0; } /* [MODIFIED] Center container for both image and button */ .center-container { position: fixed; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; display: flex; flex-direction: column; /* Image above button */ align-items: center; /* Center horizontally */ gap: 20px; /* Space between image and button */ z-index: 1; } /* Centered image style */ #center-image { /* [FIXED] 'transform' removed. Centering is handled by the flex container. */ z-index: 0; object-fit: contain; /* Responsive sizing (Default for desktops) */ /* Using vw/vh (viewport width/height) is more robust here */ max-width: 60vw; max-height: 60vh; } /* Get Started Button Style */ #get-started-button { display: inline-block; padding: 12px 28px; font-family: 'Chakra Petch', monospace; font-size: 3.2em; font-weight: bold; color: #0F0; /* Neon green text */ background-color: rgba(0, 255, 0, 0.1); /* Slightly transparent green background */ border: 2px solid #0F0; border-radius: 8px; text-decoration: none; /* Remove underline for links */ cursor: pointer; transition: all 0.3s ease; /* Smooth hover effects */ box-shadow: 0 0 15px rgba(0, 255, 0, 0.4); } #get-started-button:hover { background-color: #0F0; /* Solid green background on hover */ color: #14151a; /* Dark background color for text on hover */ box-shadow: 0 0 25px rgba(0, 255, 0, 0.8); transform: scale(1.05); /* Slightly enlarge on hover */ } /* [MODIFIED] Media queries should only adjust size, not position. */ @media (max-width: 1150px) { #center-image { /* top: 330px; (Removed) */ max-width: 90vw; max-height: 90vh; } } @media (max-width: 800px) { #center-image { /* top: 280px; (Removed) */ } .center-container { top: 40%; } } @media (max-width: 600px) { #center-image { /* top: 200px; (Removed) */ max-width: 95vw; /* Make it even wider on small mobile */ } .center-container { top: 30%; } } {% endblock %} {% block tabs %} {{ super() }} ![Center Image](./static/demo.png) [Get Started]({{ 'getting-started/introduction/' | url }}) {% endblock %} {% block content %} {% endblock %} {% block footer %} {% endblock %} ``` -------------------------------- ### Go Table-Driven Test Example Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/testing.md Illustrates the implementation of table-driven tests in Go for testing multiple scenarios of the same logic. Uses a slice of structs to define test cases, each with a name, input, and expected output. ```go func TestCalculation(t *testing.T) { tcs := []struct { name string input int expected int }{ { name: "positive number", input: 5, expected: 10, }, { name: "zero", input: 0, expected: 0, }, } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { result := calculate(tc.input) assert.Equal(t, tc.expected, result) }) } } ``` -------------------------------- ### Check SpoofDPI Version (Bash) Source: https://context7.com/xvzc/spoofdpi/llms.txt Displays the currently installed version of SpoofDPI along with its Git commit hash and build type. This is useful for verifying the installation and build information. ```bash spoofdpi --version # Output: spoofdpi v1.x.x abc1234 (release) ``` -------------------------------- ### Automatic Detection and Template Configuration (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/examples.md TOML configuration for SpoofDPI to automatically detect blocked sites and apply a predefined template. This simplifies applying bypass rules to dynamically identified sites. ```toml [policy] auto = true # Template applied to automatically detected blocked sites [policy.template] https = { fake-count = 7, disorder = true } ``` -------------------------------- ### Display SpoofDPI Version Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/general.md Prints the current version string of SpoofDPI to the console and then exits the application. This is typically used for checking the installed version and is accessible via a command-line flag. ```console $ spoofdpi --version ``` -------------------------------- ### Set DNS Resolution Mode (Console) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Specifies the default resolution mode for domains. This example sets the mode to 'https' for DNS over HTTPS. ```console $ spoofdpi --dns-mode "https" ``` -------------------------------- ### Rule-Based Routing Configuration (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/examples.md TOML configuration for SpoofDPI's policy engine to implement rule-based routing. This allows blocking specific domains, bypassing DPI for certain sites, or routing local network traffic directly. ```toml [policy] # Block ads [[policy.overrides]] name = "block ads" match = { domain = ["ads.example.com"] } block = true # Bypass DPI for specific blocked site [[policy.overrides]] name = "unblock site" match = { domain = ["blocked-site.com"] } https = { fake-count = 7, disorder = true } # Use local network directly (no processing) [[policy.overrides]] name = "local bypass" match = { addr = [{ cidr = "192.168.0.0/16", port = "all" }] } https = { skip = true } ``` -------------------------------- ### Basic DoH Setup Configuration (TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt A minimal TOML configuration for setting up DNS over HTTPS (DoH). It specifies the DNS mode, the DoH server URL, and enables DNS caching. ```toml # spoofdpi.toml - Minimal secure DNS configuration [dns] mode = "https" https-url = "https://dns.google/dns-query" cache = true ``` -------------------------------- ### Set DNS over HTTPS URL (Console) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Specifies the endpoint URL for DNS over HTTPS (DoH) queries. This example sets the URL to 'https://1.1.1.1/dns-query'. ```console $ spoofdpi --dns-https-url "https://1.1.1.1/dns-query" ``` -------------------------------- ### Suppress SpoofDPI Startup Banner Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/general.md Controls whether the ASCII art banner is displayed when SpoofDPI starts. By default, the banner is shown. This setting can be toggled using command-line flags or TOML configuration. ```console $ spoofdpi --silent ``` ```toml [general] silent = true ``` -------------------------------- ### Filter DNS Queries by Type (Console) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Filters DNS queries by record type. This example sets the query type to 'all' to include both IPv4 and IPv6 records. ```console $ spoofdpi --dns-qtype "all" ``` -------------------------------- ### Set Upstream DNS Server Address (Console) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Configures the upstream DNS server address for standard UDP queries. This example sets the address to '1.1.1.1:53'. ```console $ spoofdpi --dns-addr "1.1.1.1:53" ``` -------------------------------- ### Configure System-Wide Proxy for SpoofDPI (macOS) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/general.md Enables or disables the automatic setup of system-wide proxy configuration. This feature is currently supported only on macOS. It can be activated via command-line flags or TOML configuration. ```console $ spoofdpi --system-proxy ``` ```toml [general] system-proxy = true ``` -------------------------------- ### Set DNS Resolution Mode (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Configures the default DNS resolution mode using a TOML file. This example sets the mode to 'https' for DNS over HTTPS. ```toml [dns] mode = "https" ``` -------------------------------- ### Aggressive DPI Bypass Configuration (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/examples.md TOML configuration for SpoofDPI to enable more aggressive DPI bypass. It utilizes multiple fake packets and disorders the Client Hello packet. This is useful when default settings are insufficient. ```toml [https] fake-count = 5 fake-packet = [0x16, 0x03, 0x01] # Simple fake Client Hello prefix disorder = true split-mode = "chunk" chunk-size = 1 ``` -------------------------------- ### Set DNS over HTTPS URL (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Configures the endpoint URL for DNS over HTTPS (DoH) queries using a TOML file. This example sets the URL to 'https://1.1.1.1/dns-query'. ```toml [dns] https-url = "https://1.1.1.1/dns-query" ``` -------------------------------- ### Filter DNS Queries by Type (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Configures DNS query filtering by record type using a TOML file. This example sets the query type to 'all' to include both IPv4 and IPv6 records. ```toml [dns] qtype = "all" ``` -------------------------------- ### Set Upstream DNS Server Address (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Configures the upstream DNS server address for standard UDP queries using a TOML file. This example sets the address to '1.1.1.1:53'. ```toml [dns] addr = "1.1.1.1:53" ``` -------------------------------- ### Configure SpoofDPI Policy (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/policy.md This TOML configuration defines SpoofDPI policies. It includes examples for allowing YouTube with DPI bypass, skipping local network traffic, and blocking a specific domain. These policies are applied based on domain matching or IP address ranges and ports. ```toml [policy] # Example A: Allow YouTube with specific DPI bypass settings [[policy.overrides]] name = "allow youtube" priority = 50 match = { domain = ["*.youtube.com"] } https = { disorder = true, fake-count = 7 } # Example B: Bypass DPI for local network traffic (Standard Connection) [[policy.overrides]] name = "skip local" priority = 51 match = { addr = [{ cidr = "192.168.0.0/24", port = "all" }] } https = { skip = true } # Example C: Block a specific domain [[policy.overrides]] name = "block ads" priority = 100 match = { domain = ["ads.example.com"] } block = true ``` -------------------------------- ### Run All Go Tests Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/testing.md Executes all tests within the current Go module. This is the standard command for ensuring the entire project's test suite passes. ```console $ go test ./... ``` -------------------------------- ### Go Test Assertions with Testify Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/testing.md Demonstrates using testify/assert for checks that allow tests to continue after failure and testify/require for checks that must pass to proceed. Imports standard testing package and testify libraries. ```go import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestExample(t *testing.T) { result, err := SomeFunction() // Stop immediately if there's an error require.NoError(t, err) // Assert the result, but continue even if it fails assert.Equal(t, "expected", result) } ``` -------------------------------- ### Manual Build SpoofDPI from Source (Go) Source: https://context7.com/xvzc/spoofdpi/llms.txt Compiles SpoofDPI from its source code using Go. This snippet demonstrates setting build information, linking flags for commit and build details, and disabling CGO if necessary on Linux. The output executable is placed in a 'dist' directory. ```go #!/usr/bin/env sh BUILD_INFO="git" SRC="SpoofDPI" DIST="dist" mkdir -p ./$DIST git clone https://github.com/xvzc/SpoofDPI.git BUILD_LDFLAGS="-s -w" BUILD_LDFLAGS="$BUILD_LDFLAGS -X 'main.commit=$(git -C ./$SRC rev-parse --short HEAD)'" BUILD_LDFLAGS="$BUILD_LDFLAGS -X 'main.build=$BUILD_INFO'" # CGO can be disabled on Linux by setting CGO_ENABLED=0 CGO_ENABLED=1 go build -C ./$SRC \ -ldflags "$BUILD_LDFLAGS" \ -o ../$DIST/spoofdpi ./cmd/spoofdpi ``` -------------------------------- ### Run Go Tests with Verbose Output Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/testing.md Runs all tests in the project with verbose output, displaying the names of all tests as they are executed. Useful for detailed test monitoring. ```console $ go test -v ./... ``` -------------------------------- ### Run SpoofDPI with Default Settings (Clean Mode) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/general.md When enabled, this option instructs SpoofDPI to ignore all existing configuration files and run solely with its default settings. This is controlled via a command-line flag. ```console $ spoofdpi --clean ``` -------------------------------- ### Run Quality Checks with golangci-lint Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/code-quality.md Executes all configured quality checks for the project. This command helps identify potential issues and maintain code integrity. ```console $ golangci-lint run ``` -------------------------------- ### Enable System Proxy (macOS) (Bash/TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Automatically configures system-wide proxy settings. This feature is specific to macOS and can be enabled via the command line or TOML configuration. Default is `false`. ```bash spoofdpi --system-proxy ``` ```toml [general] system-proxy = true ``` -------------------------------- ### Enable DNS Caching (Console) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Enables DNS record caching to improve performance and reduce latency. This command-line flag activates the cache. ```console $ spoofdpi --dns-cache ``` -------------------------------- ### Page Styling with CSS Source: https://github.com/xvzc/spoofdpi/blob/main/docs/overrides/home.html This CSS code styles the web page, including the header, main content area, tabs, footer, and body. It sets up a dark background, positions a canvas for a matrix effect, and styles a centered container for an image and a button. Responsive adjustments are made for different screen sizes. ```css .md-header { position: initial; box-shadow: none; } .md-header__button { display: none; } /* Rules provided by user */ .md-main__inner { margin: 0; } .md-tabs { display: none; box-shadow: none; } .md-content { /* Hide the default markdown content */ display: none; } /* [NEW] Hide the default footer */ .md-footer { display: none; } /* Base page styles */ body, html { margin: 0; padding: 0; overflow: hidden; /* Corrected syntax error (removed quotes) and used color from previous context */ background-color: hsl(230, 13%, 9%); position: relative; height: 100vh; } /* Canvas (background) */ canvas#matrix { display: block; position: fixed; top: 0; left: 0; z-index: 0; } /* [MODIFIED] Center container for both image and button */ .center-container { position: fixed; max-width: 100%; max-height: 100%; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; display: flex; flex-direction: column; /* Image above button */ align-items: center; /* Center horizontally */ gap: 20px; /* Space between image and button */ z-index: 1; } /* Centered image style */ #center-image { /* [FIXED] 'transform' removed. Centering is handled by the flex container. */ z-index: 0; object-fit: contain; /* Responsive sizing (Default for desktops) */ /* Using vw/vh (viewport width/height) is more robust here */ max-width: 60vw; max-height: 60vh; } /* Get Started Button Style */ #get-started-button { display: inline-block; padding: 12px 28px; font-family: 'Chakra Petch', monospace; font-size: 3.2em; font-weight: bold; color: #0F0; /* Neon green text */ background-color: rgba(0, 255, 0, 0.1); /* Slightly transparent green background */ border: 2px solid #0F0; border-radius: 8px; text-decoration: none; /* Remove underline for links */ cursor: pointer; transition: all 0.3s ease; /* Smooth hover effects */ box-shadow: 0 0 15px rgba(0, 255, 0, 0.4); } #get-started-button:hover { background-color: #0F0; /* Solid green background on hover */ color: #14151a; /* Dark background color for text on hover */ box-shadow: 0 0 25px rgba(0, 255, 0, 0.8); transform: scale(1.05); /* Slightly enlarge on hover */ } /* [MODIFIED] Media queries should only adjust size, not position. */ @media (max-width: 1150px) { #center-image { /* top: 330px; (Removed) */ max-width: 90vw; max-height: 90vh; } } @media (max-width: 800px) { #center-image { /* top: 280px; (Removed) */ } .center-container { top: 40%; } } @media (max-width: 600px) { #center-image { /* top: 200px; (Removed) */ max-width: 95vw; /* Make it even wider on small mobile */ } .center-container { top: 30%; } } ``` -------------------------------- ### Specify Custom Config File (Bash/Environment) Source: https://context7.com/xvzc/spoofdpi/llms.txt Allows specifying a custom path to the TOML configuration file, overriding default search paths. This can be done using a command-line argument or by setting the `SPOOFDPI_CONFIG` environment variable. ```bash # Command-line: Use custom config location spoofdpi --config ~/my-spoofdpi-config.toml # Or use environment variable export SPOOFDPI_CONFIG=~/my-spoofdpi-config.toml spoofdpi ``` -------------------------------- ### Format Code with golangci-lint Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/code-quality.md Formats the project's code using internal tools like goimports and gofmt. This command ensures consistent code style across the project. ```console $ golangci-lint fmt ``` -------------------------------- ### Enable Clean Mode (Bash) Source: https://context7.com/xvzc/spoofdpi/llms.txt Runs SpoofDPI by ignoring all configuration files and using only default settings. This is activated via a command-line flag. ```bash spoofdpi --clean ``` -------------------------------- ### Configure SpoofDPI Listen Address (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Sets the IP address and port for the SpoofDPI proxy server. It can be configured via command-line flag or within a TOML configuration file. Setting to `0.0.0.0` allows remote access. ```bash # Command-line: Listen on all interfaces, port 9090 spoofdpi --listen-addr "0.0.0.0:9090" ``` ```toml # TOML config (spoofdpi.toml) [server] listen-addr = "0.0.0.0:9090" ``` -------------------------------- ### Configure Log Level for SpoofDPI Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/general.md Sets the logging verbosity for SpoofDPI. Available levels include debug, trace, info, warn, error, and disabled. The default is 'info'. This can be configured via command-line flags or TOML files. ```console $ spoofdpi --log-level trace ``` ```toml [general] log-level = "trace" ``` -------------------------------- ### Enable HTTPS Packet Disordering (Bash/TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Enables out-of-order delivery of fragmented Client Hello packets by manipulating TTL values to confuse DPI systems. This can be configured via the command line or a TOML file. Default is `false`. ```bash spoofdpi --https-disorder ``` ```toml [https] disorder = true ``` -------------------------------- ### Enable Automatic Policy Detection (Bash/TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Automatically detects blocked sites and applies bypass rules using a configured template. This feature can be enabled via the command line or a TOML file. Default is `false`. ```bash spoofdpi --policy-auto ``` ```toml [policy] auto = true [policy.template] https = { fake-count = 7, disorder = true } ``` -------------------------------- ### Enable DNS Caching (TOML) Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/dns.md Configures DNS record caching using a TOML file. Setting 'cache' to 'true' enables caching for improved performance. ```toml [dns] cache = true ``` -------------------------------- ### Run Specific Go Test Function Source: https://github.com/xvzc/spoofdpi/blob/main/docs/developer-guide/testing.md Executes a specific test function, identified by its name, within a given package. This is helpful for focused debugging or verification. ```console $ go test -v -run TestCreateCommand_Flags ./internal/config/ ``` -------------------------------- ### Configure Policy Override Rules (TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Defines granular rules for specific domains or IP addresses, supporting domain wildcards and CIDR notation. This is configured entirely within the TOML file. ```toml # TOML config: Complete policy configuration example [policy] # Rule 1: Apply aggressive bypass for YouTube [[policy.overrides]] name = "allow youtube" priority = 50 match = { domain = ["*.youtube.com", "*.googlevideo.com"] } https = { disorder = true, fake-count = 7, split-mode = "chunk", chunk-size = 1 } # Rule 2: Skip processing for local network [[policy.overrides]] name = "skip local" priority = 51 match = { addr = [{ cidr = "192.168.0.0/16", port = "all" }] } https = { skip = true } # Rule 3: Block specific domain [[policy.overrides]] name = "block ads" priority = 100 match = { domain = ["ads.example.com", "*.tracking.com"] } block = true # Rule 4: Custom DNS for specific domain [[policy.overrides]] name = "custom dns" priority = 60 match = { domain = ["sensitive-site.com"] } dns = { mode = "https", https-url = "https://dns.quad9.net/dns-query" } https = { fake-count = 5 } ``` -------------------------------- ### Configure Fake Packet Count for HTTPS (Bash/TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Sets the number of fake packets to send before the actual Client Hello to trick DPI systems. This is configurable via the command line or a TOML file. Default is `0`. ```bash spoofdpi --https-fake-count 7 ``` ```toml [https] fake-count = 7 ``` -------------------------------- ### Configure Policy Template for Auto-Generated Rules Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/policy.md Defines the default behavior for rules automatically generated when `auto = true`. This template ensures that generated rules effectively bypass DPI. The template uses the same `Rule` structure as overrides, with `https` and `dns` sections being most relevant. ```toml [policy] auto = true # This configuration is applied to automatically detected blocked sites [policy.template] https = { fake-count = 7, disorder = true } ``` -------------------------------- ### Specify Custom TOML Config File for SpoofDPI Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/general.md Allows specifying a custom path to a TOML configuration file. If set, SpoofDPI will not search default directories for configuration. This option is available via command-line flags only. ```console $ spoofdpi --config ~/spoofdpi.toml ``` -------------------------------- ### Define Detailed Policy Override Rules Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/policy.md Specifies advanced policy rules using an array of `overrides` tables within the `[policy]` section. Each rule includes matching criteria (`match`) and specific settings for DNS (`dns`) and HTTPS (`https`). These rules are only available via the TOML config file. ```toml [policy] # Example override rule [[policy.overrides]] name = "block-example-com" priority = 10 block = true [policy.overrides.match] domain = ["*.example.com"] [policy.overrides.dns] mode = "system" [policy.overrides.https] skip = false ``` -------------------------------- ### Set Log Level (Bash/TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Configures the logging verbosity for SpoofDPI. Available levels include `debug`, `trace`, `info`, `warn`, `error`, and `disabled`. The default level is `info`. ```bash spoofdpi --log-level trace ``` ```toml [general] log-level = "trace" ``` -------------------------------- ### Configure SpoofDPI HTTPS Split Mode (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Defines the packet fragmentation strategy for TLS Client Hello packets to bypass DPI. Available modes include `sni`, `random`, `chunk`, `first-byte`, and `none`. Configuration is done via command line or TOML. ```bash # Command-line: Use chunk-based splitting spoofdpi --https-split-mode "chunk" ``` ```toml # TOML config [https] split-mode = "chunk" ``` -------------------------------- ### Enable Silent Mode (Bash/TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Suppresses the ASCII art banner that is displayed at startup. This option can be enabled via the command line or by setting the corresponding value in the TOML configuration. Default is `false`. ```bash spoofdpi --silent ``` ```toml [general] silent = true ``` -------------------------------- ### Configure SpoofDPI DNS-over-HTTPS URL (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Defines the endpoint URL for DNS-over-HTTPS (DoH) queries when the `dns-mode` is set to `https`. The default URL points to Google's DoH service. Configuration can be done via command line or TOML. ```bash # Command-line: Use Cloudflare DoH spoofdpi --dns-https-url "https://1.1.1.1/dns-query" ``` ```toml # TOML config [dns] https-url = "https://1.1.1.1/dns-query" ``` -------------------------------- ### Configure SpoofDPI DNS Mode (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Specifies the DNS resolution method for SpoofDPI. Options include `udp` (standard), `https` (DNS-over-HTTPS), and `system` (OS resolver). This setting can be controlled via command line or TOML. ```bash # Command-line: Use DNS-over-HTTPS spoofdpi --dns-mode "https" ``` ```toml # TOML config [dns] mode = "https" ``` -------------------------------- ### Configure SpoofDPI DNS Query Type (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Filters the types of DNS records SpoofDPI queries for. Options are `ipv4` (A records), `ipv6` (AAAA records), or `all` (both). This setting is configurable via command line or TOML. ```bash # Command-line: Query both IPv4 and IPv6 spoofdpi --dns-qtype "all" ``` ```toml # TOML config [dns] qtype = "all" ``` -------------------------------- ### Customize Fake Packet Content for HTTPS (Bash/TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Allows customization of the fake packet content using a byte array representing TLS-like data. This option is available through the command line or TOML configuration. ```bash spoofdpi --https-fake-packet "16,03,01,00,a1" ``` ```toml [https] fake-packet = [0x16, 0x03, 0x01, 0x00] ``` -------------------------------- ### Configure SpoofDPI Connection Timeout (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Sets the TCP connection timeout in milliseconds for SpoofDPI. The timeout can be specified via the command line or in a TOML configuration file. A value of 0 disables the timeout. ```bash # Command-line: Set 5 second timeout spoofdpi --timeout 5000 ``` ```toml # TOML config [server] timeout = 5000 ``` -------------------------------- ### Enable SpoofDPI DNS Caching (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Enables or disables the caching of DNS records within SpoofDPI to improve performance and reduce latency. This feature can be toggled using a command-line flag or a TOML configuration setting. ```bash # Command-line: Enable DNS caching spoofdpi --dns-cache ``` ```toml # TOML config [dns] cache = true ``` -------------------------------- ### Configure SpoofDPI DNS Server Address (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Sets the upstream DNS server address for UDP queries in SpoofDPI. The default is Google's DNS server (`8.8.8.8:53`). This can be configured using command-line flags or a TOML file. ```bash # Command-line: Use Cloudflare DNS spoofdpi --dns-addr "1.1.1.1:53" ``` ```toml # TOML config [dns] addr = "1.1.1.1:53" ``` -------------------------------- ### Aggressive Bypass Configuration (TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt A TOML configuration designed for maximum DPI bypass. It sets detailed logging, uses a specific DoH server with caching, and enables aggressive HTTPS bypass techniques like packet disordering and splitting. ```toml # spoofdpi.toml - Maximum DPI bypass settings [general] log-level = "debug" [dns] mode = "https" https-url = "https://1.1.1.1/dns-query" cache = true [https] fake-count = 7 disorder = true split-mode = "chunk" chunk-size = 1 ``` -------------------------------- ### Configure SpoofDPI Default TTL (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Sets the default Time To Live (TTL) value for outgoing packets in SpoofDPI. This value is used to restore TTL after applying packet disordering strategies. Configuration is possible via command line or TOML. ```bash # Command-line: Set TTL to 128 spoofdpi --default-ttl 128 ``` ```toml # TOML config [server] default-ttl = 128 ``` -------------------------------- ### TOML Configuration for South Korea Spoof DPI Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/configuration-recipes/south-korea.md This TOML snippet defines configuration parameters for Spoof DPI. It sets the HTTPS chunk size, the number of fake HTTPS requests, and a list of policies for filtering specific domains. ```toml # TOML config https-chunk-size = 1 https-fake-count = 10 policy = [ "i:*.pornhub.com", "i:*.womenonweb.org", ] ``` -------------------------------- ### Configure SpoofDPI HTTPS Chunk Size (Bash & TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Sets the size of data chunks in bytes for packet fragmentation when the `https-split-mode` is set to `chunk`. The value can range from 0 to 255. This is configurable via command line or TOML. ```bash # Command-line: Fragment into 1-byte chunks spoofdpi --https-chunk-size 1 ``` ```toml # TOML config [https] chunk-size = 1 ``` -------------------------------- ### Disable HTTPS DPI Bypass (Bash/TOML) Source: https://context7.com/xvzc/spoofdpi/llms.txt Disables all DPI bypass techniques for HTTPS traffic, causing connections to be treated as standard proxy connections. This setting can be toggled using the command line or a TOML file. Default is `false`. ```bash spoofdpi --https-skip ``` ```toml [https] skip = true ``` -------------------------------- ### Enable Automatic Policy Bypass Detection Source: https://github.com/xvzc/spoofdpi/blob/main/docs/user-guide/policy.md Automatically detect blocked sites and add them to the bypass list. When enabled, SpoofDPI attempts to detect if a connection is being blocked and temporarily applies bypass rules. These generated rules utilize the configuration defined in `[policy.template]`. ```console $ spoofdpi --policy-auto ``` ```toml [policy] auto = true ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.