Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am tobyxdd on github.
  • I am tobyxdd (https://keybase.io/tobyxdd) on keybase.
  • I have a public key ASDeDeVKNqTCe2nRXu5UO6aH5Zy00cHBUOoDWEzwvVEd6Ao

To claim this, I am signing this object:

diff --git a/conn.go b/conn.go
index 2f4e3a23..811279c9 100644
--- a/conn.go
+++ b/conn.go
@@ -29,6 +29,19 @@ type OOBCapablePacketConn interface {
var _ OOBCapablePacketConn = &net.UDPConn{}
func wrapConn(pc net.PacketConn) (connection, error) {
+ conn, ok := pc.(interface {
+ SyscallConn() (syscall.RawConn, error)
@tobyxdd
tobyxdd / udptest.py
Created October 1, 2023 19:50
Python UDP test server & client
import argparse
import socket
import time
import random
import threading
PACKET_SIZE_MIN, PACKET_SIZE_MAX = 200, 2000
PACKET_PER_SECOND = 100

My response to the recent controversy about TCP Brutal

Last week, I released TCP Brutal, a TCP port of one of the congestion control algorithms available in Hysteria, my other project which is a QUIC-based anti-censorship proxy. I’m surprised by its surge in popularity and the controversy it has generated, having been featured on sites like Hacker News, Zhihu, even drawing criticism from David Reed, an early TCP/IP developer. While many points are perfectly valid, I believe many critics are overlooking very important context, which I intend to clarify in this post.

Brutal, both in its TCP and QUIC forms, was purposefully built for anti-censorship proxies to deal with China's unique (I hope) internet situation. China has only a handful of government-controlled nodes for connecting its Internet to the rest of the world, called "Internet cross-border security gateway" (数据跨境安全网关) in official government documents. Beyond the bizarre censorship that blocks virtually every foreign website and service—forcing sof

@tobyxdd
tobyxdd / vpn_block_cn.sh
Created August 5, 2024 00:22
Block Chinese IP Forwarding as VPN Server
#!/bin/bash
IP_LIST_URL="https://www.ipdeny.com/ipblocks/data/countries/cn.zone"
IP_LIST_FILE="/tmp/cn.zone"
IPSET_NAME="china_ips"
BLOCK_CHAIN="CHINA_BLOCK"
download_ip_list() {
wget -q -O $IP_LIST_FILE $IP_LIST_URL
if [[ $? -ne 0 ]]; then