Skip to content
This repository has been archived by the owner on Jan 28, 2025. It is now read-only.

Commit

Permalink
Merge branch 'XTLS:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
MHSanaei authored Apr 26, 2024
2 parents f33c8c1 + 45ab4cb commit 36c2303
Show file tree
Hide file tree
Showing 29 changed files with 442 additions and 102 deletions.
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Bug report
description: "Submit Xray-core bug"
body:
- type: checkboxes
attributes:
label: Integrity requirements
description: |-
Please check all of the following options to prove that you have read and understood the requirements, otherwise this issue will be closed.
options:
- label: I confirm that I have read the documentation, understand the meaning of all the configuration items I wrote, and did not pile up seemingly useful options or default values.
required: true
- label: I searched issues and did not find any similar issues.
required: true
- type: textarea
attributes:
label: Version
description: Xray-core version
render: shell
- type: textarea
attributes:
label: Description
description: Please provide a detailed description of the bug. And information that you consider valuable.
validations:
required: true
- type: textarea
attributes:
label: Reproduction
description: |-
Provide method to reproduce the bug.
Please provide config that can reproduce the problem, including both the server and client.
Do not paste a large exported config here. Removing unnecessary inbounds, outbounds, route rules, and options. This cloud help us locate the problem if you really want to get help.
Even if you are using a GUI/script/panel, please follow the above requirements.
DO NOT just write "I'm using xxx GUI/ xxx panel" instead of providing config. We do not have the energy or obligation to find the software and spend time reproducing according to the description.
validations:
required: true
- type: textarea
attributes:
label: log
description: |-
Set the log level to debug.
Please Restart Xray-core, and then follow the reproduction method to reduce irrelevant parts in log.
Remember to remove personal information such as UUID, IP.
Provid complete log, DO NOT just paste the the parts that you think necessary based on your own judgment.
render: shell
44 changes: 44 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report_zh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: bug反馈
description: "提交 Xray-core bug"
body:
- type: checkboxes
attributes:
label: 完整性要求
description: |-
请勾选以下所有选项以证明您已经阅读并理解了以下要求,否则该 issue 将被关闭。
options:
- label: 我保证阅读了文档,了解所有我编写的配置文件项的含义,而不是大量堆砌看似有用的选项或默认值。
required: true
- label: 我搜索了issues,没有发现已提出的类似问题。
required: true
- type: textarea
attributes:
label: 版本
description: 使用的Xray-core版本
render: shell
- type: textarea
attributes:
label: 描述
description: 请提供错误的详细描述。以及你认为有价值的信息。
validations:
required: true
- type: textarea
attributes:
label: 重现方式
description: |-
提供重现BUG方法。
请提供可以重现问题的配置文件,包括服务端和客户端
不要直接在这里黏贴一大段导出的 config 文件。去掉无用的出入站、规则、选项,这可以帮助确定问题,如果你真的想得到帮助。
即使你在使用图形客户端/脚本/面板,也请遵照上述要求。
不要直接用“我使用xxx客户端/xxx面板”替代config,我们没有精力也没有义务去找到项目再花时间按描述重新问题。
validations:
required: true
- type: textarea
attributes:
label: 日志
description: |-
请先将日志等级设置为 debug.
重启 Xray-core ,再按复现方式操作,尽量减少日志中的无关部分。
记得删除有关个人信息(如UUID与IP)的部分。
提供完整的日志,不要仅提供你自己觉得有用的部分。
render: shell
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ NAME = xray

VERSION=$(shell git describe --always --dirty)

export GOARCH ?=
export GOOS ?=

ifdef GOARCH
ifeq ($(GOOS),darwin)
NAME:=$(NAME)-$(GOARCH)
endif
endif

LDFLAGS = -X github.com/xtls/xray-core/core.build=$(VERSION) -s -w -buildid=
PARAMS = -trimpath -ldflags "$(LDFLAGS)" -v
MAIN = ./main
Expand All @@ -26,4 +35,4 @@ install:

clean:
go clean -v -i $(PWD)
rm -f xray xray.exe wxray.exe xray_softfloat
rm -f xray xray.exe wxray.exe xray_softfloat
33 changes: 19 additions & 14 deletions app/proxyman/outbound/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ package outbound

