Skip to content

Instantly share code, notes, and snippets.

View phlinhng's full-sized avatar

phlinhng

  • Tsinghua University
  • Formosa
View GitHub Profile
@DuckSoft
DuckSoft / trojan-insecure-killer.go
Last active August 17, 2020 06:18
Trojan + allowInsecure = 裸奔
// Licensed under WTFPL
package main
import (
"bytes"
"crypto/rand"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
@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
@wych42
wych42 / clash.service
Last active February 5, 2024 05:39
Clash as transparent proxy(not totally transparent) on gateway box
[Unit]
Description=Clash service
After=network.target
[Service]
[Service]
Type=simple
StandardError=journal
User=clash
@liberal-boy
liberal-boy / HaProxy 通过 Domain Socket 与 V2Ray 通讯.md
Last active September 5, 2023 19:46
HaProxy 通过 Domain Socket 与 V2Ray 通讯

HaProxy 通过 Domain Socket 与 V2Ray 通讯

本文供高级玩家阅读,请先阅读 Vmess + TCP + TLS 方式的 HTTP 分流和网站伪装。 相比 TCP,Domain Socket 更为高效。 本文针对使用 Debian 10 的用户,其他系统请自行摸索。

预先准备

  1. 首先按照先前的教程安装好 HaProxy 和 V2Ray。

  2. 修改以下文件,示例见下方

  • /etc/haproxy/haproxy.cfg
@liberal-boy
liberal-boy / client.json
Last active July 9, 2022 06:59
Vmess Fail Redirect 简单实现
{
"log": {
"access": "",
"error": "",
"loglevel": "warning"
},
"inbounds": [
{
"port": 1080,
"listen": "127.0.0.1",
@liberal-boy
liberal-boy / Vmess + TCP + TLS 方式的 HTTP 分流和网站伪装.md
Last active April 17, 2024 09:48
Vmess + TCP + TLS 方式的 HTTP 分流和网站伪装

TCP + TLS + Web

背景

  • 目前 Vmess + WebSocket + TLS (以下简称 wss)方式,因其特征如同 HTTPS 流量,可以隐藏 V2Ray 路径,主动侦测会得到正常 HTTP 网站响应,具有良好的伪装能力,目前被广泛用于反审查。

  • 但是如此强大的伪装能力,需要付出严重的性能代价:TLS 1.3 握手需要消耗 1-rtt,WS 握手也需要消耗 1-rtt,增大了握手延迟。V2Ray 增加了 mux 以减少握手的发生,然而实际使用中 mux 体验并不好,很多用户选择关闭。

  • 最近兴起了一个新的反审查工具——Trojan,这个工具将一个类似 Socks 的协议直接通过 TLS 传输,并将认证失败的流量交由 Web 服务器处理。降低 WS 延迟的同时,提供与 wss 方式一样的伪装能力。但是该工具较为年轻,没有路由功能,各平台图形化客户端也不完善。

@zrt
zrt / Caddyfile
Created January 29, 2020 10:09
用 Caddy 反代了一些网站
###################
# #
# SU.SG #
# #
###################
# https://mp.weixin.qq.com/s/H3OOqhFRr0YZGorIAlsCjA
# todo
# replace or remove content-security-policy header
@oskar456
oskar456 / wgcf.py
Last active February 17, 2024 12:47
Cloudflare WARP linux client (using wg-quick for actual tunnel setup)
#!/usr/bin/env python3
import subprocess
import json
import os
from pathlib import Path
import requests
from requests.compat import urljoin