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 @@
2fef65f9dba90ddb89a87d00a6eb6165487c10c1
ea7cd33752aed62603775af3df946c1b83f4b0b3
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
57 changes: 57 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
icon: material/alert-decagram
---

#### 1.14.0-alpha.3

* Fixes and improvements

#### 1.13.3

* Add OpenWrt and Alpine APK packages to release **1**
Expand All @@ -26,6 +30,59 @@ from [SagerNet/go](https://github.com/SagerNet/go).

See [OCM](/configuration/service/ocm).

#### 1.12.24

* Fixes and improvements

#### 1.14.0-alpha.2

* Add OpenWrt and Alpine APK packages to release **1**
* Backport to macOS 10.13 High Sierra **2**
* OCM service: Add WebSocket support for Responses API **3**
* Fixes and improvements

**1**:

Alpine APK files use `linux` in the filename to distinguish from OpenWrt APKs which use the `openwrt` prefix:

- OpenWrt: `sing-box_{version}_openwrt_{architecture}.apk`
- Alpine: `sing-box_{version}_linux_{architecture}.apk`

**2**:

Legacy macOS binaries (with `-legacy-macos-10.13` suffix) now support
macOS 10.13 High Sierra, built using Go 1.25 with patches
from [SagerNet/go](https://github.com/SagerNet/go).

**3**:

See [OCM](/configuration/service/ocm).

#### 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
30 changes: 30 additions & 0 deletions docs/configuration/inbound/tun.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ icon: material/new-box
"exclude_package": [
"com.android.captiveportallogin"
],
"include_mac_address": [
"00:11:22:33:44:55"
],
"exclude_mac_address": [
"66:77:88:99:aa:bb"
],
"platform": {
"http_proxy": {
"enabled": false,
Expand Down Expand Up @@ -560,6 +566,30 @@ Limit android packages in route.

Exclude android packages in route.

#### include_mac_address

!!! question "Since sing-box 1.14.0"

!!! quote ""

Only supported on Linux with `auto_route` and `auto_redirect` enabled.

Limit MAC addresses in route. Not limited by default.

Conflict with `exclude_mac_address`.

#### exclude_mac_address

!!! question "Since sing-box 1.14.0"

!!! quote ""

Only supported on Linux with `auto_route` and `auto_redirect` enabled.

Exclude MAC addresses in route.

Conflict with `include_mac_address`.

#### platform

Platform-specific settings, provided by client applications.
Expand Down
35 changes: 35 additions & 0 deletions docs/configuration/inbound/tun.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
icon: material/new-box
---

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

:material-plus: [include_mac_address](#include_mac_address)
:material-plus: [exclude_mac_address](#exclude_mac_address)

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

:material-alert: [strict_route](#strict_route)
Expand Down Expand Up @@ -130,6 +135,12 @@ icon: material/new-box
"exclude_package": [
"com.android.captiveportallogin"
],
"include_mac_address": [
"00:11:22:33:44:55"
],
"exclude_mac_address": [
"66:77:88:99:aa:bb"
],
"platform": {
"http_proxy": {
"enabled": false,
Expand Down Expand Up @@ -543,6 +554,30 @@ TCP/IP 栈。

排除路由的 Android 应用包名。

#### include_mac_address

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

!!! quote ""

仅支持 Linux,且需要 `auto_route` 和 `auto_redirect` 已启用。

限制被路由的 MAC 地址。默认不限制。

与 `exclude_mac_address` 冲突。

#### exclude_mac_address

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

!!! quote ""

仅支持 Linux,且需要 `auto_route` 和 `auto_redirect` 已启用。

排除路由的 MAC 地址。

与 `include_mac_address` 冲突。

#### platform

平台特定的设置,由客户端应用提供。
Expand Down
40 changes: 40 additions & 0 deletions docs/configuration/route/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ icon: material/alert-decagram

# Route

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

:material-plus: [find_neighbor](#find_neighbor)
:material-plus: [dhcp_lease_files](#dhcp_lease_files)

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

:material-plus: [default_domain_resolver](#default_domain_resolver)
Expand Down Expand Up @@ -35,6 +40,9 @@ icon: material/alert-decagram
"override_android_vpn": false,
"default_interface": "",
"default_mark": 0,
"find_process": false,
"find_neighbor": false,
"dhcp_lease_files": [],
"default_domain_resolver": "", // or {}
"default_network_strategy": "",
"default_network_type": [],
Expand Down Expand Up @@ -107,6 +115,38 @@ Set routing mark by default.

Takes no effect if `outbound.routing_mark` is set.

#### find_process

!!! quote ""

Only supported on Linux, Windows, and macOS.

Enable process search for logging when no `process_name`, `process_path`, `package_name`, `user` or `user_id` rules exist.

#### find_neighbor

!!! question "Since sing-box 1.14.0"

!!! quote ""

Only supported on Linux and macOS.

Enable neighbor resolution for logging when no `source_mac_address` or `source_hostname` rules exist.

See [Neighbor Resolution](/configuration/shared/neighbor/) for setup.

#### dhcp_lease_files

!!! question "Since sing-box 1.14.0"

!!! quote ""

Only supported on Linux and macOS.

Custom DHCP lease file paths for hostname and MAC address resolution.

Automatically detected from common DHCP servers (dnsmasq, odhcpd, ISC dhcpd, Kea) if empty.

#### default_domain_resolver

!!! question "Since sing-box 1.12.0"
Expand Down
Loading
Loading