27 lines
1.2 KiB
PowerShell
27 lines
1.2 KiB
PowerShell
# Wireguard tunnel interface details
|
|
$wgInterface = Get-NetAdapter -InterfaceAlias $env:WIREGUARD_TUNNEL_NAME
|
|
$wgAddress = (Get-NetIPAddress -InterfaceAlias $env:WIREGUARD_TUNNEL_NAME -AddressFamily IPv4 ).IPAddress
|
|
|
|
# add default 0.0.0.0/0 route with low priority
|
|
route add 0.0.0.0 mask 0.0.0.0 0.0.0.0 IF $wgInterface.ifIndex metric 999
|
|
|
|
# Set the interface metric for the WireGuard tunnel
|
|
Set-NetIPInterface -InterfaceIndex $wgInterface.ifIndex -InterfaceMetric 999
|
|
|
|
# Navigate to the 3proxy directory
|
|
Set-Location "<path>\<to>\3proxy-0.9.4-x64\bin64\"
|
|
$cfg_file = "3proxy-wireguard.cfg"
|
|
|
|
# Create 3proxy configuration file
|
|
'auth none' | Out-File -FilePath $cfg_file -Encoding ASCII
|
|
'internal 127.0.0.1' | Out-File -FilePath $cfg_file -Append -Encoding ASCII
|
|
"external ${wgAddress}" | Out-File -FilePath $cfg_file -Append -Encoding ASCII
|
|
|
|
# rest of the proxy configuration
|
|
'socks' | Out-File -FilePath $cfg_file -Append -Encoding ASCII
|
|
'log "%USERPROFILE%\.logs\3proxy\%Y%m%d.log" D' | Out-File -FilePath $cfg_file -Append -Encoding ASCII
|
|
'rotate 30' | Out-File -FilePath $cfg_file -Append -Encoding ASCII
|
|
|
|
# Start 3proxy in the background
|
|
Start-Process -FilePath '.\3proxy.exe' -ArgumentList $cfg_file -NoNewWindow
|