Created
April 18, 2025 05:18
-
-
Save canbingzt/e47909cca705c0b42515b7a569f600f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function proxy { | |
| $env:http_proxy = "http://127.0.0.1:7890" | |
| $env:https_proxy = "http://127.0.0.1:7890" | |
| [System.Net.WebRequest]::DefaultWebProxy = New-Object System.Net.WebProxy ("http://127.0.0.1:7890") | |
| Write-Host "Proxy enabled: http://127.0.0.1:7890" -ForegroundColor Green | |
| } | |
| function unproxy { | |
| $env:http_proxy = $null | |
| $env:https_proxy = $null | |
| [System.Net.WebRequest]::DefaultWebProxy = $null | |
| Write-Host "Proxy disabled" -ForegroundColor Yellow | |
| } | |
| function check-proxy { | |
| if ($env:http_proxy -or $env:https_proxy) { | |
| Write-Host "Current proxy settings:" -ForegroundColor Cyan | |
| Write-Host "HTTP Proxy: $env:http_proxy" | |
| Write-Host "HTTPS Proxy: $env:https_proxy" | |
| } else { | |
| Write-Host "No proxy is currently set." -ForegroundColor Cyan | |
| } | |
| } | |
| Remove-Item alias:curl | |
| proxy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment