SagerNet / sing-box

The universal proxy platform
https://sing-box.sagernet.org/
Other
18.43k stars 2.21k forks source link

How to proxy Discord voice alone? #1962

Closed Azuriye closed 1 month ago

Azuriye commented 1 month ago

Hello, I wanted to know if there are better ways to detect WebRTC connections from Discord when connecting to a voice channel.

Currently, using process_name works but it proxies the entire application. I only wish for my voice to be routed through sing-box.

simplerick-simplefun commented 1 month ago
{
  process_name: Discord.exe
  protocol: udp
},
{
  process_name: Discord.exe
  domain_suffix:[ "discord.media" ]
}
Azuriye commented 1 month ago
{
  process_name: Discord.exe
  protocol: udp
},
{
  process_name: Discord.exe
  domain_suffix:[ "discord.media" ]
}

Should it be like this? sorry I didn't understand how to exactly change up my route rules.

{
   "route":{
      "rules":[
         {
            "protocol":"dns",
            "outbound":"dns-out"
         },
         {
            "inbound":"mixed-in",
            "outbound":"proxy"
         },
         {
            "process_name":[
               "Discord.exe"
            ],
            "protocol":"udp",
            "domain_suffix":[
               "discord.media"
            ],
            "outbound":"proxy"
         },
         {
            "domain_suffix":[
               "f95zone.to",
               "e-hentai.org",
               "exhentai.org",
               "alst.net",
               "kemono.su",
               "cool-create.cc",
               "yande.re",
               "proxifier.com",
               "gelbooru.com",
               "donmai.us",
               "kemono.party",
               "toranoana.jp",
               "n-hentai.net",
               "melonbooks.co.jp",
               "maikaze.com"
            ],
            "outbound":"proxy"
         },
         {
            "ip_cidr":[
               "172.18.0.2"
            ],
            "outbound":"proxy"
         }
      ],
      "final":"direct",
      "auto_detect_interface":true
   }
}
simplerick-simplefun commented 1 month ago

Should it be like this? sorry I didn't understand how to exactly change up my route rules.

{
   "route":{
      "rules":[
         {
            "protocol":"dns",
            "outbound":"dns-out"
         },
         {
            "inbound":"mixed-in",
            "outbound":"proxy"
         },
         {
            "process_name":[
               "Discord.exe"
            ],
            "protocol":"udp",
            "domain_suffix":[
               "discord.media"
            ],
            "outbound":"proxy"
         },

NO. the conditions in the rule block "Discord.exe" are in "and" relationship. In your configuration, you are proxying traffic that are 1. from Discord.exe and 2.udp traffic and 3. with domain_suffic "discord.media"(which uses tcp) ---- basically, you proxy no traffic at all. You want to proxy all udp traffic from discord, and all traffic with domain_suffic "discord.media" (which uses tcp). Use my example:

{
"process_name":[
"Discord.exe"
],
"protocol":"udp",
"outbound":"proxy"
},
{
"process_name":[
"Discord.exe"
],
"domain_suffix":[
"discord.media"
],
"outbound":"proxy"
},
Azuriye commented 1 month ago

Thanks the above seems to work and logically makes sense, Tunnel UDP traffic from Discord AND Tunnel domain suffix "discord.media" from Discord