mitch's recent timeline updates
mitch

mitch

V2EX member #78611, joined on 2014-10-26 10:03:52 +08:00
mitch's recent replies
Jun 26, 2019
Replied to a topic by yuhua 问与答 如何通过 golang 使用 vpn?
今天遇到同样问题,简单搜索了一下,go 1.11 发布后事情简单了点,net 的 dialer 里增加了 Control 的 handler 方便对 socket 进行操作,如下:

---------------------------------

net.Dialer{
Control: func(network, address string, c syscall.RawConn) error {
return c.Control(func(fd uintptr) {
err := syscall.SetsockoptString(int(fd), syscall.SOL_SOCKET, 25, "ppp0")
if err != nil {
log.Printf("control: %s", err)
return
}
})
},
}
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2517 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 06:20 · PVG 14:20 · LAX 23:20 · JFK 02:20
♥ Do have faith in what you're doing.