podkop icon indicating copy to clipboard operation
podkop copied to clipboard

[FEATURE] Hysteria2

Open Kagashini opened this issue 1 month ago • 1 comments

Краткое описание

Отсутствует поддержка Hysteria2

Проблема, которую решает

Сейчас нет возможности добавить в URL TEST ссылки типа hysteria2 и использовать их вместе с vless.

💡 Предлагаемое решение

Грязный конфиг Inbound из s-ui, не смотрите на rule set и socks

{
  "log": {
    "level": "info",
    "timestamp": true,
    "disabled": false
  },
  "dns": {
    "servers": []
  },
  "ntp": null,
  "inbounds": [
    {
      "domain_strategy": "ipv4_only",
      "ignore_client_bandwidth": true,
      "listen": "::",
      "listen_port": 443,
      "masquerade": "https://site.site.com/",
      "sniff": false,
      "tag": "hysteria2-11111",
      "tls": {
        "certificate": [
          "-----BEGIN CERTIFICATE-----",
          
          "-----END CERTIFICATE-----"
        ],
        "enabled": true,
        "key": [
          "-----BEGIN PRIVATE KEY-----",
          
          "-----END PRIVATE KEY-----"
        ]
      },
      "type": "hysteria2",
      "users": [
        {
          "name": "1",
          "password": "P1"
        },
        {
          "name": "2",
          "password": "P2"
        },
        {
          "name": "3",
          "password": "P3"
        },
        {
          "name": "4",
          "password": "P4"
        },
        {
          "name": "5",
          "password": "P5"
        },
        {
          "name": "6",
          "password": "P6"
        }
      ]
    }
  ],
  "outbounds": [
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    },
    {
      "type": "socks",
      "version": "5",
      "tag": "proxy-socks",
      "server": "127.0.0.1",
      "server_port": 1081
    },
    {
      "type": "block",
      "tag": "block-AD"
    }
  ],
  "route": {
    "rules": [
      {
        "protocol": [
          "dns"
        ],
        "outbound": "dns-out"
      },
      {
        "invert": false,
        "rule_set": [
          "AdGuardSDNSFilter",
          "OISD_BIG",
          "ADAWAY"
        ],
        "rule_set_ipcidr_match_source": false,
        "outbound": "block-AD"
      },
      {
        "rule_set": [
          "OpenAI"
        ],
        "rule_set_ipcidr_match_source": false,
        "outbound": "proxy-socks",
        "invert": false
      },
      {
        "invert": false,
        "domain_suffix": [
          "aistudio.google.com"
        ],
        "outbound": "proxy-socks",
        "protocol": [
          "http",
          "tls",
          "quic",
          "stun",
          "dns"
        ]
      }
    ],
    "rule_set": [
      {
        "type": "remote",
        "tag": "AdGuardSDNSFilter",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/xmdhs/sing-box-ruleset/rule-set/AdGuardSDNSFilter.srs"
      },
      {
        "type": "remote",
        "tag": "OISD_BIG",
        "format": "binary",
        "update_interval": "3d",
        "url": "https://github.com/burjuyz/RuRulesets/raw/main/ruleset-domain-oisd_big.srs"
      },
      {
        "type": "remote",
        "tag": "ADAWAY",
        "format": "binary",
        "url": "https://github.com/burjuyz/RuRulesets/raw/main/ruleset-domain-adaway_alive_hosts_mail_fb.srs",
        "update_interval": "3d"
      },
      {
        "type": "remote",
        "tag": "OpenAI",
        "format": "binary",
        "url": "https://github.com/tangnahuaite/sing-box_Route-rules/raw/refs/heads/main/rule_srs/OpenAI.srs"
      },
      {
        "type": "remote",
        "tag": "TikTok",
        "format": "binary",
        "url": "https://github.com/tangnahuaite/sing-box_Route-rules/raw/refs/heads/main/rule_srs/TikTok.srs"
      }
    ]
  },
  "experimental": {
    "v2ray_api": {
      "listen": "127.0.0.1:1080",
      "stats": {
        "enabled": true,
        "inbounds": [
          "hysteria2-11111"
        ],
        "outbounds": [
          "direct",
          "proxy-socks",
          "block-AD",
          "dns-out"
        ],
        "users": [
          "1",
          "2",
          "3",
          "4",
          "5",
          "6",
        ]
      }
    }
  }
}

