Compare commits

..
Author SHA1 Message Date
patternihaandClaude Opus 5.5 266df8c644 TUN inbound: Document autoOutboundsInterface binding and other recent changes in README
Covers XTLS/Xray-core#7173 (a connection that cannot be bound fails
instead of leaving unbound), #7214 (IPv4-only and IPv6-only outbound
interfaces on Windows), #7230 (IPV6_BOUND_IF on macOS), and also #7130
(built-in TCP/IP stack), #6874 (IPv6 disabled system-wide on Windows),
#6811 (an existing Wintun adapter is reused) and #6883 (the iOS fd is
duplicated). #7092 and autoSystemWfpBlockLeak were already covered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 23:38:34 +03:30
patternihaandClaude Opus 5.5 f2f292c90c TUN inbound: Support "tcp/port" and "udp/port" in autoSystemWfpBlockLeak on Windows; "dns" covers DoT and DoQ as well
"dns" in autoSystemWfpBlockLeak only blocked port 53 outside the TUN, plus
the DNS Client service on Windows 11 and Server 2022 and later, so other
programs' DNS over TLS (TCP 853) and DNS over QUIC (UDP 853) could still
leave outside the TUN.

autoSystemWfpBlockLeak now takes:

- "tcp/<port>", "udp/<port>": connections to that port may only go through
  the TUN (or come from Xray itself).
- "windnsclient": Windows' DNS Client service may only connect through the
  TUN, except for mDNS and LLMNR. As before, this only applies from Windows
  11 and Server 2022 on, where the service may use DoH or DoT to any port;
  earlier versions only query port 53.
- "dns": stands for "udp/53", "tcp/53", "windnsclient", "tcp/853" and
  "udp/853".
- "misconfigtun": unchanged.

Values are case-insensitive, deduplicated, and anything else, such as
"tcp/0" or "icmp/1", is rejected. Keeping the system's DNS inside the TUN,
with "udp/53", "tcp/53" or "windnsclient", needs dns to be set, as "dns"
did; ports like 853 alone do not. Each port gets its own permit-through-TUN
and block filters with a protocol condition, where port 53 used to have one
for both protocols, and the log lists what is blocked, e.g. "[tun] blocked
outside the TUN: udp/53, tcp/53, tcp/853, udp/853, windnsclient".

