-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use vless+reality instead of shadowsocks
- Loading branch information
1 parent
bc0435c
commit 6f0fe56
Showing
52 changed files
with
771 additions
and
636 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,50 @@ | ||
config_servers: | ||
server1-uuid: | ||
# domain of server that will be put into config | ||
# domain of server that will be put into config (IP or domain users will connect to) | ||
host: | ||
# description or name of server | ||
remarks: | ||
# port of shadowsocks to be exposed and used publicly | ||
# name of server (one line) | ||
name: | ||
# port of xray to be exposed and used publicly | ||
port: | ||
# cipher to use in shadowsocks | ||
method: | ||
# secret (any random string) to be used for generating client passwords | ||
secret: | ||
# prefix to use. read more: https://www.reddit.com/r/outlinevpn/wiki/index/prefixing | ||
prefix: | ||
# where regular https requests (non-shadowsocks requests) proxy to | ||
fallback_proxy_target: | ||
# if you don't want to install prometheus on the server, replace yaml object to boolean false: | ||
# prometheus_metrics: false | ||
prometheus_metrics: | ||
# port where prometheus metrics endpoints should be exposed | ||
port: | ||
# content of self-signed cert and keys (SSL pem format) | ||
tls: | ||
certificate: | | ||
-----BEGIN CERTIFICATE----- | ||
.... | ||
-----END CERTIFICATE----- | ||
key: | | ||
-----BEGIN PRIVATE KEY----- | ||
.... | ||
-----END PRIVATE KEY----- | ||
shadowsocks: | ||
# any random URL-valid string starting with "/" | ||
url_path: | ||
node_exporter: | ||
# any random URL-valid string starting with "/" | ||
url_path: | ||
# flow parameter in https://xtls.github.io/en/config/outbounds/vless.html#serverobject (ideally xtls-rprx-vision) | ||
flow: | ||
# fingerprint parameters as `fingerprint` in https://xtls.github.io/ru/config/transport.html#tlsobject | ||
fingerprints: | ||
- chrome | ||
- safari | ||
- "..." | ||
# private key. generate with ./xray x25519 | ||
private_key: | ||
# public key. generate with ./xray x25519 | ||
public_key: | ||
# where regular https requests proxy to and what website xray should pretent as | ||
fallback_proxy_target: example.com | ||
# list of sni should be accepter by xray. see serverNames in https://xtls.github.io/ru/config/transport.html#realityobject | ||
supported_snis: | ||
- example.com | ||
- www.example.com | ||
|
||
# second server (for instance) | ||
server2-uuid: | ||
# domain of server that will be put into config (IP or domain users will connect to) | ||
host: | ||
remarks: | ||
# name of server (one line) | ||
name: | ||
# port of xray to be exposed and used publicly | ||
port: | ||
method: | ||
secret: | ||
prefix: | ||
# flow parameter in https://xtls.github.io/en/config/outbounds/vless.html#serverobject (ideally xtls-rprx-vision) | ||
flow: | ||
# fingerprint parameter in https://xtls.github.io/ru/config/transport.html#tlsobject | ||
fingerprints: | ||
- | ||
- | ||
# private key. generate with ./xray x25519 | ||
private_key: | ||
# public key. generate with ./xray x25519 | ||
public_key: | ||
# where regular https requests proxy to and what website xray should pretent as | ||
fallback_proxy_target: | ||
prometheus_metrics: | ||
port: | ||
tls: | ||
certificate_path: | ||
key_path: | ||
shadowsocks: | ||
url_path: | ||
node_exporter: | ||
url_path: | ||
# list of sni should be accepter by xray. see serverNames in https://xtls.github.io/ru/config/transport.html#realityobject | ||
supported_snis: | ||
- | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# where redirect to if user opened index page without valid parameters | ||
config_users_configs_default_redirect: | ||
|
||
# title users should we when open hiddify | ||
config_users_title: | ||
|
||
# support url. see https://hiddify.com/app/URL-Scheme | ||
config_users_support_url: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
roles/shadowsocks-gateway/README.md → roles/metrics-exporter/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# shadowsocks-gateway | ||
# metrics exporter | ||
## Mandatory and optional variables | ||
Find them in [./defaults/main.yml](./defaults/main.yml). Empty variables in the file are mandatory, pre-filled variables are optional. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# one(!) server item as secribed in /servers-example.yml | ||
metrics_exporter_server: | ||
|
||
# localhost port xray metrics are available on | ||
metrics_exporter_xray_metrics_port: | ||
|
||
# localhost port node_exporter metrics are available on | ||
metrics_exporter_node_exporter_metrics_port: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dependencies: | ||
- role: nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
|
||
- name: Ensure required variables are defined | ||
assert: | ||
that: | ||
- metrics_exporter_xray_metrics_port is number | ||
- metrics_exporter_node_exporter_metrics_port is number | ||
|
||
- name: Ensure metrics_exporter_server is defined correctly | ||
include_tasks: tasks/assert-server.yml | ||
vars: | ||
server: "{{ metrics_exporter_server }}" | ||
|
||
- name: Create user | ||
user: name={{ metrics_exporter_user }} | ||
|
||
- name: Render nginx config | ||
template: | ||
src: nginx.conf.j2 | ||
dest: "/home/{{ metrics_exporter_user }}/{{ metrics_exporter_nginx_conf_filename }}" | ||
group: "{{ metrics_exporter_user }}" | ||
owner: "{{ metrics_exporter_user }}" | ||
mode: "600" | ||
register: config | ||
|
||
- name: Copy SSL key | ||
copy: | ||
content: "{{ metrics_exporter_server.prometheus_metrics.tls.key }}" | ||
dest: "{{ metrics_exporter_key_path }}" | ||
group: "{{ metrics_exporter_user }}" | ||
owner: "{{ metrics_exporter_user }}" | ||
mode: "600" | ||
when: metrics_exporter_server.prometheus_metrics is mapping | ||
register: ssl_key | ||
|
||
- name: Copy SSL certificate | ||
copy: | ||
content: "{{ metrics_exporter_server.prometheus_metrics.tls.certificate }}" | ||
dest: "{{ metrics_exporter_certificate_path }}" | ||
group: "{{ metrics_exporter_user }}" | ||
owner: "{{ metrics_exporter_user }}" | ||
mode: "600" | ||
when: metrics_exporter_server.prometheus_metrics is mapping | ||
register: ssl_cert | ||
|
||
- name: Remove unexpected files in home | ||
include_tasks: tasks/remove-unexpected-files.yml | ||
vars: | ||
directory: "/home/{{ metrics_exporter_user }}" | ||
files: | ||
- nginx.conf | ||
- "{{ metrics_exporter_certificate_filename }}" | ||
- "{{ metrics_exporter_key_filename }}" | ||
- "{{ metrics_exporter_pid_filename }}" | ||
- "{{ metrics_exporter_nginx_conf_filename }}" | ||
- "{{ metrics_exporter_access_log_filename }}" | ||
- "{{ metrics_exporter_error_log_filename }}" | ||
|
||
- name: Render systemd service config | ||
template: | ||
src: metrics-exporter.service.j2 | ||
dest: /etc/systemd/system/metrics-exporter.service | ||
register: systemd | ||
|
||
- name: Reload daemon | ||
systemd: | ||
daemon_reload: yes | ||
when: systemd.changed | ||
|
||
- name: Restart systemd app service | ||
systemd: | ||
name: metrics-exporter.service | ||
state: restarted | ||
enabled: yes | ||
when: systemd.changed or config.changed or ssl_key.changed or ssl_cert.changed |
10 changes: 10 additions & 0 deletions
10
roles/metrics-exporter/templates/metrics-exporter.service.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=metrics-exporter | ||
|
||
[Service] | ||
User={{ metrics_exporter_user }} | ||
ExecStart=/usr/sbin/nginx -c {{ metrics_exporter_nginx_conf_path }} | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
daemon off; | ||
worker_processes auto; | ||
|
||
pid {{ metrics_exporter_pid_path }}; | ||
|
||
events { | ||
worker_connections 4096; | ||
} | ||
|
||
http { | ||
access_log {{ metrics_exporter_access_log_path }}; | ||
error_log {{ metrics_exporter_error_log_path }}; | ||
|
||
server { | ||
listen *:80; | ||
listen [::]:80; | ||
server_name _; | ||
return 301 https://{{ metrics_exporter_server.fallback_proxy_target }}; | ||
} | ||
|
||
{% if metrics_exporter_server.prometheus_metrics is mapping %} | ||
server { | ||
listen *:{{ metrics_exporter_server.prometheus_metrics.port }} ssl http2; | ||
listen [::]:{{ metrics_exporter_server.prometheus_metrics.port }} ssl http2; | ||
|
||
ssl_certificate {{ metrics_exporter_certificate_path }}; | ||
ssl_certificate_key {{ metrics_exporter_key_path }}; | ||
ssl_protocols TLSv1.2 TLSv1.3; | ||
|
||
location {{ metrics_exporter_server.prometheus_metrics.xray.url_path }} { | ||
proxy_pass http://127.0.0.1:{{ metrics_exporter_xray_metrics_port }}/metrics; | ||
} | ||
|
||
location {{ metrics_exporter_server.prometheus_metrics.node_exporter.url_path }} { | ||
proxy_pass http://127.0.0.1:{{ metrics_exporter_node_exporter_metrics_port }}/metrics; | ||
} | ||
|
||
location / { | ||
return 444; | ||
} | ||
|
||
error_page 404 = @redirect; | ||
|
||
location @redirect { | ||
return 444; | ||
} | ||
} | ||
{% endif %} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# linux user to run metrics_exporter as | ||
metrics_exporter_user: metrics-exporter | ||
|
||
metrics_exporter_nginx_conf_filename: nginx.conf | ||
metrics_exporter_certificate_filename: cert.pem | ||
metrics_exporter_key_filename: key.pem | ||
metrics_exporter_access_log_filename: access.log | ||
metrics_exporter_error_log_filename: error.log | ||
metrics_exporter_pid_filename: nginx.pid | ||
|
||
metrics_exporter_nginx_conf_path: /home/{{ metrics_exporter_user }}/{{metrics_exporter_nginx_conf_filename }} | ||
metrics_exporter_certificate_path: "/home/{{ metrics_exporter_user }}/{{ metrics_exporter_certificate_filename }}" | ||
metrics_exporter_key_path: "/home/{{ metrics_exporter_user }}/{{ metrics_exporter_key_filename }}" | ||
metrics_exporter_access_log_path: "/home/{{ metrics_exporter_user }}/{{ metrics_exporter_access_log_filename }}" | ||
metrics_exporter_error_log_path: "/home/{{ metrics_exporter_user }}/{{ metrics_exporter_error_log_filename }}" | ||
metrics_exporter_pid_path: "/home/{{ metrics_exporter_user }}/{{ metrics_exporter_pid_filename }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# the port node_exporter should locally (localhost) export http metrics on | ||
node_exporter_port: 9092 | ||
node_exporter_port: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.