Coder Social home page Coder Social logo

xtls-reality-docker's Introduction

XTLS-reality-docker

This is a simple docker image which starts up in just a few seconds and launch a proxy-server ready to accept client connections. This proxy-server does not encrypt your data, but it can masquerade your traffic as a regular TLS-connection. To unauthorized users your proxy-server will look like a harmless site.

To get it running, just copy & paste the snippet below in your terminal:

sudo docker run -d --rm -p 443:443 -v xtls-reality-volume:/opt/xray/config --name xtls-reality myelectronix/xtls-reality

The XTLS-Reality proxy server will be up and ready to accept connections on port 443.

To get more detailed information, go to Quick Start.

Sources

Name URL
GitHub https://github.com/myelectronix/xtls-reality-docker
Docker Hub https://hub.docker.com/r/myelectronix/xtls-reality
XTLS GitHub https://github.com/XTLS
Habr https://habr.com/ru/articles/731608/

Container properties

Environment variables

Variable Description Default value
SNI A website address for masquerade. It must support TLSv1.3 and HTTP/2 www.samsung.com
SHORT_ID Short ID. You can generate any 32-bit number in HEX-format aabbccdd

Container commands

After container was run using docker run or docker compose up command, it's possible to execute additional commands using docker exec command. For example, sudo docker exec xtls-reality bash get-client-qr.sh. See table below to get the full list of supported commands.

Command Description
get-client-qr.sh Outputs a QR-code with client settings. You can scan this code by a mobile application (for exampe, v2rayNG) and get a quick connection.
get-client-settings.sh Outputs a client settings in text form
regenerate-client-settings.sh Generate a new UUID, Private and Public key. Docker container must be reload

Quick Start

1. Prerequisites

  1. Any hardware or vps/vds server running Linux. You must have administrative rights on this machine.
  2. Docker installation on your server.For more information please see https://docs.docker.com/engine/install/
  3. Your server must have a public IP-address

2. XTLS-reality proxy server run

You can run XTLS-reality proxy server in two ways of your choice: docker run or docker compose.

2.1. Docker run

Pull the latest version of XTLS-reality-docker image:

sudo docker pull myelectronix/xtls-reality:latest

Copy & paste the following command to run XTLS-reality-docker:

sudo docker run -d --rm  \
-p 443:443 \
-e SNI=YOUR_SNI \
-e SHORT_ID=YOUR_SHORT_ID \
-v xtls-reality-volume:/opt/xray/config \
--name xtls-reality myelectronix/xtls-reality:latest

⚠️ Note: You must specify the desired values instead YOUR_SNI and YOUR_SHORT_ID. You can skip these lines in the command, in this case the default values will be used.

To check a status of the container you can execute the following command

sudo docker ps

The output should look like this

CONTAINER ID   IMAGE                       COMMAND                  CREATED         STATUS                                        PORTS                                   NAMES
82d35a13b672   myelectronix/xtls-reality   "/bin/bash ./entrypo…"   8 seconds ago   Up 7 seconds                                  0.0.0.0:443->443/tcp, :::443->443/tcp   xtls-reality

2.2. Docker compose

The another way of start up XTLS-reality proxy-server is docker compose. Docker compose saves all startup options in a special file and can automatically restart containers if they fail. Firts of all you must install docker compose plugin. For more information please see https://docs.docker.com/compose/install/linux/

After install docker compose plugin clone this git repository:

git clone https://github.com/myelectronix/xtls-reality-docker

Change your work directory and run docker compose

cd xtls-reality-docker
docker compose up -d

⚠️ Note: You can specify the desired values SNI and SHORT_ID in docker-compose.yaml file before launch docker compose or leave a default values.

To check a status of the container you can execute the following command

sudo docker ps

The output should look like this

CONTAINER ID   IMAGE                       COMMAND                  CREATED         STATUS                                        PORTS                                   NAMES
82d35a13b672   myelectronix/xtls-reality   "/bin/bash ./entrypo…"   8 seconds ago   Up 7 seconds                                  0.0.0.0:443->443/tcp, :::443->443/tcp   xtls-reality

3. Get client configuration

After run XTLS-reality docker you can get a settings for client connection. You have a two ways for get connection: QR-code or text form. To get the QR code, run the following command

sudo docker exec xtls-reality bash get-client-qr.sh

The result will be a generated QR-code in your terminal as shown below

To get the text form settings, run the following command

sudo docker exec xtls-reality bash get-client-settings.sh

The result will be a text settings in your terminal as shown below

IP Address: XXX.XXX.XXX.XXX
UUID: e4a047bb-fd0a-4742-b52d-4ef83fae4ef2
Public key: gF5RvoxnC5btsqZ9YvNLtH-gaUfcrDXDLif-NM7oFQ4
SNI: www.samsung.com
ShortID: aabbccdd

4. Connecting Clients

You can use various proxy client programs to connect to your XTLS reality proxy.

If you use windows you can use NekoBox

In NekoBox window select Preferences - Basic Settings - Core and set sing-box button

Then select Server - New Profile - VLESS and set the settings according to the picture below, use your IP-address, UUID, SNI, Public key and ShortID.

Then save the settings and launch your proxy. For testing the connection use Current Select - URL Test

If you use android you can install v2rayNG

To connection v2rayNG select Import config from QRcode and scan QR-code with your settings.

As a result you should have a new connection in the list.

Activate it and use your XTLS-reality proxy.

Stop and remove

To stop and remove your XTLS-reality-docker container execute the following command

sudo docker rm --force xtls-reality 

Your settings (UUID, Private and Public keys) storaged in special docker volume. So they won't change when you delete a container and start a new one. If you desire remove all your settings execute the following command after stop and remove docker container.

sudo docker volume rm xtls-reality-volume 

xtls-reality-docker's People

Contributors

myelectronix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

xtls-reality-docker's Issues

linux/arm64 support ?

I got

standard_init_linux.go:228: exec user process caused: exec format error

while running on my linux/arm64/v8 machine

Doesn't work on shadow rocket (iphone)

I'm a expirenced backend programmer.

After scanning the QR code, there do have a MyVLESS config in shadowrocket server list.

But we I try to reach any website, the page just doesn't loaded.

test:

  1. visit by HTTP, I can see the 400 cloudflare fake page
  2. monitor on specific port by tcpdump, there do have some traffic.

by the way, I have the port mapping like this way: 12443:443,
it won't generally affect the result right?

here is my docker compose file:

version: '3.8'
services:
  xtls-reality:
    image:  myelectronix/xtls-reality:latest
    environment:
      - SNI=external.hdcjh.xyz
      - SHORT_ID=32f89a0f
    container_name: xtls-reality
    restart: always
    ports:
      - "443:443"
    volumes:
      - xtls-reality-volume:/opt/xray/config

volumes:
  xtls-reality-volume:
    external: true
    name: xtls-reality-volume

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.