فهرست منبع

Add files via upload

Samrand Hassan 2 سال پیش
والد
کامیت
87f83a2e71
4فایلهای تغییر یافته به همراه606 افزوده شده و 0 حذف شده
  1. 434 0
      cloudflare_ip_list.txt
  2. 59 0
      docker-compose.yml
  3. 72 0
      setup.py
  4. 41 0
      vmess.py

+ 434 - 0
cloudflare_ip_list.txt

@@ -0,0 +1,434 @@
+23.227.37.0/24
+23.227.38.0/23
+23.227.60.0/24
+64.68.192.0/24
+65.110.63.0/24
+66.235.200.0/24
+68.67.65.0/24
+91.234.214.0/24
+103.21.244.0/24
+103.22.201.0/24
+103.22.202.0/23
+103.81.228.0/24
+104.16.0.0/13
+104.24.0.0/14
+104.28.0.0/15
+104.30.1.0/24
+104.30.2.0/23
+104.30.4.0/22
+104.30.8.0/21
+104.30.16.0/20
+104.30.32.0/19
+104.30.64.0/18
+104.30.128.0/17
+104.31.0.0/16
+108.162.192.0/20
+108.162.210.0/23
+108.162.212.0/23
+108.162.216.0/23
+108.162.218.0/24
+108.162.235.0/24
+108.162.236.0/22
+108.162.240.0/21
+108.162.248.0/23
+108.162.250.0/24
+108.162.255.0/24
+141.101.65.0/24
+141.101.66.0/23
+141.101.68.0/22
+141.101.72.0/22
+141.101.76.0/23
+141.101.82.0/23
+141.101.84.0/22
+141.101.90.0/24
+141.101.92.0/22
+141.101.96.0/21
+141.101.106.0/23
+141.101.108.0/23
+141.101.110.0/24
+141.101.112.0/20
+162.158.0.0/22
+162.158.4.0/23
+162.158.8.0/21
+162.158.16.0/20
+162.158.32.0/22
+162.158.36.0/23
+162.158.38.0/24
+162.158.40.0/21
+162.158.48.0/24
+162.158.51.0/24
+162.158.52.0/22
+162.158.56.0/22
+162.158.60.0/24
+162.158.62.0/23
+162.158.72.0/21
+162.158.80.0/23
+162.158.82.0/24
+162.158.84.0/22
+162.158.88.0/21
+162.158.96.0/21
+162.158.108.0/22
+162.158.112.0/23
+162.158.114.0/24
+162.158.117.0/24
+162.158.118.0/23
+162.158.124.0/22
+162.158.128.0/19
+162.158.160.0/20
+162.158.176.0/24
+162.158.178.0/23
+162.158.180.0/22
+162.158.184.0/22
+162.158.191.0/24
+162.158.192.0/22
+162.158.196.0/24
+162.158.198.0/23
+162.158.200.0/21
+162.158.208.0/22
+162.158.212.0/24
+162.158.214.0/23
+162.158.216.0/21
+162.158.224.0/20
+162.158.240.0/21
+162.158.248.0/22
+162.158.253.0/24
+162.158.255.0/24
+162.159.0.0/18
+162.159.64.0/21
+162.159.72.0/22
+162.159.76.0/23
+162.159.78.0/24
+162.159.128.0/17
+162.251.82.0/24
+172.64.0.0/15
+172.66.0.0/22
+172.66.40.0/21
+172.67.0.0/16
+172.68.0.0/19
+172.68.32.0/21
+172.68.40.0/22
+172.68.45.0/24
+172.68.46.0/23
+172.68.48.0/20
+172.68.64.0/20
+172.68.80.0/23
+172.68.83.0/24
+172.68.84.0/22
+172.68.88.0/21
+172.68.96.0/20
+172.68.112.0/21
+172.68.120.0/23
+172.68.123.0/24
+172.68.124.0/22
+172.68.128.0/21
+172.68.136.0/22
+172.68.140.0/23
+172.68.142.0/24
+172.68.144.0/21
+172.68.152.0/22
+172.68.161.0/24
+172.68.162.0/23
+172.68.164.0/22
+172.68.168.0/21
+172.68.176.0/23
+172.68.179.0/24
+172.68.180.0/22
+172.68.184.0/21
+172.68.196.0/22
+172.68.200.0/21
+172.68.208.0/21
+172.68.217.0/24
+172.68.218.0/23
+172.68.220.0/22
+172.68.224.0/20
+172.68.240.0/21
+172.68.248.0/22
+172.68.252.0/23
+172.68.255.0/24
+172.69.0.0/20
+172.69.16.0/24
+172.69.18.0/23
+172.69.20.0/22
+172.69.32.0/20
+172.69.48.0/24
+172.69.52.0/22
+172.69.56.0/21
+172.69.64.0/22
+172.69.72.0/21
+172.69.80.0/20
+172.69.96.0/21
+172.69.105.0/24
+172.69.106.0/23
+172.69.108.0/22
+172.69.112.0/21
+172.69.124.0/22
+172.69.128.0/20
+172.69.144.0/21
+172.69.156.0/22
+172.69.160.0/19
+172.69.192.0/20
+172.69.208.0/24
+172.69.210.0/23
+172.69.212.0/22
+172.69.216.0/21
+172.69.224.0/23
+172.69.227.0/24
+172.69.228.0/22
+172.69.232.0/21
+172.69.240.0/21
+172.69.248.0/24
+172.69.250.0/23
+172.69.252.0/22
+172.70.32.0/20
+172.70.48.0/23
+172.70.51.0/24
+172.70.52.0/22
+172.70.56.0/21
+172.70.80.0/20
+172.70.96.0/20
+172.70.112.0/22
+172.70.116.0/23
+172.70.120.0/21
+172.70.128.0/21
+172.70.136.0/23
+172.70.139.0/24
+172.70.140.0/22
+172.70.144.0/22
+172.70.148.0/23
+172.70.150.0/24
+172.70.152.0/22
+172.70.156.0/23
+172.70.158.0/24
+172.70.160.0/22
+172.70.172.0/22
+172.70.176.0/21
+172.70.185.0/24
+172.70.186.0/23
+172.70.188.0/22
+172.70.192.0/18
+172.71.0.0/24
+172.71.2.0/23
+172.71.4.0/22
+172.71.8.0/21
+172.71.16.0/23
+172.71.20.0/22
+172.71.24.0/21
+172.71.80.0/21
+172.71.88.0/23
+172.71.90.0/24
+172.71.92.0/22
+172.71.96.0/21
+172.71.108.0/22
+172.71.112.0/20
+172.71.128.0/21
+172.71.137.0/24
+172.71.138.0/23
+172.71.140.0/22
+172.71.144.0/20
+172.71.160.0/19
+172.71.192.0/18
+173.245.49.0/24
+173.245.54.0/24
+173.245.58.0/23
+173.245.63.0/24
+185.146.172.0/23
+188.114.96.0/22
+188.114.100.0/24
+188.114.102.0/23
+188.114.106.0/23
+188.114.108.0/24
+188.114.111.0/24
+190.93.240.0/20
+195.242.122.0/23
+197.234.240.0/22
+198.41.129.0/24
+198.41.192.0/20
+198.41.208.0/23
+198.41.211.0/24
+198.41.212.0/24
+198.41.214.0/23
+198.41.216.0/21
+198.41.224.0/21
+198.41.232.0/23
+198.41.236.0/22
+198.41.240.0/23
+198.41.242.0/24
+198.217.251.0/24
+199.27.128.0/22
+199.27.132.0/24
+5.226.179.0/24
+5.226.181.0/24
+12.221.133.0/24
+23.141.168.0/24
+23.178.112.0/24
+23.247.163.0/24
+31.43.179.0/24
+38.67.242.0/24
+45.8.104.0/22
+45.8.211.0/24
+45.12.30.0/23
+45.14.174.0/24
+45.80.111.0/24
+45.84.59.0/24
+45.85.118.0/23
+45.87.175.0/24
+45.94.169.0/24
+45.95.241.0/24
+45.131.4.0/22
+45.131.208.0/22
+45.133.247.0/24
+45.137.99.0/24
+45.142.120.0/24
+45.145.28.0/23
+45.158.56.0/24
+45.159.216.0/22
+64.21.2.0/24
+65.205.150.0/24
+66.81.247.0/24
+66.81.255.0/24
+72.52.113.0/24
+80.94.83.0/24
+89.47.56.0/23
+89.116.250.0/24
+89.207.18.0/24
+91.192.107.0/24
+91.193.58.0/23
+91.195.110.0/24
+91.199.81.0/24
+93.114.64.0/23
+95.214.178.0/23
+103.11.212.0/24
+103.11.214.0/24
+103.79.228.0/23
+103.112.176.0/24
+103.121.59.0/24
+103.156.22.0/23
+103.160.204.0/24
+103.168.172.0/24
+103.169.142.0/24
+103.172.111.0/24
+154.84.175.0/24
+103.204.13.0/24
+103.244.116.0/22
+154.85.9.0/24
+104.234.158.0/24
+104.254.140.0/24
+108.165.216.0/24
+154.85.99.0/24
+123.253.174.0/24
+141.11.194.0/23
+141.193.213.0/24
+146.19.22.0/24
+147.78.121.0/24
+147.78.140.0/24
+147.185.161.0/24
+154.51.129.0/24
+154.51.160.0/24
+154.83.2.0/24
+154.83.22.0/24
+154.83.30.0/24
+154.84.14.0/23
+154.84.16.0/24
+154.84.20.0/23
+154.84.24.0/24
+154.84.26.0/23
+154.219.3.0/24
+156.237.4.0/23
+156.238.14.0/24
+156.238.18.0/23
+156.239.152.0/23
+156.239.154.0/24
+159.112.235.0/24
+159.246.55.0/24
+160.153.0.0/24
+162.44.104.0/22
+168.100.6.0/24
+170.114.45.0/24
+170.114.46.0/24
+170.114.52.0/24
+172.83.72.0/23
+172.83.76.0/24
+185.207.92.0/24
+174.136.134.0/24
+176.126.206.0/23
+185.7.190.0/23
+185.18.250.0/24
+185.38.135.0/24
+185.59.218.0/24
+185.67.124.0/24
+185.72.49.0/24
+185.109.21.0/24
+185.135.9.0/24
+185.148.104.0/22
+185.162.228.0/22
+185.170.166.0/24
+185.174.138.0/24
+185.176.24.0/24
+185.176.26.0/24
+185.193.28.0/22
+185.201.139.0/24
+185.213.240.0/24
+185.213.243.0/24
+185.221.160.0/24
+185.234.22.0/24
+185.238.228.0/24
+185.244.106.0/24
+188.42.88.0/23
+188.244.122.0/24
+191.101.251.0/24
+192.65.217.0/24
+192.133.11.0/24
+193.9.49.0/24
+193.16.63.0/24
+193.17.206.0/24
+193.67.144.0/24
+193.188.14.0/24
+193.227.99.0/24
+194.1.194.0/24
+194.36.49.0/24
+194.36.55.0/24
+194.36.216.0/22
+194.40.240.0/23
+194.53.53.0/24
+194.152.44.0/24
+194.169.194.0/24
+195.85.23.0/24
+195.85.59.0/24
+195.137.167.0/24
+195.245.221.0/24
+196.13.241.0/24
+196.207.45.0/24
+199.60.103.0/24
+199.181.197.0/24
+199.212.90.0/24
+202.82.250.0/24
+203.13.32.0/24
+203.17.126.0/24
+203.19.222.0/24
+203.22.223.0/24
+203.23.103.0/24
+203.23.104.0/24
+203.23.106.0/24
+203.24.102.0/23
+203.24.108.0/23
+203.28.8.0/23
+203.29.52.0/22
+203.30.188.0/22
+203.32.120.0/23
+203.34.28.0/24
+203.34.80.0/24
+203.55.107.0/24
+203.89.5.0/24
+203.107.173.0/24
+203.193.21.0/24
+204.62.141.0/24
+204.68.111.0/24
+204.209.72.0/23
+205.233.181.0/24
+206.196.23.0/24
+207.189.149.0/24
+208.100.60.0/24
+212.24.127.0/24
+212.110.134.0/23
+212.239.86.0/24
+216.120.180.0/23

