> ## Documentation Index
> Fetch the complete documentation index at: https://help.decodo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Protocols

> Residential Proxy Support for HTTP, HTTPS, and SOCKS5 Formats

The connection protocol (`HTTP`, `HTTPS`, or `SOCKS5`) can be specified in the tool or program you're using to connect with the proxies.

In the following `cURL` examples, the protocol is specified at the beginning of the proxy line, just replace the `username` and `password` with your proxy user credentials, and run them in your Terminal or Command Prompt.

## HTTP

Here is a `cURL` example for the `HTTP` protocol:

```shellscript cURL theme={null}
curl -x "http://username:password@gate.decodo.com:7000" "https://ip.decodo.com/json"
```

## HTTPS

Using this protocol will **encrypt** your connection. Here is a `cURL` example for the `HTTPS` protocol:

```shellscript cURL theme={null}
curl -x "https://username:password@gate.decodo.com:7000" "https://ip.decodo.com/json"
```

## SOCKS5

Here is a `cURL` command for the `SOCKS5` protocol:

```shellscript cURL theme={null}
curl -x "socks5h://user-username-session-1:password@gate.decodo.com:7000" "https://ip.decodo.com/json"
```

<Note>
  The letter `h` in `socks5h://` means that the hostname will be resolved on the proxy side, and not locally.
</Note>

