Newer
Older
Skyworks-DNS-splitter / build-dnscrypt-proxy-forwarding-rules / build-dnscrypt-proxy-forwarding-rules.ps1
$SMARTDNS_SPEEDTEST_MODE="ping,tcp:80"
$NEWLINE="DOS"
# Define the $SERVER variable (replace with actual value if needed)
$SERVER = "166.111.8.28,166.111.8.29" # Replace with actual server address if not already defined

# dnscrypt-proxy equivalent in PowerShell
function ProcessDnscryptProxy {
    
     # Process the raw files and format the output as "domain_name $SERVER"
    Get-Content "accelerated-domains.china.conf", "google.china.conf", "apple.china.conf","custom.conf" | Where-Object { 
        $_ -match "^\S" -and $_ -notmatch "^\s*#"  # Skip empty lines and lines starting with #
    } | ForEach-Object {
        # Remove the 'server=/' prefix and the IP (114.114.114.114) part
        $domain = $_ -replace "^server=/([^/]+)/.*$", '$1'
        "$domain $SERVER"
    } | Set-Content "dnscrypt-proxy-forwarding-rules.txt"
}

# Main menu
Write-Output "Select an action:"
Write-Output "1. Generate DNSCrypt Proxy"
Write-Output "0. Exit"

$choice = Read-Host "Enter your choice"
switch ($choice) {
    1 { ProcessDnscryptProxy }
    0 { exit }
    default { Write-Output "Invalid choice!" }
}