Skip to content

Direct / Reject / Drop

[!NOTE] This document is partially generated by AI.

These are special “terminal” protocols in yuhaiin that define how a connection is ultimately handled when no further proxying is required or allowed.

  • Direct: Supports both TCP and UDP natively.
    • NAT Type: Full-Cone NAT.
  • Reject/Drop: Applies to both TCP and UDP traffic.

The Direct protocol instructs yuhaiin to connect directly to the destination without any proxy.

Normally, direct is used as a simple tag in rules, but it has one specific configuration field when used in a node:

  • network_interface (string): (Optional) The specific local network interface name (e.g., eth0, wlan0) to bind for the outgoing connection.

The Reject protocol explicitly blocks the connection and sends an error (e.g., a TCP Reset or ICMP Port Unreachable) back to the source.


The Drop protocol silently discards the connection. No error is sent back, and the connection simply times out on the client’s side.


While they can be configured as nodes, these protocols are most frequently used as actions within yuhaiin’s routing rules:

{
"rules": [
{ "domain": "local.lan", "action": "direct" },
{ "domain": "ads.example.com", "action": "reject" },
{ "ip": "1.2.3.4", "action": "drop" }
]
}
  • Direct: Uses the system’s default dialer. Found in pkg/net/proxy/direct.
  • Reject/Drop: Implemented as dummy proxies that immediately return errors or hang indefinitely. Found in pkg/net/proxy/reject.