<Warning>
  ### Country Endpoint Support

  Note that you have to use the `gate.decodo.com` endpoint to use `SOCKS5`. Country endpoints like `us.decodo.com` will not work!

  You can instead target specific locations by specifying the location using [**Advanced Parameters**](https://help.decodo.com/docs/residential-proxy-advanced-parameters#/). For example, this `cURL` command targets the US location:

  ```shellscript theme={null}
  curl -U "user-username-country-us:password" -x "socks5h://gate.decodo.com:7000" "https://ip.decodo.com/json"
  ```
</Warning>

<Warning>
  ### Tool Support

  * To get a sticky `SOCKS5` proxy in a **tool**, you must use a `session` parameter, otherwise, the proxy will always rotate even with a `sessionduration` parameter.
  * The **session ID** can be defined by any string of your choice. More on that can be found on the [**Advanced Parameters**](https://help.decodo.com/docs/residential-proxy-advanced-parameters) page in the **Sticky session** section.
</Warning>

## HTTP/3

`HTTP/3` protocol is running over QUIC (UDP) traffic that is being tunneled through `SOCKS5`. `HTTP `and` HTTPS` endpoints are not supported with `HTTP/3.`

Use the `socks5-gate.decodo.com` endpoint on port `10000` for `HTTP/3`, and just replace the `username` and `password` with your proxy user credentials copied from your dashboard.

Here is a script in `Go`, which performs an `HTTP/3` request through the proxy:

<CodeGroup>
  ```go Go expandable theme={null}
  mkdir -p ~/http3-test && cd ~/http3-test
   
  cat > main.go <<'EOF'
  package main
   
  import (
      "bytes"
      "context"
      "crypto/tls"
      "flag"
      "fmt"
      "io"
      "log/slog"
      "net"
      "net/http"
      "time"
   
      "github.com/quic-go/quic-go"
      "github.com/quic-go/quic-go/http3"
      "github.com/txthinking/socks5"
  )
   
  var (
      proxyUsername = flag.String("u", "", "proxy username")
      proxyPassword = flag.String("p", "", "proxy password")
      proxyHost     = flag.String("h", "socks5-gate.decodo.com:10000", "proxy host with port")
      remoteHost    = flag.String("t", "udp-test.decodo.com", "target host")
      payload       = flag.String("body", "", "optional request body")
  )
   
  type SOCKS5PacketConn struct {
      net.Conn
      targetAddr net.Addr
  }
   
  func (s *SOCKS5PacketConn) ReadFrom(p []byte) (int, net.Addr, error) {
      n, err := s.Conn.Read(p)
      return n, s.targetAddr, err
  }
  func (s *SOCKS5PacketConn) WriteTo(p []byte, addr net.Addr) (int, error) {
      return s.Conn.Write(p)
  }
  func (s *SOCKS5PacketConn) LocalAddr() net.Addr { return s.Conn.LocalAddr() }
  func (s *SOCKS5PacketConn) SetDeadline(t time.Time) error { return s.Conn.SetDeadline(t) }
  func (s *SOCKS5PacketConn) SetReadBuffer(bytes int) error {
      if udpConn, ok := s.Conn.(interface{ SetReadBuffer(int) error }); ok {
          return udpConn.SetReadBuffer(bytes)
      }
      return nil
  }
  func (s *SOCKS5PacketConn) SetWriteBuffer(bytes int) error {
      if udpConn, ok := s.Conn.(interface{ SetReadBuffer(int) error }); ok {
          return udpConn.SetReadBuffer(bytes)
      }
      return nil
  }
   
  func HTTP3viaProxy(proxyUsername, proxyPassword, proxyHost, target, payload string) error {
      socks5Client, err := socks5.NewClient(proxyHost, proxyUsername, proxyPassword, 5, 5)
      if err != nil {
          return err
      }
      closeChan := make(chan struct{})
      defer func() { closeChan <- struct{}{} }()
      client := http.Client{
          Transport: &http3.Transport{
              Dial:            proxyDialer(closeChan, socks5Client),
              TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
          },
      }
      req, err := http.NewRequest(http.MethodGet, "https://"+target, bytes.NewReader([]byte(payload)))
      if err != nil {
          return err
      }
      resp, err := client.Do(req)
      if err != nil {
          return err
      }
      defer resp.Body.Close()
      res, err := io.ReadAll(resp.Body)
      if err != nil {
          return err
      }
      fmt.Println("Status: ", resp.StatusCode)
      fmt.Println("Protocol: ", resp.Proto)
      fmt.Printf("Response: \n%s", string(res))
      return nil
  }
   
  func proxyDialer(closeChan <-chan struct{}, socks5client *socks5.Client) func(ctx context.Context, addr string, tlsCfg *tls.Config, cfg *quic.Config) (*quic.Conn, error) {
      return func(ctx context.Context, addr string, tlsCfg *tls.Config, cfg *quic.Config) (*quic.Conn, error) {
          proxyConn, err := socks5client.Dial("udp", addr)
          if err != nil {
              return nil, err
          }
          go func() {
              <-closeChan
              if proxyConn != nil {
                  if err := proxyConn.Close(); err != nil {
                      slog.Error("Failed to close proxy connection", "error", err)
                  }
              }
          }()
          remoteAddr, err := net.ResolveUDPAddr("udp", addr)
          if err != nil {
              return nil, err
          }
          socks5PacketConn := &SOCKS5PacketConn{Conn: proxyConn, targetAddr: remoteAddr}
          deadline := time.Now().Add(40 * time.Second)
          if err = proxyConn.SetReadDeadline(deadline); err != nil {
              return nil, err
          }
          if err = proxyConn.SetWriteDeadline(deadline); err != nil {
              return nil, err
          }
          earlyConn, err := quic.DialEarly(ctx, socks5PacketConn, remoteAddr, tlsCfg, cfg)
          if err != nil {
              return nil, err
          }
          return earlyConn, nil
      }
  }
   
  func main() {
      flag.Parse()
      start := time.Now()
      if err := HTTP3viaProxy(*proxyUsername, *proxyPassword, *proxyHost, *remoteHost, *payload); err != nil {
          slog.Error("failed to perform HTTP3 request via proxy", "error", err)
      }
      fmt.Printf("Request took: %d ms\n", time.Since(start).Milliseconds())
  }
  EOF
   
  go mod init http3-test
  go get github.com/quic-go/quic-go github.com/quic-go/quic-go/http3 github.com/txthinking/socks5
  go run main.go
  ```
</CodeGroup>

# Ports

Easily understand which ports you can access when using our proxies, including details on the default accessible ports, restrictions, and how to request a port to be unblocked.

### Accessible Ports

With the **residential** and **mobile** proxies, the following ports are accessible by default:

* `80`
* `443`

### Restricted Ports

<Warning>
  Restricted ports include `SMTP`, `IMAP`, and other **mailing** and **messaging**-related ports.
</Warning>

### Port Unblocking Process

To request a port unblock, contact us at [**compliance@decodo.com**](mailto:compliance@decodo.com) and provide the following information:

* The **port** that needs to be unblocked.
* Describe the **use case** with that port – **be as specific as possible**.
* Provide the **target** that you’ll access using the mentioned port.

For added security, particularly for requests involving sensitive or high-risk ports, we’ll require the user to provide **company details** or complete ID verification to complete the unblocking request.

<Note>
  Please note that certain ports, such as those categorized as restricted, cannot be unblocked. Although the specific ports aren't mentioned in this article, your request to unblock them may be denied.
</Note>

***