+ 59 - 0
docker-compose.yml

@@ -0,0 +1,59 @@
+version: '3'
+services:
+
+  nginx:
+    image: nginx:1.22
+    container_name: nginx
+    ports:
+      - '80:80'
+      - '443:443'
+    restart: always
+    volumes:
+      - '/var/run/docker.sock:/tmp/docker.sock:ro'
+      - './configs:/etc/nginx/conf.d'
+      - './certs:/etc/nginx/certs'
+      - './vhost:/etc/nginx/vhost.d'
+      - './html:/usr/share/nginx/html'
+      
+  dockergen:
+    image: 'jwilder/docker-gen:0.9'
+    container_name: dockergen
+    restart: always
+    command: >-
+      -notify-sighup nginx -watch /etc/docker-gen/templates/nginx.tmpl 
+      /etc/nginx/conf.d/default.conf
+    volumes:
+      - '/var/run/docker.sock:/tmp/docker.sock:ro'
+      - './configs/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl'
+      - './configs:/etc/nginx/conf.d'
+      - './certs:/etc/nginx/certs'
+      - './vhost:/etc/nginx/vhost.d'
+      - './html:/usr/share/nginx/html'
+      
+  nginx-proxy-acme:
+    restart: always
+    image: nginxproxy/acme-companion:2.2
+    container_name: nginx-proxy-acme
+    volumes:
+      - '/var/run/docker.sock:/var/run/docker.sock:ro'
+      - './acme:/etc/acme.sh'
+      - './configs:/etc/nginx/conf.d'
+      - './certs:/etc/nginx/certs'
+      - './vhost:/etc/nginx/vhost.d'
+      - './html:/usr/share/nginx/html'
+    environment:
+      - DEFAULT_EMAIL=YOUR_EMAIL
+      - NGINX_PROXY_CONTAINER=nginx
+      - NGINX_DOCKER_GEN_CONTAINER=dockergen
+      
+  v2ray:
+    image: v2fly/v2fly-core:v4.45.2
+    container_name: v2ray
+    restart: always
+    environment:
+      - v2ray.vmess.aead.forced=false
+      - VIRTUAL_HOST=YOUR_DOMAIN
+      - LETSENCRYPT_HOST=YOUR_DOMAIN
+      - VIRTUAL_PORT=1310
+    volumes:
+      - './v2ray/config:/etc/v2ray/'

