Compare commits

..

24 Commits

Author SHA1 Message Date
世界
ee0ed3c0bd documentation: Bump version 2023-12-27 10:41:04 +08:00
世界
fada3e44f7 documentation: Update package managers 2023-12-27 10:41:04 +08:00
世界
2ae26d71ef Remove unnecessary context wrappers 2023-12-27 10:41:04 +08:00
世界
5dceecd6eb Improve read wait interface &
Refactor Authenticator interface to struct &
Update smux &
Update gVisor to 20231204.0 &
Update quic-go to v0.40.1 &
Update wireguard-go &
Add GSO support for TUN/WireGuard &
Fix router pre-start &
Fix bind forwarder to interface for systems stack
2023-12-27 10:40:53 +08:00
世界
883cd60a6a Make generated files have SUDO_USER's permissions if possible. 2023-12-27 10:39:51 +08:00
世界
8c2dc2132f Refactor inbound/outbound options struct 2023-12-27 10:39:51 +08:00
世界
2670cc52cf Improve configuration merge 2023-12-27 10:39:51 +08:00
世界
921ded8b28 Update uTLS to 1.5.4 2023-12-27 10:39:46 +08:00
世界
ca3fb0361f Update tfo-go 2023-12-27 10:37:47 +08:00
世界
b75cb807e6 Update gomobile and add tag 2023-12-27 10:37:47 +08:00
世界
aff1d9658d Update cloudflare-tls to go1.21.5 2023-12-27 10:37:47 +08:00
世界
7a2a88c1b6 Make type check strict 2023-12-27 10:37:47 +08:00
世界
ccc45eb150 Remove comparable limit for Listable 2023-12-27 10:37:47 +08:00
世界
ef592729c9 Avoid opening log output before start &
Replace tracing logs with task monitor
2023-12-27 10:37:46 +08:00
世界
9adf46d997 Update documentation 2023-12-27 10:37:46 +08:00
世界
234a8d0c63 Add idle_timeout for URLTest outbound 2023-12-27 10:37:46 +08:00
世界
26dee24a49 Skip internal fake-ip queries 2023-12-27 10:37:46 +08:00
世界
ae72796d96 Migrate contentjson and badjson to library &
Add omitempty in format
2023-12-27 10:37:45 +08:00
世界
a78e8ae9ed Update documentation 2023-12-27 10:37:45 +08:00
世界
65291e97cf Independent source_ip_is_private and ip_is_private rules 2023-12-27 10:37:45 +08:00
世界
b6adcbf43f Add rule-set 2023-12-27 10:37:44 +08:00
世界
f7128ce523 Update buffer usage 2023-12-27 10:37:44 +08:00
世界
4d76215750 Allow nested logical rules 2023-12-27 10:37:44 +08:00
世界
72fb2e0781 Migrate to independent cache file 2023-12-27 10:37:44 +08:00
9 changed files with 36 additions and 57 deletions

View File