Tested on Windows 11 with a Wintun adapter as the outside interface: with
"tcp/853", "udp/853", "tcp/7215" and "udp/7216", those are blocked outside
the TUN over IPv4 and IPv6, while tcp/7216, udp/7215 and 443 are not, port
853 works through the TUN, Xray's own connections to port 853 still leave
outside it, and nothing is blocked after Xray stops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 14:52:11 +03:30
103 changed files with 226 additions and 405 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/commander/config.proto
package commander
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/dispatcher/config.proto
package dispatcher
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/dns/config.proto
package dns
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/dns/fakedns/fakedns.proto
package fakedns
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/geodata/config.proto
package geodata
+1 -18
View File
@@ -1,8 +1,6 @@
package geodata
import (
"bufio"
"compress/gzip"
"context"
"crypto/tls"
go_errors "errors"
@@ -199,22 +197,7 @@ func (d *downloader) fetch(rawURL string, writer io.Writer) error {
return errors.New("geodata download exceeds 256 MiB")
}
br := bufio.NewReader(resp.Body)
header, err := br.Peek(2)
if err != nil && err != io.EOF {
return err
}
var body io.Reader = br
if len(header) == 2 && header[0] == 0x1f && header[1] == 0x8b {
zr, err := gzip.NewReader(br)
if err != nil {
return err
}
defer zr.Close()
body = zr
}
n, err := io.Copy(writer, io.LimitReader(body, maxDownloadSize+1))
n, err := io.Copy(writer, io.LimitReader(resp.Body, maxDownloadSize+1))
if err != nil {
return err
}
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/log/command/config.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.5
// source: app/log/command/config.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/log/config.proto
package log
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/metrics/config.proto
package metrics
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/observatory/burst/config.proto
package burst
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/observatory/command/command.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.5
// source: app/observatory/command/command.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/observatory/config.proto
package observatory
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/policy/config.proto
package policy
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/proxyman/command/command.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.5
// source: app/proxyman/command/command.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/proxyman/config.proto
package proxyman
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/reverse/config.proto
package reverse
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/router/command/command.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.5
// source: app/router/command/command.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/router/config.proto
package router
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/stats/command/command.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.5
// source: app/stats/command/command.proto
package command
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/stats/config.proto
package stats
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: app/version/config.proto
package version
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/geodata/geodat.proto
package geodata
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/log/log.proto
package log
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/net/address.proto
package net
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/net/destination.proto
package net
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/net/network.proto
package net
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/net/port.proto
package net
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/protocol/headers.proto
package protocol
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/protocol/server_spec.proto
package protocol
-4
View File
@@ -101,10 +101,6 @@ func ReadClientHello(data []byte, h *SniffHeader) error {
return errNotClientHello
}
if nameType == 0 {
// RFC 6066 requires a non-empty HostName.
if nameLen == 0 {
return errNotClientHello
}
// QUIC separated across packets
// May cause the serverName to be incomplete
b := byte(0)
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/protocol/user.proto
package protocol
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: common/serial/typed_message.proto
package serial
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: core/config.proto
package core
+1 -1
View File
@@ -20,7 +20,7 @@ import (
var (
Version_x byte = 26
Version_y byte = 10
Version_z byte = 31
Version_z byte = 29
)
var (
+2 -2
View File
@@ -33,7 +33,7 @@ require (
golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb
golang.zx2c4.com/wireguard/windows v1.1.1
google.golang.org/grpc v1.84.0
google.golang.org/protobuf v1.36.12
google.golang.org/protobuf v1.36.11
h12.io/socks v1.0.3
layeh.com/gopher-luar v1.0.11
lukechampine.com/blake3 v1.4.1
@@ -59,7 +59,7 @@ require (
golang.org/x/text v0.43.0 // indirect
golang.org/x/tools v0.51.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260706201446-f0a921348800 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gvisor.dev/gvisor v0.0.0-20260122175437-89a5d21be8f0 // indirect
)
+4 -2
View File
@@ -154,8 +154,10 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20260706201446-f0a921348800 h1:
google.golang.org/genproto/googleapis/rpc v0.0.0-20260706201446-f0a921348800/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.84.0 h1:soMyaPJ8pAak5PIQ0DGBUir0XRo2fRoMqhNWMLlLxO0=
google.golang.org/grpc v1.84.0/go.mod h1:ljCht0DrxQrXBDRTZp52Qxh3Ffk8CdYm2sj4O2QN2C0=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 h1:rgSNvqscFZ1JgV/4wH5GOsZFSFkR2Eua9As3KIr2LlM=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2/go.mod h1:iMEtFwDlAhjDU9L5mY6U1XLwlIId/G3h+QcBHDIvrJ8=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.0 h1:6Al3kEFFP9VJhRz3DID6quisgPnTeZVr4lep9kkxdPA=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.0/go.mod h1:QLvsjh0OIR0TYBeiu2bkWGTJBUNQ64st52iWj/yA93I=
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc=
google.golang.org/protobuf v1.36.12/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-2
View File
@@ -293,7 +293,6 @@ type SplitHTTPConfig struct {
ServerMaxHeaderBytes int32 `json:"serverMaxHeaderBytes"`
Xmux XmuxConfig `json:"xmux"`
DownloadSettings *StreamConfig `json:"downloadSettings"`
H2Params json.RawMessage `json:"h2Params"`
Extra json.RawMessage `json:"extra"`
}
@@ -496,7 +495,6 @@ func (c *SplitHTTPConfig) Build() (proto.Message, error) {
ServerMaxHeaderBytes: c.ServerMaxHeaderBytes,
SessionIDTable: c.SessionIDTable,
SessionIDLength: newRangeConfig(c.SessionIDLength),
H2Params: c.H2Params,
Xmux: &splithttp.XmuxConfig{
MaxConcurrency: newRangeConfig(c.Xmux.MaxConcurrency),
MaxConnections: newRangeConfig(c.Xmux.MaxConnections),
+20 -18
View File
@@ -117,7 +117,7 @@ func main() {
}
var protoFiles []string
var existingPbFiles []string
var pbCount int
err := filepath.WalkDir(pwd, func(path string, d fs.DirEntry, err error) error {
if err != nil || d.IsDir() {
return err
@@ -127,7 +127,7 @@ func main() {
protoFiles = append(protoFiles, filepath.ToSlash(rel))
}
if strings.HasSuffix(d.Name(), ".pb.go") {
existingPbFiles = append(existingPbFiles, path)
pbCount++
}
return nil
})
@@ -135,6 +135,13 @@ func main() {
fmt.Println("Walk error:", err)
os.Exit(1)
}
if len(protoFiles) == 0 {
if isCheck && pbCount > 0 {
fmt.Fprintf(os.Stderr, "Found %d .pb.go files without any .proto files. Remove these orphaned files.\n", pbCount)
os.Exit(1)
}
return
}
compiler := protocompile.Compiler{
Resolver: protocompile.WithStandardImports(&protocompile.SourceResolver{
@@ -156,8 +163,14 @@ func main() {
req := &pluginpb.CodeGeneratorRequest{
FileToGenerate: protoFiles,
Parameter: new("paths=source_relative"),
Parameter: proto.String("paths=source_relative"),
ProtoFile: topoSort(fdList),
// TODO: replace with unknown in the future
CompilerVersion: &pluginpb.Version{
Major: proto.Int32(6),
Minor: proto.Int32(33),
Patch: proto.Int32(5),
},
}
var diffCount int
@@ -210,22 +223,11 @@ func main() {
}
}
for _, path := range existingPbFiles {
if _, ok := generatedFiles[path]; !ok {
diffCount++
if isCheck {
fmt.Printf("Orphaned Protobuf file: %s\n", path)
} else {
fmt.Printf("Removing orphaned Protobuf file: %s\n", path)
if err := os.Remove(path); err != nil {
fmt.Fprintf(os.Stderr, "Error removing %s: %v\n", path, err)
os.Exit(1)
}
}
}
}
if isCheck {
if pbCount != len(generatedFiles) {
fmt.Printf("Protobuf file count mismatch: found %d, expected %d. Remove orphaned files and regenerate.\n", pbCount, len(generatedFiles))
diffCount++
}
if diffCount > 0 {
fmt.Println("Protobuf generated file problem(s) found.")
fmt.Println("Please run 'go run ./infra/vprotogen' to regenerate them.")
+11 -12
View File
@@ -47,19 +47,18 @@ func executeBalancerInfo(cmd *base.Command, args []string) {
conn, ctx, close := dialAPIServer()
defer close()
client := routerService.NewRoutingServiceClient(conn)
for _, tag := range unnamedArgs {
r := &routerService.GetBalancerInfoRequest{Tag: tag}
resp, err := client.GetBalancerInfo(ctx, r)
if err != nil {
base.Fatalf("failed to get health information: %s", err)
}
if apiJSON {
showJSONResponse(resp)
} else {
showBalancerInfo(resp.Balancer)
}
r := &routerService.GetBalancerInfoRequest{Tag: unnamedArgs[0]}
resp, err := client.GetBalancerInfo(ctx, r)
if err != nil {
base.Fatalf("failed to get health information: %s", err)
}
if apiJSON {
showJSONResponse(resp)
return
}
showBalancerInfo(resp.Balancer)
}
func showBalancerInfo(b *routerService.BalancerMsg) {
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/blackhole/config.proto
package blackhole
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/dns/config.proto
package dns
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/dokodemo/config.proto
package dokodemo
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/freedom/config.proto
package freedom
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/http/config.proto
package http
+2 -3
View File
@@ -312,9 +312,8 @@ func (s *Server) handlePlainHTTP(ctx context.Context, request *http.Request, wri
// Sometimes, server might send 1xx response to client
// it should not be processed by http proxy handler, just forward it to client
func readResponseAndHandle100Continue(r *bufio.Reader, req *http.Request, writer io.Writer) (*http.Response, error) {
// Wait for the HTTP/1.x status prefix before inspecting the buffered response.
r.Peek(12)
peekBytes, err := r.Peek(min(56, r.Buffered()))
// have a little look of response
peekBytes, err := r.Peek(56)
if err == nil || err == bufio.ErrBufferFull {
str := string(peekBytes)
ResponseLine := strings.Split(str, "\r\n")[0]
+1 -2
View File
@@ -7,7 +7,6 @@ import (
"net/http"
"strings"
"testing"
"testing/iotest"
)
// A malformed upstream response containing a bare '\n' before the real
@@ -30,7 +29,7 @@ func TestReadResponseAndHandle100ContinueDoesNotPanicOnEarlyNewline(t *testing.T
func TestReadResponseAndHandle100ContinueForwardsAndParsesFinalResponse(t *testing.T) {
payload := "HTTP/1.1 100 Continue\r\n\r\n" +
"HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\nhello"
r := bufio.NewReader(iotest.OneByteReader(bytes.NewReader([]byte(payload))))
r := bufio.NewReader(bytes.NewReader([]byte(payload)))
req, err := http.NewRequest("GET", "http://example.com/", nil)
if err != nil {
t.Fatal(err)
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/hysteria/account/config.proto
package account
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/hysteria/config.proto
package hysteria
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/loopback/config.proto
package loopback
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/masque/config.proto
package masque
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/shadowsocks/config.proto
package shadowsocks
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/shadowsocks_2022/config.proto
package shadowsocks_2022
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/socks/config.proto
package socks
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/trojan/config.proto
package trojan
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/tun/config.proto
package tun
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/vless/account.proto
package vless
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/vless/encoding/addons.proto
package encoding
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/vless/inbound/config.proto
package inbound
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/vless/outbound/config.proto
package outbound
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/vmess/account.proto
package vmess
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/vmess/inbound/config.proto
package inbound
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/vmess/outbound/config.proto
package outbound
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: proxy/wireguard/config.proto
package wireguard
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/config.proto
package internet
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/filter/config.proto
package filter
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/fragment/config.proto
package fragment
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/header/custom/config.proto
package custom
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/mkcp/aes128gcm/config.proto
package aes128gcm
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/mkcp/header/config.proto
package header
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/mkcp/original/config.proto
package original
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/noise/config.proto
package noise
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/realm/config.proto
package realm
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/salamander/config.proto
package salamander
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/sudoku/config.proto
package sudoku
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/udphop/config.proto
package udphop
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/xdns/config.proto
package xdns
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/xicmp/config.proto
package xicmp
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/finalmask/xmc/config.proto
package xmc
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/grpc/config.proto
package grpc
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/grpc/encoding/stream.proto
package encoding
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc (unknown)
// - protoc-gen-go-grpc v1.6.0
// - protoc v6.33.5
// source: transport/internet/grpc/encoding/stream.proto
package encoding
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/headers/http/config.proto
package http
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/headers/noop/config.proto
package noop
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/httpupgrade/config.proto
package httpupgrade
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/hysteria/config.proto
package hysteria
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/kcp/config.proto
package kcp
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/masque/config.proto
package masque
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/reality/config.proto
package reality
+4 -13
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/splithttp/config.proto
package splithttp
@@ -189,7 +189,6 @@ type Config struct {
ServerMaxHeaderBytes int32 `protobuf:"varint,27,opt,name=serverMaxHeaderBytes,proto3" json:"serverMaxHeaderBytes,omitempty"`
SessionIDTable string `protobuf:"bytes,28,opt,name=sessionIDTable,proto3" json:"sessionIDTable,omitempty"`
SessionIDLength *RangeConfig `protobuf:"bytes,29,opt,name=sessionIDLength,proto3" json:"sessionIDLength,omitempty"`
H2Params []byte `protobuf:"bytes,30,opt,name=h2Params,proto3" json:"h2Params,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -427,13 +426,6 @@ func (x *Config) GetSessionIDLength() *RangeConfig {
return nil
}
func (x *Config) GetH2Params() []byte {
if x != nil {
return x.H2Params
}
return nil
}
var File_transport_internet_splithttp_config_proto protoreflect.FileDescriptor
const file_transport_internet_splithttp_config_proto_rawDesc = "" +
@@ -449,7 +441,7 @@ const file_transport_internet_splithttp_config_proto_rawDesc = "" +
"\x0ecMaxReuseTimes\x18\x03 \x01(\v2..xray.transport.internet.splithttp.RangeConfigR\x0ecMaxReuseTimes\x12Z\n" +
"\x10hMaxRequestTimes\x18\x04 \x01(\v2..xray.transport.internet.splithttp.RangeConfigR\x10hMaxRequestTimes\x12Z\n" +
"\x10hMaxReusableSecs\x18\x05 \x01(\v2..xray.transport.internet.splithttp.RangeConfigR\x10hMaxReusableSecs\x12*\n" +
"\x10hKeepAlivePeriod\x18\x06 \x01(\x03R\x10hKeepAlivePeriod\"\xe8\f\n" +
"\x10hKeepAlivePeriod\x18\x06 \x01(\x03R\x10hKeepAlivePeriod\"\xcc\f\n" +
"\x06Config\x12\x12\n" +
"\x04host\x18\x01 \x01(\tR\x04host\x12\x12\n" +
"\x04path\x18\x02 \x01(\tR\x04path\x12\x12\n" +
@@ -480,8 +472,7 @@ const file_transport_internet_splithttp_config_proto_rawDesc = "" +
"\x0fuplinkChunkSize\x18\x1a \x01(\v2..xray.transport.internet.splithttp.RangeConfigR\x0fuplinkChunkSize\x122\n" +
"\x14serverMaxHeaderBytes\x18\x1b \x01(\x05R\x14serverMaxHeaderBytes\x12&\n" +
"\x0esessionIDTable\x18\x1c \x01(\tR\x0esessionIDTable\x12X\n" +
"\x0fsessionIDLength\x18\x1d \x01(\v2..xray.transport.internet.splithttp.RangeConfigR\x0fsessionIDLength\x12\x1a\n" +
"\bh2Params\x18\x1e \x01(\fR\bh2Params\x1a:\n" +
"\x0fsessionIDLength\x18\x1d \x01(\v2..xray.transport.internet.splithttp.RangeConfigR\x0fsessionIDLength\x1a:\n" +
"\fHeadersEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01B\x85\x01\n" +
@@ -52,5 +52,4 @@ message Config {
int32 serverMaxHeaderBytes = 27;
string sessionIDTable = 28;
RangeConfig sessionIDLength = 29;
bytes h2Params = 30;
}
+1 -13
View File
@@ -6,7 +6,6 @@ import (
"crypto/rand"
gotls "crypto/tls"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"net/http"
@@ -127,9 +126,7 @@ func (h *requestHandler) ServeHTTP(writer http.ResponseWriter, request *http.Req
h.config.ApplyXPaddingToResponse(writer, config)
// A real CORS preflight always carries Access-Control-Request-Method. An OPTIONS request without it is an
// uplink request (uplinkHTTPMethod: "OPTIONS") and must go through the normal handling below.
if request.Method == "OPTIONS" && request.Header.Get("Access-Control-Request-Method") != "" {
if request.Method == "OPTIONS" {
writer.WriteHeader(http.StatusOK)
return
}
@@ -556,14 +553,6 @@ func ListenXH(ctx context.Context, address net.Address, port net.Port, streamSet
handler.localAddr = l.listener.Addr()
var http2Config *http.HTTP2Config
if len(l.config.H2Params) > 0 {
http2Config = new(http.HTTP2Config)
if err := json.Unmarshal(l.config.H2Params, http2Config); err != nil {
return nil, errors.New("failed to parse HTTP2Config").Base(err)
}
}
// server can handle both plaintext HTTP/1.1 and h2c
protocols := new(http.Protocols)
protocols.SetHTTP1(true)
@@ -573,7 +562,6 @@ func ListenXH(ctx context.Context, address net.Address, port net.Port, streamSet
ReadHeaderTimeout: time.Second * 4,
MaxHeaderBytes: l.config.GetNormalizedServerMaxHeaderBytes(),
Protocols: protocols,
HTTP2: http2Config,
}
go func() {
if err := l.server.Serve(l.listener); err != nil {
@@ -465,137 +465,3 @@ func Test_maxUpload(t *testing.T) {
common.Must(listen.Close())
}
func newPacketUpEchoServer(t *testing.T, serverCfg *Config) net.Port {
t.Helper()
port := tcp.PickPort()
listen, err := ListenXH(context.Background(), net.LocalHostIP, port, &internet.MemoryStreamConfig{
ProtocolName: "splithttp",
ProtocolSettings: serverCfg,
}, func(conn stat.Connection) {
go func(c stat.Connection) {
defer c.Close()
var b [5]byte
c.SetReadDeadline(time.Now().Add(5 * time.Second))
if _, err := io.ReadFull(c, b[:]); err != nil {
return
}
common.Must2(c.Write(append([]byte("echo:"), b[:]...)))
}(conn)
})
common.Must(err)
t.Cleanup(func() { listen.Close() })
return port
}
// uplinkEcho fails instead of hanging when the uplink never reaches the server.
func uplinkEcho(t *testing.T, mode, method, transport string) error {
t.Helper()
res := make(chan error, 1)
go func() { res <- uplinkEchoOnce(mode, method, transport) }()
select {
case err := <-res:
return err
case <-time.After(10 * time.Second):
return fmt.Errorf("timed out")
}
}
func uplinkEchoOnce(mode, method, transport string) error {
port := tcp.PickPort()
serverCfg := &internet.MemoryStreamConfig{
ProtocolName: "splithttp",
ProtocolSettings: &Config{Path: "/sh", Mode: mode},
}
clientCfg := &internet.MemoryStreamConfig{
ProtocolName: "splithttp",
ProtocolSettings: &Config{Path: "/sh", Mode: mode, UplinkHTTPMethod: method},
}
if transport == "tls" {
ct, ctHash := cert.MustGenerate(nil, cert.CommonName("localhost"))
sec := &tls.Config{Certificate: []*tls.Certificate{tls.ParseCertificate(ct)}, PinnedPeerCertSha256: [][]byte{ctHash[:]}}
serverCfg.SecurityType, serverCfg.SecuritySettings = "tls", sec
clientCfg.SecurityType, clientCfg.SecuritySettings = "tls", sec
}
listen, err := ListenXH(context.Background(), net.LocalHostIP, port, serverCfg, func(conn stat.Connection) {
go func(c stat.Connection) {
defer c.Close()
var b [5]byte
c.SetReadDeadline(time.Now().Add(5 * time.Second))
if _, err := io.ReadFull(c, b[:]); err != nil {
return
}
common.Must2(c.Write(append([]byte("echo:"), b[:]...)))
}(conn)
})
if err != nil {
return err
}
defer listen.Close()
conn, err := Dial(context.Background(), net.TCPDestination(net.DomainAddress("localhost"), port), clientCfg)
if err != nil {
return err
}
defer conn.Close()
if _, err = conn.Write([]byte("hello")); err != nil {
return err
}
var b [1024]byte
conn.SetReadDeadline(time.Now().Add(4 * time.Second))
n, err := io.ReadFull(conn, b[:len("echo:hello")])
if err != nil || string(b[:n]) != "echo:hello" {
return fmt.Errorf("got %q: %v", b[:n], err)
}
return nil
}
// OPTIONS must carry uplink data exactly like POST does, in every mode and over every transport.
func Test_UplinkHTTPMethodOptions(t *testing.T) {
for _, transport := range []string{"plain", "tls"} {
for _, mode := range []string{"packet-up", "stream-up", "stream-one", "auto"} {
t.Run(transport+"/"+mode, func(t *testing.T) {
if transport == "tls" && runtime.GOARCH == "arm64" {
t.Skip("TLS tests are skipped on arm64, like the other TLS tests in this package")
}
if err := uplinkEcho(t, mode, "POST", transport); err != nil {
t.Skipf("POST baseline does not work in this setup: %v", err)
}
for _, method := range []string{"PUT", "OPTIONS"} {
if err := uplinkEcho(t, mode, method, transport); err != nil {
t.Errorf("%s: %v", method, err)
}
}
})
}
}
}
func Test_CORSPreflightStillAnswered(t *testing.T) {
port := newPacketUpEchoServer(t, &Config{Path: "/sh", Mode: "packet-up"})
req, _ := http.NewRequest("OPTIONS", fmt.Sprintf("http://127.0.0.1:%d/sh/", port), nil)
req.Header.Set("Origin", "https://example.com")
req.Header.Set("Access-Control-Request-Method", "POST")
resp, err := http.DefaultClient.Do(req)
common.Must(err)
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
t.Fatalf("preflight status = %d", resp.StatusCode)
}
if got := resp.Header.Get("Access-Control-Allow-Methods"); got != "POST" {
t.Errorf("Allow-Methods = %q", got)
}
}
func Test_ServerMaxHeaderBytes(t *testing.T) {
port := newPacketUpEchoServer(t, &Config{Path: "/sh", Mode: "packet-up", ServerMaxHeaderBytes: 2048})
big := bytes.Repeat([]byte("a"), 8192)
req, _ := http.NewRequest("GET", fmt.Sprintf("http://127.0.0.1:%d/sh/", port), nil)
req.Header.Set("X-Big", string(big))
resp, err := http.DefaultClient.Do(req)
common.Must(err)
defer resp.Body.Close()
if resp.StatusCode != http.StatusRequestHeaderFieldsTooLarge {
t.Fatalf("oversized header status = %d, want 431", resp.StatusCode)
}
}
+3 -4
View File
@@ -89,9 +89,6 @@ func (dl *DefaultListener) Listen(ctx context.Context, addr net.Addr, sockopt *S
lc.Control = getControlFunc(ctx, sockopt, dl.controllers)
// default disable keepalive
lc.KeepAlive = -1
// MPTCP is enabled by default golang listener
// due to CVE-2026-98432, MPTCP should be disabled by default
lc.SetMultipathTCP(false)
if sockopt != nil {
if sockopt.TcpKeepAliveIdle*sockopt.TcpKeepAliveInterval < 0 {
return nil, errors.New("invalid TcpKeepAliveIdle or TcpKeepAliveInterval value: ", sockopt.TcpKeepAliveIdle, " ", sockopt.TcpKeepAliveInterval)
@@ -110,7 +107,9 @@ func (dl *DefaultListener) Listen(ctx context.Context, addr net.Addr, sockopt *S
lc.KeepAliveConfig.Enable = true
lc.KeepAliveConfig.Interval = time.Duration(sockopt.TcpKeepAliveInterval) * time.Second
}
lc.SetMultipathTCP(sockopt.TcpMptcp)
if sockopt.TcpMptcp {
lc.SetMultipathTCP(true)
}
}
case *net.UnixAddr:
lc.Control = nil
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/tcp/config.proto
package tcp
+2 -2
View File
@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.12
// protoc (unknown)
// protoc-gen-go v1.36.11
// protoc v6.33.5
// source: transport/internet/tls/config.proto
package tls

Some files were not shown because too many files have changed in this diff Show More