+ 72 - 0
setup.py

@@ -0,0 +1,72 @@
+#!/usr/bin/python3
+
+import uuid
+import json
+import yaml
+from pathlib import Path
+
+sslEnable = False
+
+# LOAD CONFIG FILES
+
+v2rayConfigPath = Path(__file__).parent.joinpath('v2ray/config/config.json')
+dockerComposePath = Path(__file__).parent.joinpath('docker-compose.yml')
+file = open(str(v2rayConfigPath), 'r', encoding='utf-8')
+config = json.load(file)
+with open(str(dockerComposePath), 'r') as f:
+    dockerComposeObject = yaml.safe_load(f)
+
+
+# INPUT: UPSTREAM UUID
+
+defaultUUID = config['inbounds'][0]['settings']['clients'][0]['id']
+
+if defaultUUID == '<UPSTREAM-UUID>':
+    message = "Upstream UUID: (Leave empty to generate a random one)\n"
+else:
+    message = f"Upstream UUID: (Leave empty to use `{defaultUUID}`)\n"
+
+upstreamUUID = input(message)
+if upstreamUUID == '':
+    if defaultUUID == '<UPSTREAM-UUID>':
+        upstreamUUID = str(uuid.uuid4())
+    else:
+        upstreamUUID = defaultUUID
+
+# INPUT: Nginx configs
+
+message = "Enter your domain without http or https: (for example: test.com)\n"
+domain = input(message)
+message = "Enable SSL for this domain? type 'yes' or 'no'. Default is no. if you are using CDN, ignore this.\n"
+isSSLEnable = input(message)
+if isSSLEnable == 'yes':
+    sslEnable = True
+    message = "Enter your email for letsencrypt:\n"
+    email = input(message)
+
+
+# SAVE CONFIG FILES
+
+config['inbounds'][0]['settings']['clients'][0]['id'] = upstreamUUID
+dockerComposeObject["services"]["v2ray"]["environment"][1] = f'VIRTUAL_HOST={domain}'
+dockerComposeObject["services"]["v2ray"]["environment"][2] = f'LETSENCRYPT_HOST='
+dockerComposeObject["services"]["nginx-proxy-acme"]["environment"][0] = f'DEFAULT_EMAIL='
+if isSSLEnable == 'yes':
+    dockerComposeObject["services"]["v2ray"]["environment"][2] = f'LETSENCRYPT_HOST={domain}'
+    dockerComposeObject["services"]["nginx-proxy-acme"]["environment"][0] = f'DEFAULT_EMAIL={email}'
+
+content = json.dumps(config, indent=2)
+open(str(v2rayConfigPath), 'w', encoding='utf-8').write(content)
+open(str(dockerComposePath), 'w', encoding='utf-8').write(yaml.dump(dockerComposeObject, default_flow_style=False))
+
+# PRINT OUT RESULT
+
+print(f'\n---------\nUpstream UUID: {upstreamUUID}')
+print(f'Domain: {domain}')
+if isSSLEnable == 'yes':
+    print('SSL: enabled')
+    print(f'Email: {email}')
+print('---------\n')
+print('\nDone!')
+print('- Run docker-compose up -d for bringing up services')
+print('- Run ./vmess.py to get your vmess links to share and import in clients\n')

