Skip to content
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

BUG: splice: bad file descriptor #73

Open
ne1llee opened this issue Sep 27, 2024 · 3 comments
Open

BUG: splice: bad file descriptor #73

ne1llee opened this issue Sep 27, 2024 · 3 comments

Comments

@ne1llee
Copy link

ne1llee commented Sep 27, 2024

The sock5 proxy service running on a device with armv7l and linux kernel version 3.10.39 cannot be accessed normally.

server: writeto tcp 192.168.1.44:38851->74.125.24.104:80: readfrom tcp4 192.168.1.44:1080->46.12.112.133:33248: splice: bad file descriptor
@thinkgos
Copy link
Member

show the minimum code that can reproduce the problem

@ne1llee
Copy link
Author

ne1llee commented Sep 27, 2024

Quote reply
Refere

func (p *Sock5) Start() error {
	if p.status == plugins.Running {
		return fmt.Errorf("is already running")
	}

	var options []socks5.Option
	options = append(options, socks5.WithLogger(socks5.NewLogger(p.logger)))

	if p.username != "" && p.password != "" {
		cator := socks5.UserPassAuthenticator{Credentials: socks5.StaticCredentials{p.username: p.password}}
		options = append(options, socks5.WithAuthMethods([]socks5.Authenticator{cator}))
	}

	p.server = socks5.NewServer(options...)

	var err error
	p.listener, err = net.Listen("tcp", p.address)
	if err != nil {
		return fmt.Errorf("failed to start: %w", err)
	}

	p.ctx, p.cancel = context.WithCancel(context.Background())
	go func() {
		if err := p.server.Serve(p.listener); err != nil {
			fmt.Println("stopped:", err)
		}
	}()
	fmt.Println("started")
	return nil
}

@thinkgos
Copy link
Member

this code can't run on my machine

@thinkgos thinkgos reopened this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants