SOCKS5 vs HTTP Proxy
Page explaining the pros and cons of using SOCKS5 vs HTTP
Last updated
Was this helpful?
Was this helpful?
curl -x socks5://customer-username:password@proxy.goproxies.com:10003 https://ipinfo.ioimport fetch from "node-fetch";
import { SocksProxyAgent } from "socks-proxy-agent";
const agent = new SocksProxyAgent("socks5://customer-username:password@proxy.goproxies.com:10003");
const res = await fetch("https://ipinfo.io", { agent });
console.log(await res.text());import requests
proxies = {
'http': 'socks5://customer-username:password@proxy.goproxies.com:10003',
'https': 'socks5://customer-username:password@proxy.goproxies.com:10003'
}
response = requests.get("https://ipinfo.io", proxies=proxies)
print(response.text)
package main
import (
"fmt"
"io"
"net/http"
"golang.org/x/net/proxy"
)
func main() {
auth := proxy.Auth{
User: "customer-username",
Password: "password",
}
dialer, _ := proxy.SOCKS5("tcp", "proxy.goproxies.com:10003", &auth, proxy.Direct)
httpTransport := &http.Transport{
Dial: dialer.Dial,
}
client := &http.Client{Transport: httpTransport}
resp, _ := client.Get("https://ipinfo.io")
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}import java.net.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws Exception {
Proxy proxy = new Proxy(Proxy.Type.SOCKS,
new InetSocketAddress("proxy.goproxies.com", 10003));
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("customer-username", "password".toCharArray());
}
});
URL url = new URL("https://ipinfo.io");
URLConnection conn = url.openConnection(proxy);
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
System.out.println(in.readLine());
}
}require 'socksify/http'
uri = URI("https://ipinfo.io")
Net::HTTP.SOCKSProxy("proxy.goproxies.com", 10003, "customer-username", "password")
.start(uri.host, uri.port, use_ssl: true) do |http|
res = http.get(uri)
puts res.body
end<?php
$ch = curl_init("https://ipinfo.io");
curl_setopt_array($ch, [
CURLOPT_PROXY => "socks5://proxy.goproxies.com:10003",
CURLOPT_PROXYUSERPWD => "customer-username:password",
CURLOPT_RETURNTRANSFER => true
]);
echo curl_exec($ch);
curl_close($ch);