+ 41 - 0
vmess.py

@@ -0,0 +1,41 @@
+#!/usr/bin/python3
+
+import base64
+import yaml
+import json
+from pathlib import Path
+import random
+import ipaddress
+
+def config_generator(domain, uuid, ip=""):
+    if ip == "":
+        ip = domain
+    name = domain
+    j = json.dumps({
+        "v": "2", "ps": name, "add": ip, "port": "443", "id": uuid,
+        "aid": "0", "net": "ws", "type": "none", "sni": domain,
+        "host": domain, "path": "/", "tls": "tls"
+    })
+    return("vmess://" + base64.b64encode(j.encode('ascii')).decode('ascii'))
+
+
+path = Path(__file__).parent
+v2ray_config_file = open(str(path.joinpath('v2ray/config/config.json')), 'r', encoding='utf-8')
+v2ray_config = json.load(v2ray_config_file)
+with open(str(path.joinpath('docker-compose.yml')), 'r') as f:
+    dockerCompose = yaml.safe_load(f)
+
+uuid = v2ray_config['inbounds'][0]['settings']['clients'][0]['id']
+domain = dockerCompose["services"]["v2ray"]["environment"][1].split('=')[1];
+isUsingCloudFlareCDNProxy = 'no'
+
+isUsingCloudFlareCDNProxy = input("Are you using CloudFlare CDN Proxy? type 'yes' or 'no'. Default is no.\n")
+if isUsingCloudFlareCDNProxy == 'yes':
+    for line in open(str(path.joinpath('cloudflare_ip_list.txt')), 'r'):
+        tempIpList = []
+        for tempIP in ipaddress.IPv4Network(str(line).strip()):
+            tempIpList.append(tempIP)
+        finalIP = str(random.choice(tempIpList)).strip()
+        print(config_generator(domain, uuid, finalIP)+ "\n")
+else:
+    print(config_generator(domain, uuid))