Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
4d217b7
Add MAC and hostname rule items
nekohasekai Mar 3, 2026
f802668
Add Android support for MAC and hostname rule items
nekohasekai Mar 4, 2026
44d1c86
Add macOS support for MAC and hostname rule items
nekohasekai Mar 6, 2026
9462b1d
documentation: Update descriptions for neighbor rules
nekohasekai Mar 6, 2026
bd0fb83
cronet-go: Update chromium to 145.0.7632.159
nekohasekai Mar 11, 2026
a11cd1e
Bump version
nekohasekai Mar 7, 2026
2801bce
ccm/ocm: Add multi-credential support with balancer and fallback stra…
nekohasekai Mar 10, 2026
da8ff6f
ccm/ocm: Add external credential support for cross-instance usage sha…
nekohasekai Mar 12, 2026
8e5811a
ccm,ocm: watch credential_path and allow delayed credentials
nekohasekai Mar 12, 2026
6829f91
ccm,ocm: check credential file writability before token refresh
nekohasekai Mar 12, 2026
b96ab4f
ccm,ocm,ssmapi: fix HTTP/2 over TLS with h2c handler
nekohasekai Mar 12, 2026
15f3619
ccm,ocm: strip reverse proxy headers before forwarding to upstream
nekohasekai Mar 12, 2026
970951f
ccm,ocm: add reverse proxy support for external credentials
nekohasekai Mar 13, 2026
af94ea9
Fix reverse external credential handling
nekohasekai Mar 13, 2026
02a1409
ccm,ocm: unify HTTP request retry with fast retry and exponential bac…
nekohasekai Mar 13, 2026
1824881
ccm,ocm: reset connector backoff after successful connection
nekohasekai Mar 13, 2026
3b177df
ccm,ocm: fix data race on reverseContext/reverseCancel
nekohasekai Mar 13, 2026
4d5108f
ccm,ocm: fix connector-side bufio data loss in reverse proxy
nekohasekai Mar 13, 2026
ff8585f
ccm,ocm: block utilization decrease within same rate-limit window
nekohasekai Mar 13, 2026
74bf20d
ccm,ocm: fix reverse session shutdown race
nekohasekai Mar 13, 2026
2237647
ccm,ocm: fix passive usage update for WebSocket connections
nekohasekai Mar 13, 2026
1993da3
ocm: rewrite codex.rate_limits WebSocket events for external users
nekohasekai Mar 13, 2026
df6e47f
ocm: preserve websocket rate limit event fields
nekohasekai Mar 13, 2026
7f93c76
ccm,ocm: add limit options and fix aggregated utilization scaling
nekohasekai Mar 13, 2026
ce543a9
ccm,ocm: fix reserveWeekly default and remove dead reserve fields
nekohasekai Mar 13, 2026
a09174a
service/ccm: reject fast-mode external credentials
nekohasekai Mar 13, 2026
ee65b37
service/ccm: allow extended context (1m) for all credentials
nekohasekai Mar 14, 2026
1628272
ccm,ocm: mark credentials unusable on usage poll failure and trigger …
nekohasekai Mar 14, 2026
615a7e0
service/ccm: only log new credential assignments and show context win…
nekohasekai Mar 14, 2026
25a9e4c
service/ocm: only log new credential assignments and add websocket lo…
nekohasekai Mar 14, 2026
8984b45
ccm,ocm: improve balancer least_used with plan-weighted scoring and r…
nekohasekai Mar 14, 2026
80d5432
service/ccm: update oauth token URL and remove unnecessary Accept header
nekohasekai Mar 14, 2026
6f43393
ccm,ocm: auto-detect plan weight for external credentials via status …
nekohasekai Mar 14, 2026
8fe8e23
service/ocm: unify websocket logging with HTTP request logging
nekohasekai Mar 14, 2026
f4aaf33
ccm,ocm: strip reverse proxy headers from upstream responses
nekohasekai Mar 14, 2026
badeeb9
service/ocm: add default OpenAI-Beta header and log websocket error body
nekohasekai Mar 14, 2026
b97b9d9
ccm,ocm: add request ID context to HTTP request logging
nekohasekai Mar 14, 2026
f871113
ccm,ocm: add balancer session rebalancing with per-credential interrupt
nekohasekai Mar 14, 2026
d230035
Propagate request context to upstream requests
nekohasekai Mar 14, 2026
2c907be
Fix scoped rebalance interrupts
nekohasekai Mar 14, 2026
4d907bc
ccm,ocm: allow URL-based credentials to accept reverse connections
nekohasekai Mar 14, 2026
d1e5426
ccm,ocm: add exponential backoff with cap for poll retry
nekohasekai Mar 14, 2026
4d8baf7
ccm: fix nil pointer in pollUsage for connector-mode credentials
nekohasekai Mar 14, 2026
51d564c
ccm,ocm: merge fallback into balancer strategy, use hyphenated consta…
nekohasekai Mar 14, 2026
04bd63b
ccm,ocm: reorganize files and improve naming conventions
nekohasekai Mar 14, 2026
6878ad0
ccm,ocm: fix naming and error-handling convention violations
nekohasekai Mar 14, 2026
56af731
ccm,ocm: don't treat usage API 429 as account over-limit
nekohasekai Mar 14, 2026
bc6e724
ccm,ocm: block API key headers from being forwarded upstream
nekohasekai Mar 14, 2026
8e9c61e
ccm,ocm: normalize legacy fields into credentials at init, remove dua…
nekohasekai Mar 15, 2026
656b09d
ccm,ocm: never treat external usage endpoint failures as over-limit
nekohasekai Mar 15, 2026
763e0af
docs: complete ccm/ocm documentation for 1.14.0 features
nekohasekai Mar 15, 2026
9e3ec30
docs: fix ccm and ocm credential docs
nekohasekai Mar 15, 2026
14ade76
ccm,ocm: remove dead code, fix timer leaks, eliminate redundant lookups
nekohasekai Mar 15, 2026
2dd093a
ccm,ocm: fix data race, remove dead code, clean up inefficiencies
nekohasekai Mar 15, 2026
f3c3022
ccm,ocm: fix session race, track fallback sessions, skip warmup logging
nekohasekai Mar 16, 2026
f84832a
Add stream watch endpoint
nekohasekai Mar 17, 2026
4a6a211
ccm,ocm: reduce status emission noise, simplify emit-guard pattern
nekohasekai Mar 17, 2026
cf2d677
ocm: emit status updates for plan-weight-only changes
nekohasekai Mar 17, 2026
7d15d9d
ccm: emit status updates for plan-weight-only changes
nekohasekai Mar 17, 2026
0a054b9
ccm,ocm: propagate reset times, rewrite headers for all users, add WS…
nekohasekai Mar 17, 2026
f57eff3
ccm,ocm: fix WS push lifecycle, deduplicate rate_limits, stabilize re…
nekohasekai Mar 17, 2026
969defe
ccm,ocm: validate external status response fields
nekohasekai Mar 17, 2026
99e19e7
service: stop retrying fatal watch status errors
nekohasekai Mar 17, 2026
a2d6cf9
fix(ocm): defer initial websocket rate-limit push
nekohasekai Mar 17, 2026
b3429ef
fix(ocm): strip non-active rate-limit headers from forwarded responses
nekohasekai Mar 17, 2026
6b8838d
fix(ccm,ocm): restart status stream when receiver gets reverse session
nekohasekai Mar 17, 2026
b119d08
fix(ccm,ocm): add usage logging to status stream, remove redundant is…
nekohasekai Mar 17, 2026
3bcfdd5
fix(ccm,ocm): remove external context from pollUsage/pollIfStale
nekohasekai Mar 17, 2026
2fe1e37
fix(ccm,ocm): add missing isFirstUpdate to external credential usage …
nekohasekai Mar 17, 2026
7acba74
fix(ccm): forward 529 upstream overloaded response transparently
nekohasekai Mar 18, 2026
608b7e7
fix(ccm,ocm): stop cascading 429 retry storm on token refresh
nekohasekai Mar 21, 2026
99d9e06
fix(ccm,ocm): handle upstream 400 by marking external credentials rej…
nekohasekai Mar 21, 2026
53f8323
fix(ccm): adapt to Claude Code v2.1.78 metadata format, separate stat…
nekohasekai Mar 21, 2026
29b901a
fix(ccm): robust account UUID injection and session ID validation
nekohasekai Mar 21, 2026
f172a57
fix(ccm): log assigned credential for each distinct model per session
nekohasekai Mar 21, 2026
0950783
fix(ccm,ocm): exclude unusable credentials from status aggregation
nekohasekai Mar 21, 2026
084a6f1
fix(ccm): align OAuth token refresh with Claude Code v2.1.81
nekohasekai Mar 21, 2026
d996b60
ccm/ocm: Add CLAUDE.md
nekohasekai Mar 21, 2026
bb2169b
release: Fix install_go.sh
nekohasekai Mar 21, 2026
441c988
feat(ccm): add claude_directory option to read Claude Code config
nekohasekai Mar 22, 2026
92c8f4c
fix(ccm): align default credential with Claude Code
nekohasekai Mar 24, 2026
4592164
Align CCM and OCM rate limits
nekohasekai Mar 24, 2026
6721dff
fix(ocm): send rate limit status immediately on WebSocket connect
nekohasekai Mar 26, 2026
1774d98
fix(ccm,ocm): restore fixed usage polling
nekohasekai Mar 26, 2026
ca60f93
fix(ocm): inject synthetic rate limits inline when intercepting upstr…
nekohasekai Mar 26, 2026
6f45ea9
Revert "fix(ocm): inject synthetic rate limits inline when intercepti…
nekohasekai Mar 26, 2026
e1c9667
Revert "fix(ocm): send rate limit status immediately on WebSocket con…
nekohasekai Mar 26, 2026
e49d068
ccm: Fix token refresh
nekohasekai Mar 26, 2026
cd5007f
fix(ccm,ocm): track external credential poll failures and re-poll on …
nekohasekai Mar 26, 2026
d9c298a
fix(ccm,ocm): remove upstream rate limit header forwarding, compute l…
nekohasekai Mar 26, 2026
a87a2b0
ocm: log think level
nekohasekai Mar 27, 2026
cf11e0e
Reuse SDK JSON types in ccm and ocm
nekohasekai Mar 28, 2026
e7478ce
fix(ccm): mark credential unavailable on refresh failure, handle poll…
nekohasekai Mar 28, 2026
471c9c3
fix(ccm): make refresh failure fail fast
nekohasekai Mar 28, 2026
bf9e390
fix(ccm,ocm): allow reverse connector credentials to serve local requ…
nekohasekai Mar 28, 2026
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
.DS_Store
/config.d/
/venv/
CLAUDE.md
AGENTS.md
/CLAUDE.md
/AGENTS.md
/.claude/
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
7 changes: 7 additions & 0 deletions constant/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ const (
TypeURLTest = "urltest"
)

const (
BalancerStrategyLeastUsed = "least-used"
BalancerStrategyRoundRobin = "round-robin"
BalancerStrategyRandom = "random"
BalancerStrategyFallback = "fallback"
)

func ProxyDisplayName(proxyType string) string {
switch proxyType {
case TypeTun:
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
35 changes: 35 additions & 0 deletions docs/configuration/inbound/tun.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
icon: material/new-box
---

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

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

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

:material-alert: [strict_route](#strict_route)
Expand Down Expand Up @@ -129,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 @@ -555,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
Loading