Browse Source

style: run gofmt

pull/181/head
Moroka8 3 months ago
parent
commit
57e377fe20
  1. 15
      client/ish_listener_linux_386.go
  2. 1
      client/ish_listener_other.go
  3. 4
      client/main.go
  4. 1
      client/slider_captcha.go

15
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}

1
client/ish_listener_other.go

@ -1,4 +1,5 @@
//go:build !(linux && 386)
package main
import "net"

4
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)

1
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

Loading…
Cancel
Save