Skip to content

Commit

Permalink
add xray
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Jan 3, 2023
1 parent 09ac97c commit 9a92e0e
Show file tree
Hide file tree
Showing 7 changed files with 534 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
log
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function do_for_all() {
else
runsh uninstall.sh telegram
fi

runsh $1.sh xray
runsh $1.sh admin_ui
}

Expand Down
2 changes: 1 addition & 1 deletion nginx/sni-proxy.conf.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


map $ssl_preread_server_name $name {
defaultserverhost 127.0.0.1:444; #default tls connection
defaultserverhost 127.0.0.1:400; #default tls connection
default 127.0.0.1:442; #forward all others for avoid active detection
}

Expand Down
83 changes: 83 additions & 0 deletions nginx/xray-based.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
server {
listen unix:/dev/shm/h1.sock proxy_protocol default_server;
listen unix:/dev/shm/h2c.sock http2 proxy_protocol default_server;
set_real_ip_from unix:;
real_ip_header proxy_protocol;
server_name _;
include /opt/GITHUB_REPOSITORY/nginx/admin-link.conf;
include /opt/GITHUB_REPOSITORY/nginx/def-link.conf;
include /opt/GITHUB_REPOSITORY/nginx/common.conf;
} #Restrict domain name access (prohibit access to the website by IP) and return 400

# HTTP1 UDS listener
server {
listen unix:/dev/shm/h1.sock proxy_protocol; #HTTP/1.1 server monitor process and enable PROXY protocol reception
set_real_ip_from unix:;
real_ip_header proxy_protocol;
server_name defaultserverhost;

include /opt/GITHUB_REPOSITORY/nginx/admin-link.conf;
include /opt/GITHUB_REPOSITORY/nginx/def-link.conf;
include /opt/GITHUB_REPOSITORY/nginx/common.conf;
}

# HTTP2 UDS listener
server {
listen unix:/dev/shm/h2c.sock http2 proxy_protocol; #H2C server monitor process and enable PROXY protocol reception
set_real_ip_from unix:;
real_ip_header proxy_protocol;
server_name defaultserverhost;

# grpc settings
grpc_read_timeout 1h;
grpc_send_timeout 1h;
grpc_set_header X-Real-IP $remote_addr;

location /defaultusersecret-trgrpc { #corresponds to serviceName in trojan-grpc config of xray
if ($request_method != "POST") {
return 404;
} #POST returns 404 when negotiation fails
client_body_buffer_size 1m;
client_body_timeout 1h;
client_max_body_size 0;
grpc_pass grpc://127.0.0.1:3001;

}

location /defaultusersecret-vlgrpc { #corresponds to serviceName in vless-grpc config of xray
if ($request_method != "POST") {
return 404;
} #POST returns 404 when negotiation fails
client_body_buffer_size 1m;
client_body_timeout 1h;
client_max_body_size 0;
grpc_pass grpc://127.0.0.1:3002;

}

location /defaultusersecret-vmgrpc { #corresponds to serviceName in vmess-grpc config of xray
if ($request_method != "POST") {
return 404;
} #POST returns 404 when negotiation fails
client_body_buffer_size 1m;
client_body_timeout 1h;
client_max_body_size 0;
grpc_pass grpc://127.0.0.1:3003;

}

location /defaultusersecret-ssgrpc { #corresponds to serviceName in shadowsocks-grpc config of xray
if ($request_method != "POST") {
return 404;
} #POST returns 404 when negotiation fails
client_body_buffer_size 1m;
client_body_timeout 1h;
client_max_body_size 0;
grpc_pass grpc://127.0.0.1:3004;
}

# Decoy website
include /opt/GITHUB_REPOSITORY/nginx/admin-link.conf;
include /opt/GITHUB_REPOSITORY/nginx/def-link.conf;
include /opt/GITHUB_REPOSITORY/nginx/common.conf;
}
2 changes: 2 additions & 0 deletions xray/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
2 changes: 2 additions & 0 deletions xray/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mv /usr/local/etc/xray/config.json mv /usr/local/etc/xray/config.json.old
systemctl restart Xray
Loading

0 comments on commit 9a92e0e

Please sign in to comment.