Skip to content

Sniffer ​

When Enhanced Mode captures a TCP connection to an address Core cannot name (the application resolved the name on its own, or connected to a hard-coded address), domain rules have nothing to match. The sniffer reads the first bytes the application sends, the HTTP Host or the TLS server name (SNI), and uses that name for routing. It decrypts nothing and changes nothing; the bytes it reads are sent on unchanged.

The sniffer is on by default. You only need [sniffer] to change it.

toml
[sniffer]
enable = true
protocols = ["http", "tls"]
http-ports = [80, 8080]
tls-ports = [443, 8443]
override-destination = true
timeout-ms = 500
max-bytes = 16384

Where it applies ​

ConnectionSniffed
TUN (Windows, macOS), TCPyes
Linux eBPF, TCPyes
Router gateway, TCP from LAN clientsyes
Local HTTP/SOCKS5 portno: the application already sends the name
UDP, including QUIC (HTTP/3)no
Connections to a Fake-IPno: Core already knows the name

Fields ​

FieldDefaultNotes
enabletrue
protocols["http", "tls"]http, tls (alias https), case ignored. When present, only the listed protocols are sniffed; [] sniffs nothing. Other names are dropped with a warning
http-ports[80, 8080]destination ports where an HTTP request is read
tls-ports[443, 8443]destination ports where a TLS ClientHello is read
override-destinationtruesend the sniffed name, not the address, to the proxy; see below
timeout-ms500how long to wait for the first bytes; values outside 10–5000 are clamped
max-bytes16384how much to read at most; values outside 512–65536 are clamped

Ports can be a number, a "from-to" range string, or a list of both: tls-ports = [443, "8440-8450"]. A range may span at most 100 ports above its start. An invalid entry is dropped with a warning; the rest of the list still applies.

[sniffer] is a lenient section: an unknown key, or a value of the wrong type, is ignored without an error and the default applies. protocols must be an array: protocols = "tls" turns both protocols off. Check the spelling of keys.

What happens to a connection ​

  1. Should it be sniffed? Only if the sniffer is enabled, the destination port is in http-ports for an enabled http, or in tls-ports for an enabled tls, and the address is not a Fake-IP.
  2. Read. Core reads what the application sends until it finds a name, sees that the data is not HTTP or TLS, has read max-bytes, or timeout-ms has passed.
  3. Route. A found name replaces the name Core learned from DNS for this connection. bypass, the rules and FINAL see the sniffed name and the destination address. Without a name, the connection is routed as it would be without the sniffer.
  4. Connect. DIRECT always connects to the original address. A proxy gets the sniffed name when override-destination = true, otherwise the address. The bytes read in step 2 are sent first, exactly once.

What is read ​

  • HTTP: HTTP/1.0 and HTTP/1.1 requests (GET, HEAD, POST, PUT, DELETE, OPTIONS, PATCH, TRACE, CONNECT). The name comes from the CONNECT target, from an absolute URL (GET http://example.com/ …), or from the Host header. The port in the header is dropped.
  • TLS: the server_name extension of the ClientHello, also when the ClientHello spans several TLS records.
  • IP addresses and malformed names are ignored: an SNI of 1.2.3.4 gives no name.

override-destination ​

override-destinationRules seeA proxy receivesDIRECT connects to
true (default)the sniffed namethe sniffed namethe original address
falsethe sniffed namethe original addressthe original address

With true the proxy server resolves the name itself, which usually gives an address close to the proxy server. Use false when an application must reach exactly the address it chose, for example when it connects to a fixed address and sends an SNI that resolves elsewhere.

Rules and DNS ​

  • The sniffed name feeds every domain rule (DOMAIN*, GEOSITE, domain entries in rule sets and in logical rules) and the bypass list. IP rules still see the destination address. A rule that matches the name and a rule that matches the address compete by their order, as always.
  • The sniffer never changes DNS answers. It helps only the connection it read.
  • With the default mode = "fake-ip", names that route through a proxy already arrive as Fake-IPs and are not sniffed. The sniffer matters for connections to real addresses: names routed DIRECT, mode = "real-ip", applications with their own DNS (DNS over HTTPS), and hard-coded addresses.
  • On Linux eBPF a connection is sniffed only if it is captured. With FINAL,DIRECT, a connection to an address that no rule selects may never reach Core; see what eBPF captures.
  • On Windows with dns-hijack = false, Core answers no DNS and the sniffer is the only source of names.

Limits ​

  • Server-first protocols. On a listed port where the server speaks first (SMTP, FTP, many databases), the application sends nothing at first and the connection waits timeout-ms before it is routed. Keep such ports out of the lists.
  • Encrypted Client Hello (ECH). The visible SNI is the outer, public name of the provider, not the real site. Rules then see that public name.
  • Other protocols expose no name: HTTP/2 without TLS, SSH, plain IP protocols. Use IP or process rules for those.
  • max-bytes too small. A ClientHello larger than max-bytes gives no name. The default is enough for current browsers, including post-quantum key shares.
  • Ports not in the lists are never sniffed. Add HTTPS services on unusual ports to tls-ports.

How changes apply ​

Changing [sniffer] and re-activating the profile applies in place: Enhanced Mode capture is rebuilt with the new settings. On Linux eBPF the whole runtime is rebuilt. Router gateway connections use the new settings from the next connection.

Troubleshooting ​

SymptomCheck
A domain rule does not match a captured HTTPS connectionIs the port in tls-ports? Does Connections show the destination as a name? Is the application using ECH or QUIC (UDP)?
Connections on one port open slowlyThe server speaks first on that port; remove the port from the lists
A site breaks only through a proxyTry override-destination = false; the application may rely on the exact address it chose
Changes to [sniffer] have no effectA misspelled key or a value of the wrong type is ignored silently

See also Rules, DNS, TUN and Linux eBPF.