Конфиг подписки Json:

{
  "inbounds": [
    {
      "address": [
        "172.19.0.1/30"
      ],
      "auto_route": true,
      "endpoint_independent_nat": false,
      "mtu": 9000,
      "platform": {
        "http_proxy": {
          "enabled": true,
          "server": "127.0.0.1",
          "server_port": 2080
        }
      },
      "stack": "system",
      "strict_route": false,
      "type": "tun"
    },
    {
      "listen": "127.0.0.1",
      "listen_port": 2080,
      "type": "mixed",
      "users": []
    }
  ],
  "outbounds": [
    {
      "outbounds": [
        "auto",
        "direct",
        "hysteria2-11111"
      ],
      "tag": "proxy",
      "type": "selector"
    },
    {
      "interval": "10m",
      "outbounds": [
        "hysteria2-11111"
      ],
      "tag": "auto",
      "tolerance": 50,
      "type": "urltest",
      "url": "http://www.gstatic.com/generate_204"
    },
    {
      "tag": "direct",
      "type": "direct"
    },
    {
      "password": "1",
      "server": "site.site.com",
      "server_port": 443,
      "tag": "hysteria2-11111",
      "tls": {
        "enabled": true,
        "insecure": true
      },
      "type": "hysteria2"
    }
  ],
  "route": {
    "auto_detect_interface": true,
    "final": "proxy",
    "rules": [
      {
        "action": "sniff"
      },
      {
        "action": "route",
        "clash_mode": "Direct",
        "outbound": "direct"
      }
    ]
  }
}

Сама ссылка, если верить рекомендации, не нужно усложнять, чтобы не выдавать подозрений:

hysteria2://[email protected]:443?fastopen=0&insecure=1#hysteria2-11111

Как расписывается:

hysteria2://[email protected]:port?fastopen=0&insecure=1#hy2-inbound

outbound в podkop:

{
      "server": "site.com",
      "server_port": port,
      "tag": "hysteria2-tag",
      "type": "hysteria2",
      "password": "password",
      "tls": {
        "enabled": true,
        "server_name": "site.com",
        "insecure": true
      }
}

Если настроить inbound на полную с обфускацией salamander и паролем:

{
  "inbounds": [
    {
      "address": [
        "172.19.0.1/30"
      ],
      "auto_route": true,
      "endpoint_independent_nat": false,
      "mtu": 9000,
      "platform": {
        "http_proxy": {
          "enabled": true,
          "server": "127.0.0.1",
          "server_port": 2080
        }
      },
      "stack": "system",
      "strict_route": false,
      "type": "tun"
    },
    {
      "listen": "127.0.0.1",
      "listen_port": 2080,
      "type": "mixed",
      "users": []
    }
  ],
  "outbounds": [
    {
      "outbounds": [
        "auto",
        "direct",
        "hysteria2-443"
      ],
      "tag": "proxy",
      "type": "selector"
    },
    {
      "interval": "10m",
      "outbounds": [
        "hysteria2-443"
      ],
      "tag": "auto",
      "tolerance": 50,
      "type": "urltest",
      "url": "http://www.gstatic.com/generate_204"
    },
    {
      "tag": "direct",
      "type": "direct"
    },
    {
      "obfs": {
        "password": "slozhniiparol",
        "type": "salamander"
      },
      "password": "password",
      "server": "site.com",
      "server_port": 443,
      "tag": "hysteria2-443",
      "tls": {
        "enabled": true,
        "insecure": true
      },
      "type": "hysteria2"
    }
  ],
  "route": {
    "auto_detect_interface": true,
    "final": "proxy",
    "rules": [
      {
        "action": "sniff"
      },
      {
        "action": "route",
        "clash_mode": "Direct",
        "outbound": "direct"
      }
    ]
  }
}

Ссылка:

hysteria2://[email protected]:port?obfs-password=password&fastopen=0&security=tls&insecure=1&obfs=salamander#hysteria2-inbound

Workaround

No response

Идеи реализации (опционально)

Добавил PR: Hysteria2 Protocol

Kagashini avatar Nov 17 '25 14:11 Kagashini

https://github.com/itdoginfo/podkop/tree/feat/hy2

ampetelin avatar Nov 26 '25 16:11 ampetelin

@Kagashini ушло в релиз

ampetelin avatar Dec 03 '25 05:12 ampetelin