diff --git a/client/ish_listener_linux_386.go b/client/ish_listener_linux_386.go index c50e4c3..0b4932b 100644 --- a/client/ish_listener_linux_386.go +++ b/client/ish_listener_linux_386.go @@ -1,4 +1,5 @@ //go:build linux && 386 + package main import ( @@ -26,7 +27,7 @@ func wrapISHListener(ln net.Listener) (net.Listener, error) { if err != nil { return nil, err } - + // Keep a reference to *os.File so the garbage collector doesn't close the FD. return &ishListener{Listener: ln, f: f, fd: int(f.Fd())}, nil } @@ -41,11 +42,11 @@ func (l *ishListener) Accept() (net.Conn, error) { for { addr := make([]byte, 128) addrlen := uintptr(128) - - // i386 network syscalls are multiplexed via socketcall (102). + + // i386 network syscalls are multiplexed via socketcall (102). // SYS_ACCEPT is subcall 5. args := [3]uintptr{uintptr(l.fd), uintptr(unsafe.Pointer(&addr[0])), uintptr(unsafe.Pointer(&addrlen))} - + // Use Syscall6 to ensure we have enough arguments registers for the platform. r1, _, errno := syscall.Syscall6(102, 5, uintptr(unsafe.Pointer(&args)), 0, 0, 0, 0) if errno != 0 { @@ -54,10 +55,10 @@ func (l *ishListener) Accept() (net.Conn, error) { } return nil, errno } - + nfd := int(r1) - - // We avoid Go's net.FileConn because it tries to register the fd with Go's epoll poller, + + // We avoid Go's net.FileConn because it tries to register the fd with Go's epoll poller, // which in iSH emulator consistency fails with EEXIST (file exists). // Instead, we return a custom blocking net.Conn wrapper. conn := &ishConn{fd: nfd} diff --git a/client/ish_listener_other.go b/client/ish_listener_other.go index a100a1b..d46659d 100644 --- a/client/ish_listener_other.go +++ b/client/ish_listener_other.go @@ -1,4 +1,5 @@ //go:build !(linux && 386) + package main import "net" diff --git a/client/main.go b/client/main.go index ea41a52..6a594a6 100644 --- a/client/main.go +++ b/client/main.go @@ -2046,13 +2046,13 @@ func runVLESSMode(ctx context.Context, tp *turnParams, peer *net.UDPAddr, listen if err != nil { log.Panicf("TCP listen: %s", err) } - + wrappedListener, err := wrapISHListener(listener) if err != nil { log.Printf("Warning: failed to wrap listener: %v", err) wrappedListener = listener } - + context.AfterFunc(ctx, func() { _ = wrappedListener.Close() }) log.Printf("VLESS mode: listening on %s (round-robin across %d sessions)", listenAddr, numSessions) diff --git a/client/slider_captcha.go b/client/slider_captcha.go index fb0cc96..cb47915 100644 --- a/client/slider_captcha.go +++ b/client/slider_captcha.go @@ -802,7 +802,6 @@ func renderSliderCandidate(img image.Image, gridSize int, mapping []int) (*image return rendered, nil } - func sliderTileRect(bounds image.Rectangle, gridSize int, index int) image.Rectangle { row := index / gridSize col := index % gridSize