Fix: cannot listen socks5 port on wsl (#748)
This commit is contained in:
parent
9f1d85ab6e
commit
99b34e8d8b
2 changed files with 4 additions and 2 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/Dreamacro/clash/common/sockopt"
|
"github.com/Dreamacro/clash/common/sockopt"
|
||||||
|
"github.com/Dreamacro/clash/log"
|
||||||
|
|
||||||
D "github.com/miekg/dns"
|
D "github.com/miekg/dns"
|
||||||
)
|
)
|
||||||
|
@ -62,7 +63,7 @@ func ReCreateServer(addr string, resolver *Resolver) error {
|
||||||
|
|
||||||
err = sockopt.UDPReuseaddr(p)
|
err = sockopt.UDPReuseaddr(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
log.Warnln("Failed to Reuse UDP Address: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
address = addr
|
address = addr
|
||||||
|
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/Dreamacro/clash/common/sockopt"
|
"github.com/Dreamacro/clash/common/sockopt"
|
||||||
"github.com/Dreamacro/clash/component/socks5"
|
"github.com/Dreamacro/clash/component/socks5"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/Dreamacro/clash/constant"
|
||||||
|
"github.com/Dreamacro/clash/log"
|
||||||
"github.com/Dreamacro/clash/tunnel"
|
"github.com/Dreamacro/clash/tunnel"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ func NewSocksUDPProxy(addr string) (*SockUDPListener, error) {
|
||||||
|
|
||||||
err = sockopt.UDPReuseaddr(l.(*net.UDPConn))
|
err = sockopt.UDPReuseaddr(l.(*net.UDPConn))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
log.Warnln("Failed to Reuse UDP Address: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sl := &SockUDPListener{l, addr, false}
|
sl := &SockUDPListener{l, addr, false}
|
||||||
|
|
Loading…
Reference in a new issue