This commit is contained in:
quackerd 2021-02-01 01:30:13 -05:00
parent a0fc3bebf9
commit 443353235f
Signed by: d
GPG Key ID: F73412644EDE357A
4 changed files with 17 additions and 20 deletions

View File

@ -1,10 +1,4 @@
{
"log": {
"error": "error.log",
"loglevel": "warning",
"access": "access.log"
},
"dns": {
"servers": [
"223.5.5.5",
@ -84,7 +78,7 @@
"outbounds": [
{
"tag": "proxy",
"protocol": "vmess",
"protocol": "vless",
"settings": {
"vnext": [
{
@ -93,18 +87,20 @@
"users": [
{
"id": "{{ id }}",
"alterId": {{ alterid }},
"security": "none"
"encryption": "none",
"level": 0
}
]
}
]
},
"streamSettings": {
"network": "ws",
"security": "tls",
"wsSettings": {
"path": "{{ path }}"
"network": "tcp",
"security": "xtls",
"xtlsSettings": {
"serverName": "{{ subdomain }}.{{ domain }}",
"allowInsecure": false,
"alpn": ["h2","http/1.1"]
}
}
},

View File

@ -3,6 +3,9 @@ server:
domain: domain.tld
# subdomain: the subdomain name, e.g. write vps for vps.google.com. leave empty for naked domain.
subdomain: example
# loglevel: the loglevel of xray
# default: warning
loglevel:
# email: your email for the registered SSL cert. leave empty for a dummy email.
# default: dummy@dummy.org
email:
@ -14,9 +17,6 @@ server:
# path: the path for the websocket.
# default: auto-generated.
# comment: Do NOT include the leading slash.
path:
# watchtower: whether or not to enable watchtower to auto update docker containers
# default: False
watchtower: False
clients:

View File

@ -25,6 +25,7 @@ WATCHTOWER_IN = "watchtower.in"
DEFAULT_WATCHTOWER_ENABLE = False
DEFAULT_CLIENT_PORT = 1080
DEFAULT_USER_FLOW = "xtls-rprx-direct"
DEFAULT_LOGLEVEL= "warning"
def yaml_key_exists_else(mapping : [], name : str, other_val = None, nullable = True):
if (name in mapping) and (mapping[name] != None):
@ -67,7 +68,7 @@ class Config:
print(" subdomain: " + self.subdomain)
print(" uid: " + str(self.uid))
print(" gid: " + str(self.gid))
print(" path: " + self.path)
print(" loglevel: " + self.loglevel)
print(" clients:")
for i in range(len(self.clients)):
self.clients[i].print(8)
@ -82,7 +83,7 @@ class Config:
self.subdomain_only = len(self.subdomain) > 0
self.uid = int(yaml_key_exists_else(conf_srv, 'uid', other_val=os.getuid()))
self.gid = int(yaml_key_exists_else(conf_srv, 'gid', other_val=os.getgid()))
self.path = str(yaml_key_exists_else(conf_srv, 'path', other_val=random_string()))
self.loglevel = str(yaml_key_exists_else(conf_srv, 'loglevel', other_val=DEFAULT_LOGLEVEL))
self.watchtower = bool(yaml_key_exists_else(conf_srv, 'watchtower', other_val=DEFAULT_WATCHTOWER_ENABLE))
self.clients = []
@ -102,7 +103,7 @@ def main():
template_dict['subdomain_only'] = str(conf.subdomain_only).lower()
template_dict['domain'] = conf.domain
template_dict['email'] = conf.email
template_dict['path'] = conf.path
template_dict['loglevel'] = conf.loglevel
if conf.watchtower:
with open(WATCHTOWER_IN, "r") as f:

View File

@ -1,6 +1,6 @@
{
"log": {
"loglevel": "warning",
"loglevel": {{ loglevel }},
"access": "/etc/xray/access.log",
"error": "/etc/xray/error.log"
},