Documentation Python quickstart Blog Free tools Enterprise solutions hello@quanticdata.ioLog in

Windows, Linux, macOS · SOCKS5 and HTTP · 5 steps

Xray SOCKS Outbound Example: A SOCKS5 or HTTP Proxy with Username and Password

An Xray config for a proxy with a login needs two local inbounds and one outbound: a socks inbound on 127.0.0.1:10808 and an http inbound on 127.0.0.1:10809 for your programs, and a socks or http outbound whose servers entry holds address, port and a users list with user and pass. Test the file with xray run -test, start it with xray run and send a request through the local port. Tested in Xray 26.11.9.

Set up the proxy in Xray

Open Xray, follow the 5 moves below and finish with the tool's own check. The values are in the table after the steps.

  1. 01

    Write config.json

    Download the Xray release for your system from the project's own releases page, github.com/XTLS/Xray-core/releases, the repository the Xray documentation links to. We used Xray-windows-64.zip of v26.11.9 and compared its SHA-256 with the .dgst file published next to it, then unzipped it into a folder of its own, C:\xray in this guide. Next to xray.exe, save the file below as config.json with your own address, port, user and pass. It has no routing block: Xray sends everything to the first outbound in the list, and here there is only one.

    {
      "log": { "loglevel": "info" },
      "inbounds": [
        { "tag": "socks-in", "listen": "127.0.0.1", "port": 10808, "protocol": "socks", "settings": { "udp": false } },
        { "tag": "http-in", "listen": "127.0.0.1", "port": 10809, "protocol": "http" }
      ],
      "outbounds": [
        {
          "tag": "quanticdata",
          "protocol": "socks",
          "settings": {
            "servers": [
              {
                "address": "residentialpremium.quanticdata.io",
                "port": 1080,
                "users": [ { "user": "USER-country-us-sid-k3f9a1b2-ttl-60m", "pass": "PASS" } ]
              }
            ]
          }
        }
      ]
    }
    Windows terminal in the Xray folder: Xray 26.11.9, the config.json with a socks inbound on 127.0.0.1:10808, an http inbound on 10809 and a framed socks outbound to residentialpremium.quanticdata.io port 1080, then Configuration OK from the test
    Windows terminal in the Xray folder: Xray 26.11.9, the config.json with a socks inbound on 127.0.0.1:10808, an http inbound on 10809 and a framed socks outbound to residentialpremium.quanticdata.io port 1080, then Configuration OK from the test.
  2. 02

    Test the file

    Run .\xray.exe run -test -c .\config.json. Xray reads the file and ends with Configuration OK. A missing comma stops it with failed to read config file and the line and character, at line 16 char 13 in our run. The test reads the file only: it does not contact the gateway.

  3. 03

    Start Xray

    Run .\xray.exe run -c .\config.json. The log shows listening tcp on 127.0.0.1:10808, the same for 10809, and Xray 26.11.9 started. Leave the window open: closing it stops the proxy. Each request then appears as accepted, with the route in brackets, [http-in >> quanticdata] or [socks-in >> quanticdata].

    Xray run log on Windows: listening on 127.0.0.1:10808 and 10809, Xray 26.11.9 started, then two framed lines, ipinfo.io accepted through http-in to quanticdata and api.ipify.org accepted through socks-in to quanticdata
    Xray run log on Windows: listening on 127.0.0.1:10808 and 10809, Xray 26.11.9 started, then two framed lines, ipinfo.io accepted through http-in to quanticdata and api.ipify.org accepted through socks-in to quanticdata.
  4. 04

    Send a request through it and read the exit IP

    In a second window run curl.exe -s -x http://127.0.0.1:10809 https://ipinfo.io/json, or use socks5h://127.0.0.1:10808 for the socks inbound. Our residential line answered from a Charter Communications home connection in New York, and 12 requests in a row, six through each inbound, returned the same exit address.

    curl through the Xray http inbound on 127.0.0.1:10809: ipinfo.io returns a United States address in University Gardens, New York, framed with the IP hidden, and api.ipify.org through the socks inbound on 10808 returns one address
    curl through the Xray http inbound on 127.0.0.1:10809: ipinfo.io returns a United States address in University Gardens, New York, framed with the IP hidden, and api.ipify.org through the socks inbound on 10808 returns one address.
  5. 05

    Switch to an http outbound for a mobile line

    For the HTTP port of a plan, change "protocol" to "http" and the port to the HTTP port; the servers entry keeps the same address, port and users keys. Our second file pointed at mobile.quanticdata.io on 8080 with a mobile username, and the same curl returned a T-Mobile USA address in Pennsylvania.

    config-mobile.json with an http outbound to mobile.quanticdata.io port 8080 and a placeholder mobile username, framed, and curl through 127.0.0.1:10809 returning a T-Mobile USA exit in Philadelphia, Pennsylvania with the IP hidden
    config-mobile.json with an http outbound to mobile.quanticdata.io port 8080 and a placeholder mobile username, framed, and curl through 127.0.0.1:10809 returning a T-Mobile USA exit in Philadelphia, Pennsylvania with the IP hidden.

Check it

curl.exe -s -x http://127.0.0.1:10809 https://ipinfo.io/json while Xray runs. The ip and org fields must be the exit of your line, and the Xray window shows the request as accepted with [http-in >> quanticdata].

Point any program at 127.0.0.1:10809 as an HTTP proxy or at 127.0.0.1:10808 as a SOCKS5 proxy, with no login: Xray adds the QuanticData login on the way out. Xray 26.11.9 for Windows is shown.

