Skip to content

Instantly share code, notes, and snippets.

View phlinhng's full-sized avatar

phlinhng

  • Tsinghua University
  • Formosa
View GitHub Profile
@phlinhng
phlinhng / a-v2ray-wss-cdn-without-proxy.md
Last active October 13, 2023 19:59
v2ray wss不开cloudflare proxy套用cdn (让同一个域名既能直连也能通过cdn中转)

动机

在v2ray+ws+tls+web的情况下,不管cloudflare dns有没有开启云朵(proxy),都可以透过address填cf节点ip,ws头部host填域名的方式连接上v2Ray服务器。写这篇的目的是想测试在没有web的情况下使用同一招,让同一个域名既能直连也能通过cdn中转。

有web时的连接方法

地址: cloudflare.com (或1.1.1.1或任何cloudflare节点IP)
端口: web服务器的端口 (通常为443)
tls: 开
不安全连接: 不允许
混淆: websocket
@phlinhng
phlinhng / trojan-go-quickstart.sh
Created May 31, 2020 17:56
trojan-go-quickstart.sh
#!/bin/sh
echo "Getting the latest version of trojan-go"
latest_version="$(curl -s "https://api.github.com/repos/p4gefau1t/trojan-go/releases" | jq '.[0].tag_name' --raw-output)"
echo "${latest_version}"
trojango_link="https://github.com/p4gefau1t/trojan-go/releases/download/${latest_version}/trojan-go-linux-amd64.zip"
mkdir -p "/usr/bin/trojan-go"
mkdir -p "/etc/trojan-go"
@phlinhng
phlinhng / trojan.json
Last active June 19, 2021 06:49
将服务端的 trojan-go 与 v2ray-core 组合实现按目的地中转 ( 目前 trojan-go 作为 server 不支持前置代理,写开心的 )
{
"run_type": "server",
"local_addr": "127.0.0.1",
"local_port": 443,
"remote_addr": "1.1.1.1",
"remote_port": 80,
"log_level": 3,
"password": [
"your_awesome_password"
],
[Unit]
Description=MTG - Bullshit-free MTPROTO proxy for Telegram
Documentation=https://github.com/9seconds/mtg
After=network.target nss-lookup.target
Wants=network-online.target
[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/mtg run <secret> --bind 0.0.0.0:8443
@phlinhng
phlinhng / Caddyfile
Last active June 19, 2021 06:49
trojan-go with caddy as remote web server & https redirector
must.have.sni.com:80 {
redir https://must.have.sni.com{uri}
}
must.have.sni.com:8080 {
bind 127.0.0.1
root /var/www/html
index index.html
tls off
}
@phlinhng
phlinhng / copy_cert.sh
Last active June 27, 2020 08:52
scp ssl cert files to other servers
#!/bin/bash
site="www.your-ssl.com"
path="/root/.acme.sh/acme-v02.api.letsencrypt.org/sites/${site}"
touch server.key server.crt
sudo cat "${path}/${site}.key" > "/root/server.key"
sudo cat "${path}/${site}.crt" > "/root/server.crt"
if [ -s "server.key" ] && [ -s "server.crt" ]; then
@phlinhng
phlinhng / cloudflare_optimise.md
Last active March 5, 2021 01:34
Cloudflare 三网优化节点测试结果 (2020.04)

Cloudflare 三網優化

移動友好

172.64.32.0/24 (香港)

聯通友好

172.69.72.0/22 (澳門)
172.64.0.0/13 (美國 聖何塞)

電信友好

@phlinhng
phlinhng / http.conf
Last active July 5, 2020 00:02
v2board + nginx (path: /etc/nginx/sites-enabled/v2board.conf)
server {
listen 80;
listen [::]:80;
root /var/www/v2board/public; # 改成你自己的路径
index index.php index.html;
server_name sspanel.host; # 改成你自己的域名
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
}
@phlinhng
phlinhng / soga.conf
Last active January 29, 2023 10:48
soga v2ray + nginx 反代
type=v2board # 必填这个
server_type=v2ray # 必填这个
api=webapi # webapi 或 db,表示 webapi 对接或数据库对接
# webapi 对接
webapi_url=https://www.yourdomain.com/ # webapi url,填写面板主页地址
webapi_key= # webapi key
node_id=1 # 节点id
soga_key= # 授权key,社区版无需填写,最多支持88用户,商业版无限制
@phlinhng
phlinhng / Caddyfile
Last active June 18, 2023 14:19
caddy 簡單反代谷歌學術
scholar.example.com {
timeouts 5m
proxy / https://scholar.google.com.hk {
except /robots.txt /usercontent
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream User-Agent {>User-Agent}
# header_upstream X-Real-IP {>CF-Connecting-IP}
# header_upstream X-Forwarded-For {>CF-Connecting-IP}
header_upstream Accept-Language zh-HK