@@ -5,7 +5,6 @@ import (
"net/http/pprof"
"runtime"
"runtime/debug"
"strings"
"github.com/sagernet/sing-box/common/humanize"
"github.com/sagernet/sing-box/log"
@@ -48,20 +47,12 @@ func applyDebugListenOption(options option.DebugOptions) {
encoder.SetIndent("", " ")
encoder.Encode(memObject)
})
r.Route("/pprof", func(r chi.Router) {
r.HandleFunc("/", func(writer http.ResponseWriter, request *http.Request) {
if !strings.HasSuffix(request.URL.Path, "/") {
http.Redirect(writer, request, request.URL.Path+"/", http.StatusMovedPermanently)
} else {
pprof.Index(writer, request)
}
})
r.HandleFunc("/*", pprof.Index)
r.HandleFunc("/cmdline", pprof.Cmdline)
r.HandleFunc("/profile", pprof.Profile)
r.HandleFunc("/symbol", pprof.Symbol)
r.HandleFunc("/trace", pprof.Trace)
})
r.HandleFunc("/pprof", pprof.Index)
r.HandleFunc("/pprof/*", pprof.Index)
r.HandleFunc("/pprof/cmdline", pprof.Cmdline)
r.HandleFunc("/pprof/profile", pprof.Profile)
r.HandleFunc("/pprof/symbol", pprof.Symbol)
r.HandleFunc("/pprof/trace", pprof.Trace)
})
debugHTTPServer = &http.Server{
Addr: options.Listen,

View File

@@ -1,5 +1,3 @@
//go:build linux || darwin
package box
import (

View File

@@ -1,4 +1,4 @@
//go:build !(linux || darwin)
//go:build !linux
package box

View File

@@ -2,19 +2,6 @@
icon: material/alert-decagram
---
#### 1.8.0-rc.10
* Fixes and improvements
#### 1.7.7
* Fix V2Ray transport `path` validation behavior **1**
* Fixes and improvements
**1**:
See [V2Ray transport](/configuration/shared/v2ray-transport/).
#### 1.8.0-rc.7
* Fixes and improvements

View File

@@ -173,9 +173,10 @@ By default, the maximum version is currently TLS 1.3.
#### cipher_suites
A list of enabled TLS 1.01.2 cipher suites. The order of the list is ignored. Note that TLS 1.3 cipher suites are not configurable.
The elliptic curves that will be used in an ECDHE handshake, in preference order.
If empty, a safe default list is used. The default cipher suites might change over time.
If empty, the default will be used. The client will use the first preference as the type for its key share in TLS 1.3.
This may change in the future.
#### certificate

View File

@@ -170,9 +170,12 @@ TLS 版本值:
#### cipher_suites
启用的 TLS 1.0-1.2密码套件的列表。列表的顺序被忽略。请注意TLS 1.3 的密码套件是不可配置的
将在 ECDHE 握手中使用的椭圆曲线,按优先顺序排列
如果为空,使用安全的默认列表。默认密码套件可能会随着时间的推移而改变
如果为空,使用默认值
客户端将使用第一个首选项作为其在 TLS 1.3 中的密钥共享类型。
这在未来可能会改变。
#### certificate

2
go.mod
View File

@@ -28,7 +28,7 @@ require (
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691
github.com/sagernet/sing v0.3.0-rc.7
github.com/sagernet/sing-dns v0.1.12
github.com/sagernet/sing-mux v0.1.8-rc.1
github.com/sagernet/sing-mux v0.1.7-rc.1
github.com/sagernet/sing-quic v0.1.7-rc.2
github.com/sagernet/sing-shadowsocks v0.2.6
github.com/sagernet/sing-shadowsocks2 v0.1.6-rc.1

4
go.sum
View File

@@ -113,8 +113,8 @@ github.com/sagernet/sing v0.3.0-rc.7 h1:FmnzFRYC6usVgWf112cUxiexwvL+iAurKmCL4Axa
github.com/sagernet/sing v0.3.0-rc.7/go.mod h1:9pfuAH6mZfgnz/YjP6xu5sxx882rfyjpcrTdUpd6w3g=
github.com/sagernet/sing-dns v0.1.12 h1:1HqZ+ln+Rezx/aJMStaS0d7oPeX2EobSV1NT537kyj4=
github.com/sagernet/sing-dns v0.1.12/go.mod h1:rx/DTOisneQpCgNQ4jbFU/JNEtnz0lYcHXenlVzpjEU=
github.com/sagernet/sing-mux v0.1.8-rc.1 h1:5dsZgWmNr9W6JzQj4fb3xX2pMP0OyJH6kVtlqc2kFKA=
github.com/sagernet/sing-mux v0.1.8-rc.1/go.mod h1:KK5zCbNujj5kn36G+wLFROOXyJhaaXLyaZWY2w7kBNQ=
github.com/sagernet/sing-mux v0.1.7-rc.1 h1:4XlQSeIqKA6uaW1KGQA9wCG5zt9ajhvc/zJnnZV/n1c=
github.com/sagernet/sing-mux v0.1.7-rc.1/go.mod h1:KK5zCbNujj5kn36G+wLFROOXyJhaaXLyaZWY2w7kBNQ=
github.com/sagernet/sing-quic v0.1.7-rc.2 h1:rCWhtvzQwgkWbX4sVHYdNwzyPweoUPEgBCBatywHjMs=
github.com/sagernet/sing-quic v0.1.7-rc.2/go.mod h1:IbKCPWXP13zd3cdu0rirtYjkMlquc5zWtc3avfSUGAw=
github.com/sagernet/sing-shadowsocks v0.2.6 h1:xr7ylAS/q1cQYS8oxKKajhuQcchd5VJJ4K4UZrrpp0s=

View File

@@ -2,16 +2,19 @@ package v2raygrpclite
import (
std_bufio "bufio"
"bytes"
"encoding/binary"
"io"
"net"
"net/http"
"os"
"sync"
"time"
"github.com/sagernet/sing/common"
"github.com/sagernet/sing/common/baderror"
"github.com/sagernet/sing/common/buf"
"github.com/sagernet/sing/common/bufio"
M "github.com/sagernet/sing/common/metadata"
"github.com/sagernet/sing/common/rw"
)
@@ -27,6 +30,7 @@ type GunConn struct {
create chan struct{}
err error
readRemaining int
writeAccess sync.Mutex
}
func newGunConn(reader io.Reader, writer io.Writer, flusher http.Flusher) *GunConn {
@@ -96,22 +100,19 @@ func (c *GunConn) read(b []byte) (n int, err error) {
}
func (c *GunConn) Write(b []byte) (n int, err error) {
varLen := rw.UVariantLen(uint64(len(b)))
buffer := buf.NewSize(6 + varLen + len(b))
header := buffer.Extend(6 + varLen)
header[0] = 0x00
binary.BigEndian.PutUint32(header[1:5], uint32(1+varLen+len(b)))
header[5] = 0x0A
binary.PutUvarint(header[6:], uint64(len(b)))
common.Must1(buffer.Write(b))
_, err = c.writer.Write(buffer.Bytes())
if err != nil {
return 0, baderror.WrapH2(err)
}
if c.flusher != nil {
protobufHeader := [1 + binary.MaxVarintLen64]byte{0x0A}
varuintLen := binary.PutUvarint(protobufHeader[1:], uint64(len(b)))
grpcHeader := buf.Get(5)
grpcPayloadLen := uint32(1 + varuintLen + len(b))
binary.BigEndian.PutUint32(grpcHeader[1:5], grpcPayloadLen)
c.writeAccess.Lock()
_, err = bufio.Copy(c.writer, io.MultiReader(bytes.NewReader(grpcHeader), bytes.NewReader(protobufHeader[:varuintLen+1]), bytes.NewReader(b)))
c.writeAccess.Unlock()
buf.Put(grpcHeader)
if err == nil && c.flusher != nil {
c.flusher.Flush()
}
return len(b), nil
return len(b), baderror.WrapH2(err)
}
func (c *GunConn) WriteBuffer(buffer *buf.Buffer) error {
@@ -119,18 +120,16 @@ func (c *GunConn) WriteBuffer(buffer *buf.Buffer) error {
dataLen := buffer.Len()
varLen := rw.UVariantLen(uint64(dataLen))
header := buffer.ExtendHeader(6 + varLen)
_ = header[6]
header[0] = 0x00
binary.BigEndian.PutUint32(header[1:5], uint32(1+varLen+dataLen))
header[5] = 0x0A
binary.PutUvarint(header[6:], uint64(dataLen))
err := rw.WriteBytes(c.writer, buffer.Bytes())
if err != nil {
return baderror.WrapH2(err)
}
if c.flusher != nil {
if err == nil && c.flusher != nil {
c.flusher.Flush()
}
return nil
return baderror.WrapH2(err)
}
func (c *GunConn) FrontHeadroom() int {