Skip to content

hysteria2: add udphop & salamander#3705

Open
LjhAUMEM wants to merge 11 commits into
v2fly:masterfrom
LjhAUMEM:hy
Open

hysteria2: add udphop & salamander#3705
LjhAUMEM wants to merge 11 commits into
v2fly:masterfrom
LjhAUMEM:hy

Conversation

@LjhAUMEM
Copy link
Copy Markdown

@LjhAUMEM LjhAUMEM commented Apr 28, 2026

  • Refactor hysteria2
  • Update 2.8.2
  • Add udphop
  • Add salamander

example

{
  "log": { "loglevel": "debug" },
  "inbounds": [
    {
      "listen": "127.0.0.1",
      "port": 1080,
      "protocol": "socks",
      "settings": {
        "auth": "noauth",
        "udp": true
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "hysteria2",
      "settings": {
        "servers": [
          {
            "address": "127.0.0.1",
            "port": 1081
          }
        ]
      },
      "streamSettings": {
        "network": "hysteria2",
        "hy2Settings": {
          "auth": "5783a3e7-e373-51cd-8642-c83782b807c5",
          "udpHop": {
            "ports": "20000-50000",
            "intervalMin": 5,
            "IntervalMax": 10
          },
          "salamander": "5783a3e7",
          "congestion": "bbr",
          "bbrProfile": "standard"
        },
        "security": "tls",
        "tlsSettings": {
          "allowInsecure": true,
          "pinnedPeerCertSha256": "f166838b984afe614cba418bf2ace575189d822e94c751428e41bb6a7b6f1465"
        }
      }
    }
  ]
}
{
  "log": { "loglevel": "debug" },
  "inbounds": [
    {
      // "listen": "127.0.0.1",
      "port": 1081,
      "protocol": "hysteria2",
      "settings": {
        // "packetEncoding": "Packet"
      },
      "streamSettings": {
        "network": "hysteria2",
        "hy2Settings": {
          "auth": "5783a3e7-e373-51cd-8642-c83782b807c5",
          "salamander": "5783a3e7",
          "congestion": "bbr",
          "bbrProfile": "standard"
        },
        "security": "tls",
        "tlsSettings": {
          "alpn": ["h3"],
          "certificates": [
            {
              "certificate": [
                "-----BEGIN CERTIFICATE-----",
                "MIIBnTCCAUKgAwIBAgIRAKKw0E+MG4CqeIxeCZtyfWMwCgYIKoZIzj0EAwIwJjER",
                "MA8GA1UEChMIWHJheSBJbmMxETAPBgNVBAMTCFhyYXkgSW5jMB4XDTI2MDQxMTE0",
                "NDg1OFoXDTI2MDcxMDE1NDg1OFowJjERMA8GA1UEChMIWHJheSBJbmMxETAPBgNV",
                "BAMTCFhyYXkgSW5jMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEpRY9GoCoKoKx",
                "bp0xH9OQiHmBhogW7nCRh7TtGvTwfyef6DSqUl26Ql3LxTAqNsK84g6EOO5hXkgN",
                "PYRhOnYRiKNRME8wDgYDVR0PAQH/BAQDAgWgMBMGA1UdJQQMMAoGCCsGAQUFBwMB",
                "MAwGA1UdEwEB/wQCMAAwGgYDVR0RBBMwEYIPd3d3LmV4YW1wbGUuY29tMAoGCCqG",
                "SM49BAMCA0kAMEYCIQC81N1lTIzfSsR6K8W2C3NKaR+iqyjYGo+L2mskYVQAVQIh",
                "APeXowIRcyk1ABfptJZ1DPRcAHpJ8H3antwzwh0okJ/e",
                "-----END CERTIFICATE-----"
              ],
              "key": [
                "-----BEGIN RSA PRIVATE KEY-----",
                "MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgaqqaEdlBoohy3xLT",
                "yjdJowGv8zU7NckAO8+fK1x2GqChRANCAASlFj0agKgqgrFunTEf05CIeYGGiBbu",
                "cJGHtO0a9PB/J5/oNKpSXbpCXcvFMCo2wrziDoQ47mFeSA09hGE6dhGI",
                "-----END RSA PRIVATE KEY-----"
              ]
            }
          ]
        }
      }
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom"
    }
  ]
}

// iptables -t nat -A PREROUTING -i eth0 -p udp --dport 20000:50000 -j REDIRECT --to-ports 1081

TODO

  • Replace quic-go/quic-go with apernet/quic-go
  • Apply congestion to quic transport
  • Add custom masquerade

@LjhAUMEM LjhAUMEM marked this pull request as draft April 30, 2026 11:03
@LjhAUMEM LjhAUMEM marked this pull request as ready for review May 2, 2026 05:51
@Losalado
Copy link
Copy Markdown

Hy2 adds Realms service now,will V2Ray support it?

https://github.com/apernet/hysteria/releases/tag/app%2Fv2.9.0

v2.9.0

  • Added Hysteria Realms: No public IP? No problem. Punches through your NAT to let you host a Hysteria server from home, a cellular network, or even a coffee shop. Clients connect directly, peer-to-peer. No port forwarding, no relay.

  • 新增 Hysteria Realms:没有公网 IP 也没问题!通过 NAT 打洞,让你从家宽、手机流量甚至咖啡店都能运行 Hysteria 服务端。与客户端 P2P 连接,无需配置端口转发或中转。

@LjhAUMEM
Copy link
Copy Markdown
Author

Hy2 adds Realms service now,will V2Ray support it?

sure, need few days

func NewBrutalSender(bps uint64) *BrutalSender {
debug, _ := strconv.ParseBool(os.Getenv(debugEnv))
bs := &BrutalSender{
bps: congestion.ByteCount(bps),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants