Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CRONET_GO_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cba7b9ac0399055aa49fbdc57c03c374f58e1597
d181863d6a4aa2e7bb7eaf67c1d512c5e4827fde
3 changes: 3 additions & 0 deletions adapter/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package adapter

import (
"context"
"net"
"net/netip"
"time"

Expand Down Expand Up @@ -82,6 +83,8 @@ type InboundContext struct {
SourceGeoIPCode string
GeoIPCode string
ProcessInfo *ConnectionOwner
SourceMACAddress net.HardwareAddr
SourceHostname string
QueryType uint16
FakeIP bool

Expand Down
23 changes: 23 additions & 0 deletions adapter/neighbor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package adapter

import (
"net"
"net/netip"
)

type NeighborEntry struct {
Address netip.Addr
MACAddress net.HardwareAddr
Hostname string
}

type NeighborResolver interface {
LookupMAC(address netip.Addr) (net.HardwareAddr, bool)
LookupHostname(address netip.Addr) (string, bool)
Start() error
Close() error
}

type NeighborUpdateListener interface {
UpdateNeighborTable(entries []NeighborEntry)
}
4 changes: 4 additions & 0 deletions adapter/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ type PlatformInterface interface {

UsePlatformNotification() bool
SendNotification(notification *Notification) error

UsePlatformNeighborResolver() bool
StartNeighborMonitor(listener NeighborUpdateListener) error
CloseNeighborMonitor(listener NeighborUpdateListener) error
}

type FindConnectionOwnerRequest struct {
Expand Down
2 changes: 2 additions & 0 deletions adapter/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ type Router interface {
RuleSet(tag string) (RuleSet, bool)
Rules() []Rule
NeedFindProcess() bool
NeedFindNeighbor() bool
NeighborResolver() NeighborResolver
AppendTracker(tracker ConnectionTracker)
ResetNetwork()
}
Expand Down
3 changes: 3 additions & 0 deletions constant/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const (
TypeCCM = "ccm"
TypeOCM = "ocm"
TypeOOMKiller = "oom-killer"
TypeTrustTunnel = "trusttunnel"
)

const (
Expand Down Expand Up @@ -88,6 +89,8 @@ func ProxyDisplayName(proxyType string) string {
return "AnyTLS"
case TypeTailscale:
return "Tailscale"
case TypeTrustTunnel:
return "TrustTunnel"
case TypeSelector:
return "Selector"
case TypeURLTest:
Expand Down
25 changes: 25 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@
icon: material/alert-decagram
---

#### 1.14.0-alpha.1

* Add `source_mac_address` and `source_hostname` rule items **1**
* Add `include_mac_address` and `exclude_mac_address` TUN options **2**
* Update NaiveProxy to 145.0.7632.159 **3**
* Fixes and improvements

**1**:

New rule items for matching LAN devices by MAC address and hostname via neighbor resolution.
Supported on Linux, macOS, or in graphical clients on Android and macOS.

See [Route Rule](/configuration/route/rule/#source_mac_address), [DNS Rule](/configuration/dns/rule/#source_mac_address) and [Neighbor Resolution](/configuration/shared/neighbor/).

**2**:

Limit or exclude devices from TUN routing by MAC address.
Only supported on Linux with `auto_route` and `auto_redirect` enabled.

See [TUN](/configuration/inbound/tun/#include_mac_address).

**3**:

This is not an official update from NaiveProxy. Instead, it's a Chromium codebase update maintained by Project S.

#### 1.13.2

* Fixes and improvements
Expand Down
31 changes: 31 additions & 0 deletions docs/configuration/dns/rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
icon: material/alert-decagram
---

!!! quote "Changes in sing-box 1.14.0"

:material-plus: [source_mac_address](#source_mac_address)
:material-plus: [source_hostname](#source_hostname)

!!! quote "Changes in sing-box 1.13.0"

:material-plus: [interface_address](#interface_address)
Expand Down Expand Up @@ -149,6 +154,12 @@ icon: material/alert-decagram
"default_interface_address": [
"2000::/3"
],
"source_mac_address": [
"00:11:22:33:44:55"
],
"source_hostname": [
"my-device"
],
"wifi_ssid": [
"My WIFI"
],
Expand Down Expand Up @@ -408,6 +419,26 @@ Matches network interface (same values as `network_type`) address.

Match default interface address.

#### source_mac_address

!!! question "Since sing-box 1.14.0"

!!! quote ""

Only supported on Linux, macOS, or in graphical clients on Android and macOS. See [Neighbor Resolution](/configuration/shared/neighbor/) for setup.

Match source device MAC address.

#### source_hostname

!!! question "Since sing-box 1.14.0"

!!! quote ""

Only supported on Linux, macOS, or in graphical clients on Android and macOS. See [Neighbor Resolution](/configuration/shared/neighbor/) for setup.

Match source device hostname from DHCP leases.

#### wifi_ssid

!!! quote ""
Expand Down
31 changes: 31 additions & 0 deletions docs/configuration/dns/rule.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
icon: material/alert-decagram
---

!!! quote "sing-box 1.14.0 中的更改"

:material-plus: [source_mac_address](#source_mac_address)
:material-plus: [source_hostname](#source_hostname)

!!! quote "sing-box 1.13.0 中的更改"

:material-plus: [interface_address](#interface_address)
Expand Down Expand Up @@ -149,6 +154,12 @@ icon: material/alert-decagram
"default_interface_address": [
"2000::/3"
],
"source_mac_address": [
"00:11:22:33:44:55"
],
"source_hostname": [
"my-device"
],
"wifi_ssid": [
"My WIFI"
],
Expand Down Expand Up @@ -407,6 +418,26 @@ Available values: `wifi`, `cellular`, `ethernet` and `other`.

匹配默认接口地址。

#### source_mac_address

!!! question "自 sing-box 1.14.0 起"

!!! quote ""

仅支持 Linux、macOS,或在 Android 和 macOS 图形客户端中支持。参阅 [邻居解析](/configuration/shared/neighbor/) 了解设置方法。

匹配源设备 MAC 地址。

#### source_hostname

!!! question "自 sing-box 1.14.0 起"

!!! quote ""

仅支持 Linux、macOS,或在 Android 和 macOS 图形客户端中支持。参阅 [邻居解析](/configuration/shared/neighbor/) 了解设置方法。

匹配源设备从 DHCP 租约获取的主机名。

#### wifi_ssid

!!! quote ""
Expand Down
3 changes: 2 additions & 1 deletion docs/configuration/inbound/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
| `hysteria2` | [Hysteria2](./hysteria2/) | :material-close: |
| `vless` | [VLESS](./vless/) | TCP |
| `anytls` | [AnyTLS](./anytls/) | TCP |
| `trusttunnel` | [TrustTunnel](./trusttunnel/) | TCP |
| `tun` | [Tun](./tun/) | :material-close: |
| `redirect` | [Redirect](./redirect/) | :material-close: |
| `tproxy` | [TProxy](./tproxy/) | :material-close: |

#### tag

The tag of the inbound.
The tag of the inbound.
3 changes: 2 additions & 1 deletion docs/configuration/inbound/index.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@
| `hysteria2` | [Hysteria2](./hysteria2/) | :material-close: |
| `vless` | [VLESS](./vless/) | TCP |
| `anytls` | [AnyTLS](./anytls/) | TCP |
| `trusttunnel` | [TrustTunnel](./trusttunnel/) | TCP |
| `tun` | [Tun](./tun/) | :material-close: |
| `redirect` | [Redirect](./redirect/) | :material-close: |
| `tproxy` | [TProxy](./tproxy/) | :material-close: |

#### tag

入站的标签。
入站的标签。
80 changes: 80 additions & 0 deletions docs/configuration/inbound/trusttunnel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
icon: material/new-box
---

!!! question "Since sing-box 1.14.0"

### Structure

```json
{
"type": "trusttunnel",
"tag": "trusttunnel-in",

... // Listen Fields

"users": [
{
"username": "trust",
"password": "tunnel"
}
],
"quic_congestion_control": "bbr",
"network": "tcp,udp",
"tls": {}
}
```

### Listen Fields

See [Listen Fields](/configuration/shared/listen/) for details.

### Fields

#### users

==Required==

TrustTunnel user list.

#### users.username

==Required==

TrustTunnel username.

#### users.password

==Required==

TrustTunnel user password.

#### quic_congestion_control

QUIC congestion control algorithm.

| Algorithm | Description |
|-----------|-------------|
| `bbr` | BBR |
| `bbr_standard` | BBR (Standard version) |
| `bbr2` | BBRv2 |
| `bbr_variant` | BBRv2 (An experimental variant) |
| `cubic` | CUBIC |
| `reno` | New Reno |

`bbr` is used by default.

#### network

Network list.

Available values:

- `tcp` (HTTP/2)
- `udp` (HTTP/3)

When `udp` is enabled, `tls` must be enabled.

#### tls

Inbound TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
Loading