Compare commits

..

95 Commits

Author SHA1 Message Date
世界
0613431623 documentation: Bump version 2025-05-24 08:24:40 +08:00
世界
95aa5d05b7 Fix tailscale forward 2025-05-24 08:24:23 +08:00
世界
0ccfb8ad96 Minor fixes 2025-05-24 08:22:55 +08:00
世界
86fe2aee98 Update quic-go to v0.52.0 2025-05-24 08:22:55 +08:00
世界
1b2cce77f1 Add SSM API service 2025-05-24 08:22:55 +08:00
世界
4b1a283bbf Add resolved service and DNS server 2025-05-24 08:22:54 +08:00
世界
f91cbc0e42 Add DERP service 2025-05-24 08:22:54 +08:00
世界
7d1b88e1cd Add service component type 2025-05-24 08:22:54 +08:00
世界
a4ad775fb7 Fix tproxy tcp control 2025-05-24 08:22:54 +08:00
愚者
88bfc6fd77 release: Fix build tags for android
Signed-off-by: 愚者 <11926619+FansChou@users.noreply.github.com>
2025-05-24 08:22:54 +08:00
世界
cd8501736d prevent creation of bind and mark controls on unsupported platforms 2025-05-24 08:22:53 +08:00
PuerNya
cc05b89b59 documentation: Fix description of reject DNS action behavior 2025-05-24 08:22:53 +08:00
Restia-Ashbell
f8bfe56458 Fix TLS record fragment 2025-05-24 08:22:53 +08:00
世界
f9942b7c50 Add missing accept_routes option for Tailscale 2025-05-24 08:22:53 +08:00
世界
41915a6621 Add TLS record fragment support 2025-05-24 08:22:53 +08:00
世界
2d6894f28a release: Update Go to 1.24.3 2025-05-24 08:22:53 +08:00
世界
93ceb33780 Fix set edns0 client subnet 2025-05-24 08:22:52 +08:00
世界
f643e35d00 Update minor dependencies 2025-05-24 08:22:52 +08:00
世界
cbcc4f4cfb Update certmagic and providers 2025-05-24 08:22:52 +08:00
世界
feab546659 Update protobuf and grpc 2025-05-24 08:22:52 +08:00
世界
5a3be48d7b Add control options for listeners 2025-05-24 08:22:51 +08:00
世界
ef2f170364 Update quic-go to v0.51.0 2025-05-24 08:22:51 +08:00
世界
5022d9a924 Update utls to v1.7.2 2025-05-24 08:22:51 +08:00
世界
50d61c09cf Handle EDNS version downgrade 2025-05-24 08:22:50 +08:00
世界
bcc703310e documentation: Fix anytls padding scheme description 2025-05-24 08:22:50 +08:00
安容
a6c448e145 Report invalid DNS address early 2025-05-24 08:22:50 +08:00
世界
11105eb553 Fix wireguard listen_port 2025-05-24 08:22:49 +08:00
世界
18e240e5b3 clash-api: Add more meta api 2025-05-24 08:22:49 +08:00
世界
03bb284370 Fix DNS lookup 2025-05-24 08:22:48 +08:00
世界
bc63aa2254 Fix fetch ECH configs 2025-05-24 08:22:48 +08:00
reletor
abbe2f7eaf documentation: Minor fixes 2025-05-24 08:22:48 +08:00
caelansar
33d576a018 Fix callback deletion in UDP transport 2025-05-24 08:22:48 +08:00
世界
38e34c7719 documentation: Try to make the play review happy 2025-05-24 08:22:47 +08:00
世界
03d086c32e Fix missing handling of legacy domain_strategy options 2025-05-24 08:22:47 +08:00
世界
52de97edf1 Improve local DNS server 2025-05-24 08:22:46 +08:00
anytls
0e68b1a29e Update anytls
Co-authored-by: anytls <anytls>
2025-05-24 08:22:46 +08:00
世界
6b43758d8e Fix DNS dialer 2025-05-24 08:22:46 +08:00
世界
9957ab6e8b release: Skip override version for iOS 2025-05-24 08:22:46 +08:00
iikira
36aef228bf Fix UDP DNS server crash
Signed-off-by: iikira <i2@mail.iikira.com>
2025-05-24 08:22:45 +08:00
ReleTor
82ba228c39 Fix fetch ECH configs 2025-05-24 08:22:45 +08:00
世界
7acc036c6e Allow direct outbounds without domain_resolver 2025-05-24 08:22:44 +08:00
世界
78439340cf Fix Tailscale dialer 2025-05-24 08:22:44 +08:00
dyhkwong
7fd99aa515 Fix DNS over QUIC stream close 2025-05-24 08:22:44 +08:00
anytls
5d30bfabae Update anytls
Co-authored-by: anytls <anytls>
2025-05-24 08:22:44 +08:00
Rambling2076
c29d56699f Fix missing with_tailscale in Dockerfile
Signed-off-by: Rambling2076 <Rambling2076@proton.me>
2025-05-24 08:22:44 +08:00
世界
5c4518e6a4 Fail when default DNS server not found 2025-05-24 08:22:43 +08:00
世界
58bf4c1e85 Update gVisor to 20250319.0 2025-05-24 08:22:43 +08:00
世界
49d8408fdf Explicitly reject detour to empty direct outbounds 2025-05-24 08:22:43 +08:00
世界
01cbc4810a Add netns support 2025-05-24 08:22:43 +08:00
世界
d9b5ca3e82 Add wildcard name support for predefined records 2025-05-24 08:22:43 +08:00
世界
6c2b4dce4a Remove map usage in options 2025-05-24 08:22:42 +08:00
世界
daeb14bdd2 Fix unhandled DNS loop 2025-05-24 08:22:41 +08:00
世界
7d7aa4a328 Add wildcard-sni support for shadow-tls inbound 2025-05-24 08:22:40 +08:00
k9982874
f0f0b658f7 Add ntp protocol sniffing 2025-05-24 08:22:40 +08:00
世界
de2546f572 option: Fix marshal legacy DNS options 2025-05-24 08:22:40 +08:00
世界
fcb8171ff5 Make domain_resolver optional when only one DNS server is configured 2025-05-24 08:22:39 +08:00
世界
a53c6a906f Fix DNS lookup context pollution 2025-05-24 08:22:39 +08:00
世界
8637c536c8 Fix http3 DNS server connecting to wrong address 2025-05-24 08:22:38 +08:00
Restia-Ashbell
db7a0c6092 documentation: Fix typo 2025-05-24 08:22:38 +08:00
anytls
87d287dd56 Update sing-anytls
Co-authored-by: anytls <anytls>
2025-05-24 08:22:38 +08:00
k9982874
ee65df4dfc Fix hosts DNS server 2025-05-24 08:22:37 +08:00
世界
f9f5a0c724 Fix UDP DNS server crash 2025-05-24 08:22:37 +08:00
世界
96e81b6e76 documentation: Fix missing ip_accept_any DNS rule option 2025-05-24 08:22:37 +08:00
世界
883bea6628 Fix anytls dialer usage 2025-05-24 08:22:36 +08:00
世界
62b98fcc4c Move predefined DNS server to rule action 2025-05-24 08:22:36 +08:00
世界
c0d7198ac2 Fix domain resolver on direct outbound 2025-05-24 08:22:35 +08:00
Zephyruso
da1cdcb784 Fix missing AnyTLS display name 2025-05-24 08:22:35 +08:00
anytls
cd284a4368 Update sing-anytls
Co-authored-by: anytls <anytls>
2025-05-24 08:22:35 +08:00
Estel
33e9d719f8 documentation: Fix typo
Signed-off-by: Estel <callmebedrockdigger@gmail.com>
2025-05-24 08:22:34 +08:00
TargetLocked
f0a3ba5bc8 Fix parsing legacy DNS options 2025-05-24 08:22:34 +08:00
世界
b96a6b595e Fix DNS fallback 2025-05-24 08:22:33 +08:00
世界
be29171106 documentation: Fix missing hosts DNS server 2025-05-24 08:22:33 +08:00
anytls
c66b32c859 Add MinIdleSession option to AnyTLS outbound
Co-authored-by: anytls <anytls>
2025-05-24 08:22:33 +08:00
ReleTor
984ebbb288 documentation: Minor fixes 2025-05-24 08:22:33 +08:00
libtry486
c5929cf948 documentation: Fix typo
fix typo