import (
"context"
"crypto/rand"
"errors"
"io"
"math/rand"
gonet "net"
"os"

"github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/buf"
Expand All @@ -25,6 +21,10 @@ import (
"github.com/xtls/xray-core/transport/internet/stat"
"github.com/xtls/xray-core/transport/internet/tls"
"github.com/xtls/xray-core/transport/pipe"
"io"
"math/big"
gonet "net"
"os"
)

func getStatCounter(v *core.Instance, tag string) (stats.Counter, stats.Counter) {
Expand Down Expand Up @@ -319,16 +319,21 @@ func (h *Handler) Close() error {
return nil
}

// Return random IPv6 in a CIDR block

func ParseRandomIPv6(address net.Address, prefix string) net.Address {
addr := address.IP().String()
_, network, _ := gonet.ParseCIDR(addr + "/" + prefix)
_, network, _ := gonet.ParseCIDR(address.IP().String() + "/" + prefix)

ipv6 := network.IP.To16()
prefixLen, _ := network.Mask.Size()
for i := prefixLen / 8; i < 16; i++ {
ipv6[i] = byte(rand.Intn(256))
}
maskSize, totalBits := network.Mask.Size()
subnetSize := big.NewInt(1).Lsh(big.NewInt(1), uint(totalBits-maskSize))

// random
randomBigInt, _ := rand.Int(rand.Reader, subnetSize)

startIPBigInt := big.NewInt(0).SetBytes(network.IP.To16())
randomIPBigInt := big.NewInt(0).Add(startIPBigInt, randomBigInt)

randomIPBytes := randomIPBigInt.Bytes()
randomIPBytes = append(make([]byte, 16-len(randomIPBytes)), randomIPBytes...)

return net.ParseAddress(gonet.IP(ipv6).String())
return net.ParseAddress(gonet.IP(randomIPBytes).String())
}
2 changes: 1 addition & 1 deletion app/router/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/router/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ message StrategyLeastLoadConfig {
repeated int64 baselines = 3;
// expected nodes count to select
int32 expected = 4;
// max acceptable rtt, filter away high delay nodes. defalut 0
// max acceptable rtt, filter away high delay nodes. default 0
int64 maxRTT = 5;
// acceptable failure rate
float tolerance = 6;
Expand Down
2 changes: 1 addition & 1 deletion common/session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type Inbound struct {
Tag string
// Name of the inbound proxy that handles the connection.
Name string
// User is the user that authencates for the inbound. May be nil if the protocol allows anounymous traffic.
// User is the user that authenticates for the inbound. May be nil if the protocol allows anonymous traffic.
User *protocol.MemoryUser
// Conn is actually internet.Connection. May be nil.
Conn net.Conn
Expand Down
2 changes: 1 addition & 1 deletion core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type ConfigLoader func(input interface{}) (*Config, error)
// ConfigBuilder is a builder to build core.Config from filenames and formats
type ConfigBuilder func(files []string, formats []string) (*Config, error)

// ConfigMerger merge multiple json configs into on config
// ConfigsMerger merge multiple json configs into on config
type ConfigsMerger func(files []string, formats []string) (string, error)

var (
Expand Down
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
var (
Version_x byte = 1
Version_y byte = 8
Version_z byte = 10
Version_z byte = 11
)

var (
Expand Down
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@ module github.com/xtls/xray-core
go 1.22

require (
github.com/OmarTariq612/goech v0.0.0-20240405204721-8e2e1dafd3a0
github.com/cloudflare/circl v1.3.8
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344
github.com/golang/mock v1.7.0-rc.1
github.com/google/go-cmp v0.6.0
github.com/gorilla/websocket v1.5.1
github.com/miekg/dns v1.1.58
github.com/miekg/dns v1.1.59
github.com/pelletier/go-toml v1.9.5
github.com/pires/go-proxyproto v0.7.0
github.com/quic-go/quic-go v0.42.0
github.com/refraction-networking/utls v1.6.3
github.com/refraction-networking/utls v1.6.4
github.com/sagernet/sing v0.3.8
github.com/sagernet/sing-shadowsocks v0.2.6
github.com/seiflotfy/cuckoofilter v0.0.0-20220411075957-e3b120b3f5fb
Expand All @@ -20,26 +22,24 @@ require (
github.com/vishvananda/netlink v1.2.1-beta.2.0.20230316163032-ced5aaba43e3
github.com/xtls/reality v0.0.0-20231112171332-de1173cf2b19
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba
golang.org/x/crypto v0.21.0
golang.org/x/net v0.22.0
golang.org/x/sync v0.6.0
golang.org/x/sys v0.18.0
golang.org/x/crypto v0.22.0
golang.org/x/net v0.24.0
golang.org/x/sync v0.7.0
golang.org/x/sys v0.19.0
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173
google.golang.org/grpc v1.62.1
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
gvisor.dev/gvisor v0.0.0-20231104011432-48a6d7d5bd0b
gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489
h12.io/socks v1.0.3
lukechampine.com/blake3 v1.2.1
lukechampine.com/blake3 v1.2.2
)

require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 // indirect
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/pprof v0.0.0-20240227163752-401108e1b7e7 // indirect
github.com/klauspost/compress v1.17.7 // indirect
Expand Down
Loading

0 comments on commit 36c2303

Please sign in to comment.