Xray HTTP outbound: the same servers entry

The http outbound takes the same settings as the socks outbound: a servers list with address, port and users, each user with user and pass. Only the protocol and the port change, as below. We ran both protocols on Residential Premium and on Mobile, and an http outbound on Residential Basic with the host and port of its own line: all five files passed the test and returned a United States exit.

{
  "tag": "quanticdata",
  "protocol": "http",
  "settings": {
    "servers": [
      {
        "address": "mobile.quanticdata.io",
        "port": 8080,
        "users": [ { "user": "USER-country-us-type-mobile-sid-k3f9a1b2-ttl-60m", "pass": "PASS" } ]
      }
    ]
  }
}

Which QuanticData line to use in Xray

  • Mobile: carrier IPs, T-Mobile USA in our run, for traffic that should look like a phone. Host mobile.quanticdata.io, HTTP 8080 or SOCKS5 1080, country and session in the username.
  • Residential Premium: home IPs by country, with the session name and its length set in the username. Host residentialpremium.quanticdata.io, HTTP 8080 or SOCKS5 1080. In our run 12 of 12 requests in one session left from the same address.
  • Residential Basic: home IPs with the host and port printed in the line. Its HTTP line ran as an http outbound and answered from a home connection in Ohio.
  • ISP: one dedicated IP for a server or a long-running job that must keep its address. The line comes from the plan page.

What xray run -test checks

The test is a syntax check. We changed the file on purpose to see what it reports.

  • A missing comma: failed to read config file at line 16 char 13, with the character that was not expected. Fix the line it names.
  • A key Xray does not know inside users, "username" in place of "user": Configuration OK all the same. The test does not flag it, so compare the keys with the file above: user and pass, inside users, inside servers.
  • Nothing listens on the port: the program is not pointed at 127.0.0.1:10808 or 10809, or the Xray window was closed.
  • The country is not the one you wanted: the country is part of the username (country-us). Generate a new line with the right country rather than editing the string.
  • Still failing: log in and ask Quantic AI in the dashboard. It tests your line from our side with your own login and tells you what the gateway answered.

What to type: ports and the username

Copy the line from the dashboard (Proxies, your plan, the generator) rather than typing it: it already carries the host, the country, the session id and the session length. The table shows what each field holds.

PlanCopy it fromHTTP portSOCKS5 portUsername shape
Residential Premiumthe generator80801080USER-country-us-sid-k3f9a1b2-ttl-30m
Mobilethe generator80801080USER-country-us-type-mobile-sid-a1b2c3-ttl-30m
Residential Basicthe generatorin the linein the lineUSER-country-us plus a session for sticky
Datacenter (per GB)the generator999910000the line's username
IPv6the generator1001in the linethe line's username
ISP (dedicated IP)the plan page, one line per IPin the linein the linethe line's own login

The host and the password are in the same line. Pick HTTP or SOCKS5 in the tool and use the port of that column; a port from the other column is the most common reason a check fails. On Premium ISP city plans one port serves both types. USER and the session id stand for your own values.

Where the line comes from in the dashboard

  • QuanticData Buy proxies page, Residential tab: Residential Premium packs from $4.00 for 1 GB to 25 GB for $70.00 with the price per GB of each
    Residential and Mobile are bought by the gigabyte: Residential Premium from $4 for 1 GB down to $2.20 per GB at 500 GB.
  • QuanticData Buy proxies page, Mobile tab: packs from $5.00 for 1 GB to $1,150 for 500 GB, all valid 90 days, HTTP and SOCKS5
    Mobile: $5 for 1 GB, valid 90 days, down to $2.30 per GB at 500 GB.
  • QuanticData residential plan generator with country United States, Max pool, Sticky session of 30 minutes, HTTP, 10 sessions and the host:port:user:pass output format
    The plan page has the generator: country, pool, Sticky session with its TTL, HTTP or SOCKS5, then one line per profile in host:port:user:pass.

The whole buying flow, both routes and the prices are on the integrations page.

Xray proxy questions

What customers ask when they put a QuanticData line into Xray.

Something else? Ask us

How do I set a SOCKS5 proxy with a username and password as an Xray outbound?

Add an outbound with "protocol": "socks" and, in settings, a servers list with one entry: address, port and a users list holding one object with user and pass. With a socks inbound on 127.0.0.1:10808 and an http inbound on 10809, your programs get a local proxy without a login.

Does Xray support an HTTP proxy as an outbound?

Yes, with "protocol": "http" and the same servers entry. We tested it on the QuanticData mobile gateway, port 8080, and the exit was a T-Mobile USA address in Pennsylvania.

Do I need a routing block for one outbound?

No. Our file has no routing block and every request went to the only outbound: the log printed default route and then [http-in >> quanticdata] or [socks-in >> quanticdata].

How do I check an Xray config before starting it?

Run xray run -test -c config.json. It ends with Configuration OK when the file can be read, or with failed to read config file and the line and character of the mistake. It reads the file only and sends nothing to the proxy.

Can I use the same outbound in 3X-UI?

Yes. 3X-UI runs Xray and has a form for it: Outbounds, + Outbounds, protocol socks or http, then Address, Port, Username and Password. Our 3X-UI guide shows the form and the routing rule.

Give Xray a home or mobile exit

Create an account, take the free 100 MB residential trial or a mobile pack, generate one sticky line and put it in the outbound.

Balance, crypto, card or PayPal · no VAT from the balance or crypto