Skip to content

Add VLESS seed configurations #3260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
29 changes: 14 additions & 15 deletions common/buf/copy.go
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ import (

type dataHandler func(MultiBuffer)

type copyHandler struct {
onData []dataHandler
type CopyHandler struct {
OnData []dataHandler
}

// SizeCounter is for counting bytes copied by Copy().
@@ -21,30 +21,30 @@ type SizeCounter struct {
}

// CopyOption is an option for copying data.
type CopyOption func(*copyHandler)
type CopyOption func(*CopyHandler)

// UpdateActivity is a CopyOption to update activity on each data copy operation.
func UpdateActivity(timer signal.ActivityUpdater) CopyOption {
return func(handler *copyHandler) {
handler.onData = append(handler.onData, func(MultiBuffer) {
return func(handler *CopyHandler) {
handler.OnData = append(handler.OnData, func(MultiBuffer) {
timer.Update()
})
}
}

// CountSize is a CopyOption that sums the total size of data copied into the given SizeCounter.
func CountSize(sc *SizeCounter) CopyOption {
return func(handler *copyHandler) {
handler.onData = append(handler.onData, func(b MultiBuffer) {
return func(handler *CopyHandler) {
handler.OnData = append(handler.OnData, func(b MultiBuffer) {
sc.Size += int64(b.Len())
})
}
}

// AddToStatCounter a CopyOption add to stat counter
func AddToStatCounter(sc stats.Counter) CopyOption {
return func(handler *copyHandler) {
handler.onData = append(handler.onData, func(b MultiBuffer) {
return func(handler *CopyHandler) {
handler.OnData = append(handler.OnData, func(b MultiBuffer) {
if sc != nil {
sc.Add(int64(b.Len()))
}
@@ -88,18 +88,17 @@ func IsWriteError(err error) bool {
return ok
}

func copyInternal(reader Reader, writer Writer, handler *copyHandler) error {
func copyInternal(reader Reader, writer Writer, handler *CopyHandler) error {
for {
buffer, err := reader.ReadMultiBuffer()
if !buffer.IsEmpty() {
for _, handler := range handler.onData {
handler(buffer)
}

if werr := writer.WriteMultiBuffer(buffer); werr != nil {
return writeError{werr}
}
}
for _, handler := range handler.OnData {
handler(buffer)
}

if err != nil {
return readError{err}
@@ -109,7 +108,7 @@ func copyInternal(reader Reader, writer Writer, handler *copyHandler) error {

// Copy dumps all payload from reader to writer or stops when an error occurs. It returns nil when EOF.
func Copy(reader Reader, writer Writer, options ...CopyOption) error {
var handler copyHandler
var handler CopyHandler
for _, option := range options {
option(&handler)
}
Loading

Unchanged files with check annotations Beta

ADD https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat /loyalsoldier/geosite.dat
# chainguard/static contains only tzdata and ca-certificates, can be built with multiarch static binaries.
FROM --platform=linux/amd64 chainguard/static:latest

Check warning on line 14 in .github/docker/Dockerfile

GitHub Actions / build-image

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/

Check warning on line 14 in .github/docker/Dockerfile

GitHub Actions / build-image

FROM --platform flag should not use a constant value

FromPlatformFlagConstDisallowed: FROM --platform flag should not use constant value "linux/amd64" More info: https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/
WORKDIR /var/log/xray
COPY .github/docker/files/config.json /etc/xray/config.json
COPY --from=build --chmod=755 /src/xray /usr/bin/xray