mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-07-27 08:14:08 +08:00
Compare commits
60 Commits
f70ca3d190
...
4fe48c1a80
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4fe48c1a80 | ||
![]() |
f5ac12870c | ||
![]() |
5de57fad5d | ||
![]() |
3c0fafb0a6 | ||
![]() |
7829e2677a | ||
![]() |
24f918223f | ||
![]() |
3041ee9314 | ||
![]() |
01d1a7f780 | ||
![]() |
349aecec92 | ||
![]() |
95cb46d943 | ||
![]() |
2486fd39e4 | ||
![]() |
d4b20ec36e | ||
![]() |
f04c976acb | ||
![]() |
2994c59c58 | ||
![]() |
2609a44115 | ||
![]() |
1c8d12b721 | ||
![]() |
1ac69295c4 | ||
![]() |
57164832ad | ||
![]() |
130dad1c54 | ||
![]() |
8fea9c7ff2 | ||
![]() |
ca44711cc9 | ||
![]() |
9195d1deec | ||
![]() |
2fccc5e806 | ||
![]() |
157eb54c60 | ||
![]() |
1069b7d712 | ||
![]() |
d52322112e | ||
![]() |
59cbe0876e | ||
![]() |
864003dfd5 | ||
![]() |
2cd746bb95 | ||
![]() |
e3d5afa626 | ||
![]() |
e8d9560aa1 | ||
![]() |
d4fb0321c6 | ||
![]() |
e8c11439d9 | ||
![]() |
342112b600 | ||
![]() |
cf0bee8fe7 | ||
![]() |
cebf8b3f3e | ||
![]() |
3a5267b448 | ||
![]() |
3e90cd4a8f | ||
![]() |
42c769d375 | ||
![]() |
c8fea4d6fe | ||
![]() |
495bdee0aa | ||
![]() |
20f245c628 | ||
![]() |
8cdb4b7c85 | ||
![]() |
6b8307cf5d | ||
![]() |
b6d4fd4c39 | ||
![]() |
0a052045bf | ||
![]() |
df588b84bc | ||
![]() |
9c7e054d54 | ||
![]() |
28e01aed6d | ||
![]() |
d302b018ff | ||
![]() |
925808dfd0 | ||
![]() |
98ee3f467c | ||
![]() |
14003c1981 | ||
![]() |
323d5887d6 | ||
![]() |
766e3a1e8d | ||
![]() |
291a4f1854 | ||
![]() |
dee381c45a | ||
![]() |
95e397f898 | ||
![]() |
ad1f3216fb | ||
![]() |
5b5e4903e2 |
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@ -176,9 +176,6 @@ jobs:
|
||||
PKG_NAME="sing-box_${{ needs.calculate_version.outputs.version }}_${{ matrix.os }}_${{ matrix.arch }}${ARM_VERSION}"
|
||||
echo "DIR_NAME=${DIR_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
|
||||
if: matrix.debian != ''
|
||||
run: |
|
||||
@ -186,7 +183,7 @@ jobs:
|
||||
sudo gem install fpm
|
||||
sudo apt-get install -y debsigs
|
||||
fpm -t deb \
|
||||
-v "$PKG_VERSION" \
|
||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
||||
-p "dist/${PKG_NAME}.deb" \
|
||||
--architecture ${{ matrix.debian }} \
|
||||
dist/sing-box=/usr/bin/sing-box
|
||||
@ -203,7 +200,7 @@ jobs:
|
||||
set -xeuo pipefail
|
||||
sudo gem install fpm
|
||||
fpm -t rpm \
|
||||
-v "$PKG_VERSION" \
|
||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
||||
-p "dist/${PKG_NAME}.rpm" \
|
||||
--architecture ${{ matrix.rpm }} \
|
||||
dist/sing-box=/usr/bin/sing-box
|
||||
@ -222,7 +219,7 @@ jobs:
|
||||
sudo gem install fpm
|
||||
sudo apt-get install -y libarchive-tools
|
||||
fpm -t pacman \
|
||||
-v "$PKG_VERSION" \
|
||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
||||
-p "dist/${PKG_NAME}.pkg.tar.zst" \
|
||||
--architecture ${{ matrix.pacman }} \
|
||||
dist/sing-box=/usr/bin/sing-box
|
||||
|
9
.github/workflows/linux.yml
vendored
9
.github/workflows/linux.yml
vendored
@ -109,11 +109,6 @@ jobs:
|
||||
if: contains(needs.calculate_version.outputs.version, '-')
|
||||
run: |-
|
||||
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
|
||||
if: matrix.debian != ''
|
||||
run: |
|
||||
@ -122,7 +117,7 @@ jobs:
|
||||
sudo apt-get install -y debsigs
|
||||
fpm -t deb \
|
||||
--name "${NAME}" \
|
||||
-v "$PKG_VERSION" \
|
||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
||||
-p "dist/${NAME}_${{ needs.calculate_version.outputs.version }}_linux_${{ matrix.debian }}.deb" \
|
||||
--architecture ${{ matrix.debian }} \
|
||||
dist/sing-box=/usr/bin/sing-box
|
||||
@ -140,7 +135,7 @@ jobs:
|
||||
sudo gem install fpm
|
||||
fpm -t rpm \
|
||||
--name "${NAME}" \
|
||||
-v "$PKG_VERSION" \
|
||||
-v "${{ needs.calculate_version.outputs.version }}" \
|
||||
-p "dist/${NAME}_${{ needs.calculate_version.outputs.version }}_linux_${{ matrix.rpm }}.rpm" \
|
||||
--architecture ${{ matrix.rpm }} \
|
||||
dist/sing-box=/usr/bin/sing-box
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 5659088bb3fe18b7095e4b9f868c181e27739617
|
||||
Subproject commit aefe3c029096ddac5189a20a8203a68858152f0a
|
@ -140,12 +140,12 @@ func (t *Transport) exchange(ctx context.Context, message *mDNS.Msg, conn quic.C
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer stream.Close()
|
||||
defer stream.CancelRead(0)
|
||||
err = transport.WriteMessage(stream, 0, message)
|
||||
if err != nil {
|
||||
stream.Close()
|
||||
return nil, err
|
||||
}
|
||||
stream.Close()
|
||||
return transport.ReadMessage(stream)
|
||||
}
|
||||
|
||||
|
@ -2,16 +2,10 @@
|
||||
icon: material/alert-decagram
|
||||
---
|
||||
|
||||
#### 1.12.0-alpha.21
|
||||
#### 1.12.0-alpha.20
|
||||
|
||||
* 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
|
||||
|
||||
* Update gVisor to 20250319.0
|
||||
|
@ -44,10 +44,10 @@ Default padding scheme:
|
||||
|
||||
```
|
||||
stop=8
|
||||
0=30-30
|
||||
0=34-120
|
||||
1=100-400
|
||||
2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000
|
||||
3=9-9,500-1000
|
||||
2=400-500,c,500-1000,c,400-500,c,500-1000,c,500-1000,c,400-500
|
||||
3=500-1000
|
||||
4=500-1000
|
||||
5=500-1000
|
||||
6=500-1000
|
||||
|
@ -44,10 +44,10 @@ AnyTLS 填充方案行数组。
|
||||
|
||||
```
|
||||
stop=8
|
||||
0=30-30
|
||||
0=34-120
|
||||
1=100-400
|
||||
2=400-500,c,500-1000,c,500-1000,c,500-1000,c,500-1000
|
||||
3=9-9,500-1000
|
||||
2=400-500,c,500-1000,c,400-500,c,500-1000,c,500-1000,c,400-500
|
||||
3=500-1000
|
||||
4=500-1000
|
||||
5=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
|
||||
|
||||
require (
|
||||
github.com/anytls/sing-anytls v0.0.7
|
||||
github.com/anytls/sing-anytls v0.0.6
|
||||
github.com/caddyserver/certmagic v0.21.7
|
||||
github.com/cloudflare/circl v1.6.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/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
|
||||
github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
|
||||
github.com/anytls/sing-anytls v0.0.7 h1:0Q5dHNB2sqkFAWZCyK2vjQ/ckI5Iz3V/Frf3k7mBrGc=
|
||||
github.com/anytls/sing-anytls v0.0.7/go.mod h1:7rjN6IukwysmdusYsrV51Fgu1uW6vsrdd6ctjnEAln8=
|
||||
github.com/anytls/sing-anytls v0.0.6 h1:UatIjl/OvzWQGXQ1I2bAIkabL9WtihW0fA7G+DXGBUg=
|
||||
github.com/anytls/sing-anytls v0.0.6/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/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
|
||||
github.com/caddyserver/certmagic v0.21.7 h1:66KJioPFJwttL43KYSWk7ErSmE6LfaJgCQuhm8Sg6fg=
|
||||
|
@ -121,6 +121,14 @@ func (t *TProxy) NewPacketEx(buffer *buf.Buffer, oob []byte, source M.Socksaddr)
|
||||
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) {
|
||||
ctx := log.ContextWithNewID(t.ctx)
|
||||
writer := &tproxyPacketWriter{
|
||||
@ -134,17 +142,8 @@ 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 {
|
||||
defer buffer.Release()
|
||||
if w.listener.ListenOptions().NetNs == "" {
|
||||
conn := w.conn
|
||||
if w.destination == destination && conn != nil {
|
||||
_, err := conn.WriteToUDPAddrPort(buffer.Bytes(), w.source)
|
||||
@ -153,7 +152,6 @@ func (w *tproxyPacketWriter) WritePacket(buffer *buf.Buffer, destination M.Socks
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
var listenConfig net.ListenConfig
|
||||
listenConfig.Control = control.Append(listenConfig.Control, control.ReuseAddr())
|
||||
listenConfig.Control = control.Append(listenConfig.Control, redir.TProxyWriteBack())
|
||||
@ -162,7 +160,7 @@ func (w *tproxyPacketWriter) WritePacket(buffer *buf.Buffer, destination M.Socks
|
||||
return err
|
||||
}
|
||||
udpConn := packetConn.(*net.UDPConn)
|
||||
if w.listener.ListenOptions().NetNs == "" && w.destination == destination {
|
||||
if w.destination == destination {
|
||||
w.conn = udpConn
|
||||
} else {
|
||||
defer udpConn.Close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user