Skip to content

Commit

Permalink
add v2ray single
Browse files Browse the repository at this point in the history
  • Loading branch information
miladrahimi committed Jun 14, 2024
1 parent fb45139 commit 84c300e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
20 changes: 20 additions & 0 deletions v2ray-single-server/clients.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/python3

import base64
import json
from pathlib import Path
from urllib.request import urlopen

path = Path(__file__).parent
file = open(str(path.joinpath('v2ray.json')), 'r', encoding='utf-8')
config = json.load(file)

ip = urlopen("https://ipv4.icanhazip.com/").read().decode().rstrip()

for inbound in config['inbounds']:
if inbound['protocol'] == 'shadowsocks':
port = str(inbound['port'])
method = inbound['settings']['method']
password = inbound['settings']['password']
security = base64.b64encode((method + ":" + password).encode('ascii')).decode('ascii')
print("Shadowsocks: " + "ss://{}@{}:{}".format(security, ip, port))
9 changes: 9 additions & 0 deletions v2ray-single-server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
v2ray:
image: ghcr.io/v2fly/v2ray:v5.16.1
restart: always
network_mode: "host"
environment:
- v2ray.vmess.aead.forced=false
volumes:
- ./v2ray.json:/etc/v2ray/config.json
30 changes: 30 additions & 0 deletions v2ray-single-server/v2ray.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"inbounds": [
{
"listen": "0.0.0.0",
"port": 8000,
"protocol": "shadowsocks",
"settings": {
"password": "<UPSTREAM-PASSWORD>",
"method": "chacha20-ietf-poly1305",
"network": "tcp,udp"
}
}
],
"outbounds": [
{
"protocol": "freedom",
"tag": "freedom"
}
],
"dns": {
"servers": [
"8.8.8.8",
"8.8.4.4",
"localhost"
]
},
"log": {
"loglevel": "warning"
}
}

0 comments on commit 84c300e

Please sign in to comment.