Signed-off-by: libtry486 <89328481+libtry486@users.noreply.github.com>
2025-05-24 08:22:32 +08:00
Alireza Ahmadi
be45dd2716 Fix Outbound deadlock 2025-05-24 08:22:32 +08:00
世界
a20f525048 documentation: Fix AnyTLS doc 2025-05-24 08:22:31 +08:00
anytls
31ebe2f39f Add AnyTLS protocol 2025-05-24 08:22:31 +08:00
世界
61b9da2f1a Migrate to stdlib ECH support 2025-05-24 08:22:30 +08:00
世界
f5c738ea9d Add fallback local DNS server for iOS 2025-05-24 08:22:29 +08:00
世界
ebc783b580 Get darwin local DNS server from libresolv 2025-05-24 08:22:29 +08:00
世界
a5b6dff812 Improve resolve action 2025-05-24 08:22:29 +08:00
世界
cc4e90c861 Add back port hopping to hysteria 1 2025-05-24 08:22:28 +08:00
xchacha20-poly1305
2abce0959a Remove single quotes of raw Moziila certs 2025-05-24 08:22:28 +08:00
世界
a98cb0fd84 Add Tailscale endpoint 2025-05-24 08:22:27 +08:00
世界
7b96406592 Build legacy binaries with latest Go 2025-05-24 08:22:27 +08:00
世界
4fea063b6f documentation: Remove outdated icons 2025-05-24 08:22:27 +08:00
世界
1672d5a84a documentation: Certificate store 2025-05-24 08:22:26 +08:00
世界
4a1b69c1d4 documentation: TLS fragment 2025-05-24 08:22:25 +08:00
世界
e2c1ff3a11 documentation: Outbound domain resolver 2025-05-24 08:22:25 +08:00
世界
37dd8fa692 documentation: Refactor DNS 2025-05-24 08:22:25 +08:00
世界
29b6a75f16 Add certificate store 2025-05-24 08:22:25 +08:00
世界
7575746f72 Add TLS fragment support 2025-05-24 08:22:03 +08:00
世界
f35a58b7ee refactor: Outbound domain resolver 2025-05-24 08:22:02 +08:00
世界
4aacdade73 refactor: DNS 2025-05-24 08:21:59 +08:00
11 changed files with 118 additions and 27 deletions

View File

@@ -80,7 +80,7 @@ jobs:
- name: Set build tags
run: |
set -xeuo pipefail
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api,with_tailscale'
TAGS='with_gvisor,with_quic,with_dhcp,with_wireguard,with_utls,with_acme,with_clash_api'
echo "BUILD_TAGS=${TAGS}" >> "${GITHUB_ENV}"
- name: Build
run: |

View File

@@ -105,7 +105,7 @@ func publishTestflight(ctx context.Context) error {
return err
}
tag := tagVersion.VersionString()
client := createClient(20 * time.Minute)
client := createClient(10 * time.Minute)
log.Info(tag, " list build IDs")
buildIDsResponse, _, err := client.TestFlight.ListBuildIDsForBetaGroup(ctx, groupID, nil)
@@ -145,7 +145,7 @@ func publishTestflight(ctx context.Context) error {
return err
}
build := builds.Data[0]
if common.Contains(buildIDs, build.ID) || time.Since(build.Attributes.UploadedDate.Time) > 30*time.Minute {
if common.Contains(buildIDs, build.ID) || time.Since(build.Attributes.UploadedDate.Time) > 5*time.Minute {
log.Info(string(platform), " ", tag, " waiting for process")
time.Sleep(15 * time.Second)
continue

58
common/sniff/ntp.go Normal file
View File

@@ -0,0 +1,58 @@
package sniff
import (
"context"
"encoding/binary"
"os"
"github.com/sagernet/sing-box/adapter"
C "github.com/sagernet/sing-box/constant"
)
func NTP(ctx context.Context, metadata *adapter.InboundContext, packet []byte) error {
// NTP packets must be at least 48 bytes long (standard NTP header size).
pLen := len(packet)
if pLen < 48 {
return os.ErrInvalid
}
// Check the LI (Leap Indicator) and Version Number (VN) in the first byte.
// We'll primarily focus on ensuring the version is valid for NTP.
// Many NTP versions are used, but let's check for generally accepted ones (3 & 4 for IPv4, plus potential extensions/customizations)
firstByte := packet[0]
li := (firstByte >> 6) & 0x03 // Extract LI
vn := (firstByte >> 3) & 0x07 // Extract VN
mode := firstByte & 0x07 // Extract Mode
// Leap Indicator should be a valid value (0-3).
if li > 3 {
return os.ErrInvalid
}
// Version Check (common NTP versions are 3 and 4)
if vn != 3 && vn != 4 {
return os.ErrInvalid
}
// Check the Mode field for a client request (Mode 3). This validates it *is* a request.
if mode != 3 {
return os.ErrInvalid
}
// Check Root Delay and Root Dispersion. While not strictly *required* for a request,
// we can check if they appear to be reasonable values (not excessively large).
rootDelay := binary.BigEndian.Uint32(packet[4:8])
rootDispersion := binary.BigEndian.Uint32(packet[8:12])
// Check for unreasonably large root delay and dispersion. NTP RFC specifies max values of approximately 16 seconds.
// Convert to milliseconds for easy comparison. Each unit is 1/2^16 seconds.
if float64(rootDelay)/65536.0 > 16.0 {
return os.ErrInvalid
}
if float64(rootDispersion)/65536.0 > 16.0 {
return os.ErrInvalid
}
metadata.Protocol = C.ProtocolNTP
return nil
}

33
common/sniff/ntp_test.go Normal file
View File

@@ -0,0 +1,33 @@
package sniff_test
import (
"context"
"encoding/hex"
"os"
"testing"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/common/sniff"
C "github.com/sagernet/sing-box/constant"
"github.com/stretchr/testify/require"
)
func TestSniffNTP(t *testing.T) {
t.Parallel()
packet, err := hex.DecodeString("1b0006000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
require.NoError(t, err)
var metadata adapter.InboundContext
err = sniff.NTP(context.Background(), &metadata, packet)
require.NoError(t, err)
require.Equal(t, metadata.Protocol, C.ProtocolNTP)
}
func TestSniffNTPFailed(t *testing.T) {
t.Parallel()
packet, err := hex.DecodeString("400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")
require.NoError(t, err)
var metadata adapter.InboundContext
err = sniff.NTP(context.Background(), &metadata, packet)
require.ErrorIs(t, err, os.ErrInvalid)
}

View File

@@ -2,7 +2,7 @@
icon: material/alert-decagram
---
#### 1.12.0-beta.19
#### 1.12.0-beta.18
* Fixes and improvements

View File

@@ -22,6 +22,7 @@ If enabled in the inbound, the protocol and domain name (if present) of by the c
| UDP | `dtls` | / | / |
| TCP | `ssh` | / | SSH Client Name |
| TCP | `rdp` | / | / |
| UDP | `ntp` | / | / |
| QUIC Client | Type |
|:------------------------:|:----------:|

View File

@@ -22,6 +22,7 @@
| UDP | `dtls` | / | / |
| TCP | `ssh` | / | SSH 客户端名称 |
| TCP | `rdp` | / | / |
| UDP | `ntp` | / | / |
| QUIC 客户端 | 类型 |
|:------------------------:|:----------:|

2
go.mod
View File

@@ -32,7 +32,7 @@ require (
github.com/sagernet/sing-mux v0.3.2
github.com/sagernet/sing-quic v0.5.0-beta.1
github.com/sagernet/sing-shadowsocks v0.2.7
github.com/sagernet/sing-shadowsocks2 v0.2.1
github.com/sagernet/sing-shadowsocks2 v0.2.0
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11
github.com/sagernet/sing-tun v0.6.6-0.20250428031943-0686f8c4f210
github.com/sagernet/sing-vmess v0.2.2-0.20250503051933-9b4cf17393f8

4
go.sum
View File

@@ -176,8 +176,8 @@ github.com/sagernet/sing-quic v0.5.0-beta.1 h1:nC0i/s8LhlZB8ev6laZCXF/uiwAE4kRdT
github.com/sagernet/sing-quic v0.5.0-beta.1/go.mod h1:SAv/qdeDN+75msGG5U5ZIwG+3Ua50jVIKNrRSY8pkx0=
github.com/sagernet/sing-shadowsocks v0.2.7 h1:zaopR1tbHEw5Nk6FAkM05wCslV6ahVegEZaKMv9ipx8=
github.com/sagernet/sing-shadowsocks v0.2.7/go.mod h1:0rIKJZBR65Qi0zwdKezt4s57y/Tl1ofkaq6NlkzVuyE=
github.com/sagernet/sing-shadowsocks2 v0.2.1 h1:dWV9OXCeFPuYGHb6IRqlSptVnSzOelnqqs2gQ2/Qioo=
github.com/sagernet/sing-shadowsocks2 v0.2.1/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
github.com/sagernet/sing-shadowsocks2 v0.2.0 h1:wpZNs6wKnR7mh1wV9OHwOyUr21VkS3wKFHi+8XwgADg=
github.com/sagernet/sing-shadowsocks2 v0.2.0/go.mod h1:RnXS0lExcDAovvDeniJ4IKa2IuChrdipolPYWBv9hWQ=
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11 h1:tK+75l64tm9WvEFrYRE1t0YxoFdWQqw/h7Uhzj0vJ+w=
github.com/sagernet/sing-shadowtls v0.2.1-0.20250503051639-fcd445d33c11/go.mod h1:sWqKnGlMipCHaGsw1sTTlimyUpgzP4WP3pjhCsYt9oA=
github.com/sagernet/sing-tun v0.6.6-0.20250428031943-0686f8c4f210 h1:6H4BZaTqKI3YcDMyTV3E576LuJM4S4wY99xoq2T1ECw=

View File

@@ -499,9 +499,7 @@ func (r *Router) actionSniff(
return
}
if inputConn != nil {
if len(action.StreamSniffers) == 0 && len(action.PacketSniffers) > 0 {
return
}
sniffBuffer := buf.NewPacket()
var streamSniffers []sniff.StreamSniffer
if len(action.StreamSniffers) > 0 {
streamSniffers = action.StreamSniffers
@@ -515,7 +513,6 @@ func (r *Router) actionSniff(
sniff.RDP,
}
}
sniffBuffer := buf.NewPacket()
err := sniff.PeekStream(
ctx,
metadata,
@@ -547,25 +544,10 @@ func (r *Router) actionSniff(
sniffBuffer.Release()
}
} else if inputPacketConn != nil {
if len(action.PacketSniffers) == 0 && len(action.StreamSniffers) > 0 {
return
} else if metadata.PacketSniffError != nil && !errors.Is(metadata.PacketSniffError, sniff.ErrNeedMoreData) {
if metadata.PacketSniffError != nil && !errors.Is(metadata.PacketSniffError, sniff.ErrNeedMoreData) {
r.logger.DebugContext(ctx, "packet sniff skipped due to previous error: ", metadata.PacketSniffError)
return
}
var packetSniffers []sniff.PacketSniffer
if len(action.PacketSniffers) > 0 {
packetSniffers = action.PacketSniffers
} else {
packetSniffers = []sniff.PacketSniffer{
sniff.DomainNameQuery,
sniff.QUICClientHello,
sniff.STUNMessage,
sniff.UTP,
sniff.UDPTracker,
sniff.DTLSRecord,
}
}
for {
var (
sniffBuffer = buf.NewPacket()
@@ -605,6 +587,20 @@ func (r *Router) actionSniff(
sniff.QUICClientHello,
)
} else {
var packetSniffers []sniff.PacketSniffer
if len(action.PacketSniffers) > 0 {
packetSniffers = action.PacketSniffers
} else {
packetSniffers = []sniff.PacketSniffer{
sniff.DomainNameQuery,
sniff.QUICClientHello,
sniff.STUNMessage,
sniff.UTP,
sniff.UDPTracker,
sniff.DTLSRecord,
sniff.NTP,
}
}
err = sniff.PeekPacket(
ctx, metadata,
sniffBuffer.Bytes(),

View File

@@ -379,6 +379,8 @@ func (r *RuleActionSniff) build() error {
r.StreamSniffers = append(r.StreamSniffers, sniff.SSH)
case C.ProtocolRDP:
r.StreamSniffers = append(r.StreamSniffers, sniff.RDP)
case C.ProtocolNTP:
r.PacketSniffers = append(r.PacketSniffers, sniff.NTP)
default:
return E.New("unknown sniffer: ", name)
}