mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-07-27 08:14:08 +08:00
Compare commits
62 Commits
4fe48c1a80
...
f70ca3d190
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f70ca3d190 | ||
![]() |
f16ab5e3df | ||
![]() |
7ad655dec6 | ||
![]() |
581b7a2a6d | ||
![]() |
cebd6118fd | ||
![]() |
a492586308 | ||
![]() |
2f27a9c307 | ||
![]() |
b710519728 | ||
![]() |
acf433fb83 | ||
![]() |
0071a4586a | ||
![]() |
45ebaabcd7 | ||
![]() |
b2f456d6c5 | ||
![]() |
08534c277e | ||
![]() |
bbd3b5b054 | ||
![]() |
374647601d | ||
![]() |
c934365929 | ||
![]() |
f33287c50f | ||
![]() |
477c1c32f8 | ||
![]() |
4e01443a26 | ||
![]() |
d9e9a589db | ||
![]() |
1339dcddce | ||
![]() |
84de755eb6 | ||
![]() |
7058c8e0d0 | ||
![]() |
12b4205c3c | ||
![]() |
374eaa9301 | ||
![]() |
9ddcd1c154 | ||
![]() |
7473db9515 | ||
![]() |
6d6789a4c5 | ||
![]() |
f9d5927101 | ||
![]() |
57c866c4d4 | ||
![]() |
4d36ebe654 | ||
![]() |
182c9adf00 | ||
![]() |
b43d8d2298 | ||
![]() |
f17b6fe703 | ||
![]() |
e2303234e8 | ||
![]() |
96e4fe5125 | ||
![]() |
f6fe6312bc | ||
![]() |
4c4d5e70c6 | ||
![]() |
d6f46598ff | ||
![]() |
78a7577575 | ||
![]() |
e56e6f9565 | ||
![]() |
6a4ae71992 | ||
![]() |
fd97777f91 | ||
![]() |
13e9dc9cd6 | ||
![]() |
51b9d7fce1 | ||
![]() |
3d37d37d38 | ||
![]() |
f1fe1c5f4e | ||
![]() |
b830ef72e1 | ||
![]() |
1ac3b3565f | ||
![]() |
76d1f8cf5c | ||
![]() |
70d64b0da1 | ||
![]() |
d10dba568d | ||
![]() |
2c6d0dba9e | ||
![]() |
dfd56bbcb3 | ||
![]() |
a7a3b4e2e1 | ||
![]() |
ed1ea104eb | ||
![]() |
511ba9bd6a | ||
![]() |
ea442e0608 | ||
![]() |
86116b9423 | ||
![]() |
a530e424e9 | ||
![]() |
0bfd487ee9 | ||
![]() |
6aae834493 |
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@ -176,6 +176,9 @@ jobs:
|
|||||||
PKG_NAME="sing-box_${{ needs.calculate_version.outputs.version }}_${{ matrix.os }}_${{ matrix.arch }}${ARM_VERSION}"
|
PKG_NAME="sing-box_${{ needs.calculate_version.outputs.version }}_${{ matrix.os }}_${{ matrix.arch }}${ARM_VERSION}"
|
||||||
echo "DIR_NAME=${DIR_NAME}" >> "${GITHUB_ENV}"
|
echo "DIR_NAME=${DIR_NAME}" >> "${GITHUB_ENV}"
|
||||||
echo "PKG_NAME=${PKG_NAME}" >> "${GITHUB_ENV}"
|
echo "PKG_NAME=${PKG_NAME}" >> "${GITHUB_ENV}"
|
||||||
|
PKG_VERSION="${{ needs.calculate_version.outputs.version }}"
|
||||||
|
PKG_VERSION="${PKG_VERSION//-/\~}"
|
||||||
|
echo "PKG_VERSION=${PKG_VERSION}" >> "${GITHUB_ENV}"
|
||||||
- name: Package DEB
|
- name: Package DEB
|
||||||
if: matrix.debian != ''
|
if: matrix.debian != ''
|
||||||
run: |
|
run: |
|
||||||
@ -183,7 +186,7 @@ jobs:
|
|||||||
sudo gem install fpm
|
sudo gem install fpm
|
||||||
sudo apt-get install -y debsigs
|
sudo apt-get install -y debsigs
|
||||||
fpm -t deb \
|
fpm -t deb \
|
||||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
-v "$PKG_VERSION" \
|
||||||
-p "dist/${PKG_NAME}.deb" \
|
-p "dist/${PKG_NAME}.deb" \
|
||||||
--architecture ${{ matrix.debian }} \
|
--architecture ${{ matrix.debian }} \
|
||||||
dist/sing-box=/usr/bin/sing-box
|
dist/sing-box=/usr/bin/sing-box
|
||||||
@ -200,7 +203,7 @@ jobs:
|
|||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
sudo gem install fpm
|
sudo gem install fpm
|
||||||
fpm -t rpm \
|
fpm -t rpm \
|
||||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
-v "$PKG_VERSION" \
|
||||||
-p "dist/${PKG_NAME}.rpm" \
|
-p "dist/${PKG_NAME}.rpm" \
|
||||||
--architecture ${{ matrix.rpm }} \
|
--architecture ${{ matrix.rpm }} \
|
||||||
dist/sing-box=/usr/bin/sing-box
|
dist/sing-box=/usr/bin/sing-box
|
||||||
@ -219,7 +222,7 @@ jobs:
|
|||||||
sudo gem install fpm
|
sudo gem install fpm
|
||||||
sudo apt-get install -y libarchive-tools
|
sudo apt-get install -y libarchive-tools
|
||||||
fpm -t pacman \
|
fpm -t pacman \
|
||||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
-v "$PKG_VERSION" \
|
||||||
-p "dist/${PKG_NAME}.pkg.tar.zst" \
|
-p "dist/${PKG_NAME}.pkg.tar.zst" \
|
||||||
--architecture ${{ matrix.pacman }} \
|
--architecture ${{ matrix.pacman }} \
|
||||||
dist/sing-box=/usr/bin/sing-box
|
dist/sing-box=/usr/bin/sing-box
|
||||||
|
9
.github/workflows/linux.yml
vendored
9
.github/workflows/linux.yml
vendored
@ -109,6 +109,11 @@ jobs:
|
|||||||
if: contains(needs.calculate_version.outputs.version, '-')
|
if: contains(needs.calculate_version.outputs.version, '-')
|
||||||
run: |-
|
run: |-
|
||||||
echo "NAME=sing-box-beta" >> "$GITHUB_ENV"
|
echo "NAME=sing-box-beta" >> "$GITHUB_ENV"
|
||||||
|
- name: Set version
|
||||||
|
run: |-
|
||||||
|
PKG_VERSION="${{ needs.calculate_version.outputs.version }}"
|
||||||
|
PKG_VERSION="${PKG_VERSION//-/\~}"
|
||||||
|
echo "PKG_VERSION=${PKG_VERSION}" >> "${GITHUB_ENV}"
|
||||||
- name: Package DEB
|
- name: Package DEB
|
||||||
if: matrix.debian != ''
|
if: matrix.debian != ''
|
||||||
run: |
|
run: |
|
||||||
@ -117,7 +122,7 @@ jobs:
|
|||||||
sudo apt-get install -y debsigs
|
sudo apt-get install -y debsigs
|
||||||
fpm -t deb \
|
fpm -t deb \
|
||||||
--name "${NAME}" \
|
--name "${NAME}" \
|
||||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
-v "$PKG_VERSION" \
|
||||||
-p "dist/${NAME}_${{ needs.calculate_version.outputs.version }}_linux_${{ matrix.debian }}.deb" \
|
-p "dist/${NAME}_${{ needs.calculate_version.outputs.version }}_linux_${{ matrix.debian }}.deb" \
|
||||||
--architecture ${{ matrix.debian }} \
|
--architecture ${{ matrix.debian }} \
|
||||||
dist/sing-box=/usr/bin/sing-box
|
dist/sing-box=/usr/bin/sing-box
|
||||||
@ -135,7 +140,7 @@ jobs:
|
|||||||
sudo gem install fpm
|
sudo gem install fpm
|
||||||
fpm -t rpm \
|
fpm -t rpm \
|
||||||
--name "${NAME}" \
|
--name "${NAME}" \
|
||||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
-v "$PKG_VERSION" \
|
||||||
-p "dist/${NAME}_${{ needs.calculate_version.outputs.version }}_linux_${{ matrix.rpm }}.rpm" \
|
-p "dist/${NAME}_${{ needs.calculate_version.outputs.version }}_linux_${{ matrix.rpm }}.rpm" \
|
||||||
--architecture ${{ matrix.rpm }} \
|
--architecture ${{ matrix.rpm }} \
|
||||||
dist/sing-box=/usr/bin/sing-box
|
dist/sing-box=/usr/bin/sing-box
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit aefe3c029096ddac5189a20a8203a68858152f0a
|
Subproject commit 5659088bb3fe18b7095e4b9f868c181e27739617
|
@ -140,12 +140,12 @@ func (t *Transport) exchange(ctx context.Context, message *mDNS.Msg, conn quic.C
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer stream.Close()
|
|
||||||
defer stream.CancelRead(0)
|
|
||||||
err = transport.WriteMessage(stream, 0, message)
|
err = transport.WriteMessage(stream, 0, message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
stream.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
stream.Close()
|
||||||
return transport.ReadMessage(stream)
|
return transport.ReadMessage(stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,16 @@
|
|||||||
icon: material/alert-decagram
|
icon: material/alert-decagram
|
||||||
---
|
---
|
||||||
|
|
||||||
#### 1.12.0-alpha.20
|
#### 1.12.0-alpha.21
|
||||||
|
|
||||||
* Fixes and improvements
|
* Fixes and improvements
|
||||||
|
|
||||||
|
### 1.11.6
|
||||||
|
|
||||||
|
* Fixes and improvements
|
||||||
|
|
||||||
|
_We are temporarily unable to update sing-box apps on the App Store because the reviewer mistakenly found that we violated the rules (TestFlight users are not affected)._
|
||||||
|
|
||||||
#### 1.12.0-alpha.19
|
#### 1.12.0-alpha.19
|
||||||
|
|
||||||
* Update gVisor to 20250319.0
|
* Update gVisor to 20250319.0
|
||||||
|
@ -44,10 +44,10 @@ Default padding scheme:
|
|||||||
|
|
||||||
```
|
```
|
||||||
stop=8
|
stop=8
|
||||||
0=34-120
|
0=30-30
|
||||||
1=100-400
|
1=100-400
|
||||||
2=400-500,c,500-1000,c,400-500,c,500-1000,c,500-1000,c,400-500
|
2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000
|
||||||
3=500-1000
|
3=9-9,500-1000
|
||||||
4=500-1000
|
4=500-1000
|
||||||
5=500-1000
|
5=500-1000
|
||||||
6=500-1000
|
6=500-1000
|
||||||
|
@ -44,10 +44,10 @@ AnyTLS 填充方案行数组。
|
|||||||
|
|
||||||
```
|
```
|
||||||
stop=8
|
stop=8
|
||||||
0=34-120
|
0=30-30
|
||||||
1=100-400
|
1=100-400
|
||||||
2=400-500,c,500-1000,c,400-500,c,500-1000,c,500-1000,c,400-500
|
2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000
|
||||||
3=500-1000
|
3=9-9,500-1000
|
||||||
4=500-1000
|
4=500-1000
|
||||||
5=500-1000
|
5=500-1000
|
||||||
6=500-1000
|
6=500-1000
|
||||||
|
2
go.mod
2
go.mod
@ -3,7 +3,7 @@ module github.com/sagernet/sing-box
|
|||||||
go 1.23.1
|
go 1.23.1
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/anytls/sing-anytls v0.0.6
|
github.com/anytls/sing-anytls v0.0.7
|
||||||
github.com/caddyserver/certmagic v0.21.7
|
github.com/caddyserver/certmagic v0.21.7
|
||||||
github.com/cloudflare/circl v1.6.0
|
github.com/cloudflare/circl v1.6.0
|
||||||
github.com/cretz/bine v0.2.0
|
github.com/cretz/bine v0.2.0
|
||||||
|
4
go.sum
4
go.sum
@ -8,8 +8,8 @@ github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa h1:LHTHcTQiSGT7V
|
|||||||
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
github.com/alexbrainman/sspi v0.0.0-20231016080023-1a75b4708caa/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
|
||||||
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
||||||
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
||||||
github.com/anytls/sing-anytls v0.0.6 h1:UatIjl/OvzWQGXQ1I2bAIkabL9WtihW0fA7G+DXGBUg=
|
github.com/anytls/sing-anytls v0.0.7 h1:0Q5dHNB2sqkFAWZCyK2vjQ/ckI5Iz3V/Frf3k7mBrGc=
|
||||||
github.com/anytls/sing-anytls v0.0.6/go.mod h1:7rjN6IukwysmdusYsrV51Fgu1uW6vsrdd6ctjnEAln8=
|
github.com/anytls/sing-anytls v0.0.7/go.mod h1:7rjN6IukwysmdusYsrV51Fgu1uW6vsrdd6ctjnEAln8=
|
||||||
github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
|
github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE=
|
||||||
github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
github.com/bits-and-blooms/bitset v1.13.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||||
github.com/caddyserver/certmagic v0.21.7 h1:66KJioPFJwttL43KYSWk7ErSmE6LfaJgCQuhm8Sg6fg=
|
github.com/caddyserver/certmagic v0.21.7 h1:66KJioPFJwttL43KYSWk7ErSmE6LfaJgCQuhm8Sg6fg=
|
||||||
|
@ -121,14 +121,6 @@ func (t *TProxy) NewPacketEx(buffer *buf.Buffer, oob []byte, source M.Socksaddr)
|
|||||||
t.udpNat.NewPacket([][]byte{buffer.Bytes()}, source, M.SocksaddrFromNetIP(destination), nil)
|
t.udpNat.NewPacket([][]byte{buffer.Bytes()}, source, M.SocksaddrFromNetIP(destination), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
type tproxyPacketWriter struct {
|
|
||||||
ctx context.Context
|
|
||||||
listener *listener.Listener
|
|
||||||
source netip.AddrPort
|
|
||||||
destination M.Socksaddr
|
|
||||||
conn *net.UDPConn
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *TProxy) preparePacketConnection(source M.Socksaddr, destination M.Socksaddr, userData any) (bool, context.Context, N.PacketWriter, N.CloseHandlerFunc) {
|
func (t *TProxy) preparePacketConnection(source M.Socksaddr, destination M.Socksaddr, userData any) (bool, context.Context, N.PacketWriter, N.CloseHandlerFunc) {
|
||||||
ctx := log.ContextWithNewID(t.ctx)
|
ctx := log.ContextWithNewID(t.ctx)
|
||||||
writer := &tproxyPacketWriter{
|
writer := &tproxyPacketWriter{
|
||||||
@ -142,8 +134,17 @@ func (t *TProxy) preparePacketConnection(source M.Socksaddr, destination M.Socks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type tproxyPacketWriter struct {
|
||||||
|
ctx context.Context
|
||||||
|
listener *listener.Listener
|
||||||
|
source netip.AddrPort
|
||||||
|
destination M.Socksaddr
|
||||||
|
conn *net.UDPConn
|
||||||
|
}
|
||||||
|
|
||||||
func (w *tproxyPacketWriter) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error {
|
func (w *tproxyPacketWriter) WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error {
|
||||||
defer buffer.Release()
|
defer buffer.Release()
|
||||||
|
if w.listener.ListenOptions().NetNs == "" {
|
||||||
conn := w.conn
|
conn := w.conn
|
||||||
if w.destination == destination && conn != nil {
|
if w.destination == destination && conn != nil {
|
||||||
_, err := conn.WriteToUDPAddrPort(buffer.Bytes(), w.source)
|
_, err := conn.WriteToUDPAddrPort(buffer.Bytes(), w.source)
|
||||||
@ -152,6 +153,7 @@ func (w *tproxyPacketWriter) WritePacket(buffer *buf.Buffer, destination M.Socks
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
var listenConfig net.ListenConfig
|
var listenConfig net.ListenConfig
|
||||||
listenConfig.Control = control.Append(listenConfig.Control, control.ReuseAddr())
|
listenConfig.Control = control.Append(listenConfig.Control, control.ReuseAddr())
|
||||||
listenConfig.Control = control.Append(listenConfig.Control, redir.TProxyWriteBack())
|
listenConfig.Control = control.Append(listenConfig.Control, redir.TProxyWriteBack())
|
||||||
@ -160,7 +162,7 @@ func (w *tproxyPacketWriter) WritePacket(buffer *buf.Buffer, destination M.Socks
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
udpConn := packetConn.(*net.UDPConn)
|
udpConn := packetConn.(*net.UDPConn)
|
||||||
if w.destination == destination {
|
if w.listener.ListenOptions().NetNs == "" && w.destination == destination {
|
||||||
w.conn = udpConn
|
w.conn = udpConn
|
||||||
} else {
|
} else {
|
||||||
defer udpConn.Close()
|
defer udpConn.Close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user