github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/docs/examples/dns-hijack.md (about)

     1  #### Sniff Mode
     2  
     3  ```json
     4  {
     5    "inbounds": [
     6      {
     7        "type": "tun",
     8        "inet4_address": "172.19.0.1/30",
     9        "auto_route": true,
    10        "sniff": true // required
    11      }
    12    ],
    13    "outbounds": [
    14      {
    15        "type": "direct"
    16      },
    17      {
    18        "type": "dns",
    19        "tag": "dns-out"
    20      }
    21    ],
    22    "route": {
    23      "rules": [
    24        {
    25          "protocol": "dns",
    26          "outbound": "dns-out"
    27        }
    28      ],
    29      "auto_detect_interface": true
    30    }
    31  }
    32  ```
    33  
    34  #### Port Mode
    35  
    36  ```json
    37  {
    38    "inbounds": [
    39      {
    40        "type": "tun",
    41        "inet4_address": "172.19.0.1/30",
    42        "auto_route": true,
    43        "sniff": true // not required
    44      }
    45    ],
    46    "outbounds": [
    47      {
    48        "type": "direct"
    49      },
    50      {
    51        "type": "dns",
    52        "tag": "dns-out"
    53      }
    54    ],
    55    "route": {
    56      "rules": [
    57        {
    58          "port": 53,
    59          "outbound": "dns-out"
    60        }
    61      ],
    62      "auto_detect_interface": true
    63    }
    64  }
    65  ```