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

Custom outgoing address #8

Open
undefinedteam1 opened this issue Oct 18, 2022 · 0 comments
Open

Custom outgoing address #8

undefinedteam1 opened this issue Oct 18, 2022 · 0 comments

Comments

@undefinedteam1
Copy link

undefinedteam1 commented Oct 18, 2022

Hi.

I want set outgoing address (ipv6) for this socks5. I tried this code, but got error
"socks5: 2022/10/18 06:55:40 [E]: server: connect to xxxx:443 failed, dial tcp: address [xxxx:xxxx::1]:0: no suitable address found"

`
server := socks5.NewServer(
socks5.WithLogger(socks5.NewLogger(log.New(os.Stdout, "socks5: ", log.LstdFlags))),
socks5.WithDial(func(ctx context.Context, network, addr string) (net.Conn, error) {
localAddr, _ := net.ResolveTCPAddr("tcp", "[2a0f:103::1]:0")
d := net.Dialer{LocalAddr: localAddr}
return d.Dial(network, addr)
}),
)

// Create SOCKS5 proxy on localhost port 8000
if err := server.ListenAndServe("tcp", "0.0.0.0:8000"); err != nil {
	panic(err)
}

`

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

1 participant